Locomotive BASIC

First appeared| 1984; 40 years ago (1984)
OS| AMSDOS
License| Proprietary
Influenced by

* Mallard BASIC
* BBC BASIC

Locomotive Basic is a proprietary dialect of the BASIC programming language written by Locomotive Software on the Amstrad CPC (where it was built-in on ROM) and the later Locomotive BASIC-2 as a GEM application on the Amstrad PC1512 and 1640. It was the main descendant of Mallard BASIC,[1] the interpreter for CP/M supplied with the Amstrad PCW.

There are two versions of Locomotive BASIC: 1.0 which only came with the CPC model 464, and 1.1 which shipped with all other versions. BASIC 1.1 was also shipped with the Amstrad CPC Plus series machines, as part of the included game cartridge.

## Contents

* 1 Development
* 2 Features
* 3 Contemporary rivals
* 4 References
* 5 External links

## Development

Development was based on existing work recently undertaken writing Mallard BASIC for Acorn Computers Z80 addon for the BBC Micro. It is reported to have taken around 12 weeks to enhance the existing code, and was "very influenced" by BBC BASIC, though adding additional functions to do things that would have required assembly language on the BBC.[1]

## Features

A program in Locomotive BASIC which draws a world map in Mode 1 (320x200px and 4 colours)

Printing colour bars on the screen in Mode 0 (16 colours) with BASIC

Amstrad CPC colour palette with ink numbers

It was a rather simple but powerful BASIC implementation by the standards of the day, featuring dedicated commands for handling graphics (such as DRAW, PLOT, INK, and PAPER in all versions; plus FILL in v1.1), even allowing the creation of multiple screens, windows, and the like, although the color system and palette handling was awkward. A table giving the numeric codes for the 27 system colors was printed over the built-in 3" disk drive casing on the 664 and later machines. Simple as it was, it did stand out however among other BASICs of the time by offering a timer-based software interrupt mechanism using the EVERY or AFTER commands; this offered a timed repeating or one-off call respectively to the BASIC line number of the user's choice.

Also, when compared to other home computers of the time, the Amstrad via Locomotive BASIC granted a relatively high level of control over the CPC sound chip, an AY-3-8912 with 3 melodic channels and 1 noise channel. The same chip was also used on late-model ZX Spectrums, as well as the Atari ST and MSX computers, but none of those had such a complete built-in SOUND command. Many things, from selecting a particular channel or a combination of channels, setting envelopes, volume, pitch, noise, and so on could be done with a single SOUND command, with up to 7 parameters. Granted, especially complex and/or low-level techniques could not be done with BASIC due to their requiring more precise or direct access to the hardware, e.g. especially complex music from trackers (including simulated chords using arpeggios, etc.), the playback of digitally sampled sounds as in the game RoboCop for example, and so on.

Disk, tape, and file management were managed by BASIC itself, and were usually good enough for simple file management, with commands such as GET, PUT, ERASE, SAVE, MERGE, RUN, CAT, LOAD etc. In fact, during those years, the BASIC supplied as standard with most low-cost home computers also acted as a more or less simple operating system.

Loading a picture from floppy disk in Locomotive BASIC

Also available were some special commands for memory allocation and handling, like MEMORY and a parametric LOAD command, allowing, for example, to load a file containing "raw" picture data into video memory, causing it to be displayed, with a couple of BASIC instructions. Adding the right memory address(es) as parameter to the commands LOAD or SAVE would allow easy loading of raw uncompressed 16 KB screen pictures. CALLing another address gave a forced system reset (call 0), the famous "Press Any Key" (call &bb18) or for eliminating flicker in animation by allowing you to synchronize with the monitor's raster scan via "sync frame-flyback" (call &bd19); this was given its own dedicated command in Basic 1.1 - FRAME. With PEEK and POKE, CALL provided an interface to assembly language programming from BASIC.

## Contemporary rivals

Unlike the Commodore 64's built in BASIC (Commodore BASIC), which had no dedicated commands for graphics or sound, Locomotive BASIC allowed doing pretty much anything that was within the standard capabilities of the machine. This was not unimportant, as some other machines of the era required programmers to use assembler in order to access the full sound and graphics capabilities of their system. MSX, Sinclair Spectrum and some others offered a similar, more or less complete command set for their sound and graphics capabilities. The only things going clearly beyond BASIC capabilities were the overscan modes used in games and demos, 27-color graphics modes, digital sound playback, and smooth scrolling.

Unlike Sinclair BASIC or Commodore 64 BASIC, which had various keyboard command shortcuts or specialized keys for choosing symbols or colors, Locomotive BASIC keywords were typed in full and the interpreter parsed, recognized and tokenised them. However, there were abbreviations like "?" for "PRINT" and a few shortcuts. Programs could be saved onto Compact Cassette or floppy disk and retrieved as binary or ASCII files.

## References

1. ↑ Smith, Tony (12 February 2014). "You're NOT fired: The story of Amstrad's amazing CPC 464". The Register. https://www.theregister.co.uk/2014/02/12/archaeologic_amstrad_cpc_464/. Retrieved 17 February 2014.

## External links

* Locomotive BASIC reference
* Command reference with code examples
* Command reference (incomplete)
* Additional code examples at Rosetta Code

* v
* t
* e

Dialects of the BASIC programming language (list)

Classic|

* Altair BASIC
* Applesoft BASIC
* Atari BASIC
* Atari 2600 BASIC
* Atari Microsoft BASIC
* Atari ST BASIC
* BASIC-PLUS
* BASICA
* BASIC A+
* BASIC XE
* BASIC XL
* Casio BASIC
* CBASIC
* Chipmunk Basic
* Color BASIC
* Commodore BASIC
* Extended Color BASIC
* Dartmouth BASIC
* Disk Extended Color BASIC
* Family BASIC
* GFA BASIC
* GW-BASIC
* HP BASIC for OpenVMS
* HP Time-Shared BASIC
* IBM BASIC
* Integer BASIC
* Locomotive BASIC
* Mallard BASIC
* Microsoft BASIC
* MSX BASIC
* Pure Basic
* Rocky Mountain BASIC
* S'-BASIC (Tandy, Casio, Sharp Pocket Computers)
* SCELBAL
* ScriptBasic
* Sinclair BASIC
* Southampton BASIC System
* STOS BASIC
* TI BASIC (TI 99/4A)
* TI-BASIC (calculators)
* TI Extended BASIC (aka XBasic)
* Tiny BASIC
* Turbo-Basic XL
* Tymshare SUPER BASIC
* UBASIC
* Vilnius BASIC
* XBasic

Procedure-oriented|

* AmigaBASIC
* AMOS BASIC
* ASIC
* BBC BASIC
* Beta BASIC
* DarkBASIC
* FreeBASIC
* FutureBASIC
* GFA BASIC
* GLBasic
* Liberty BASIC
* Microsoft Small Basic
* PowerBASIC
* PureBasic
* QBasic
* QB64
* QuickBASIC
* SmallBASIC
* SuperBASIC
* ThinBasic
* True BASIC
* Turbo Basic
* XBasic
* Xblite
* Basic4ppc
* Visual Test
* B4J

With object extensions|

* AutoIt
* Basic For Qt (KBasic)
* BlitzMax
* Chipmunk Basic
* FreeBASIC
* Gambas
* GLBasic
* HBasic
* OpenOffice Basic
* PowerBASIC
* ProvideX
* RapidQ
* REALbasic
* Run BASIC
* Visual Basic
* Visual Basic .NET
* Xojo

For mobile devices|

* B4X
* Basic4android (B4A)
* Basic4ppc
* GLBasic
* NS Basic
* Basic4ios (B4i)

Microsoft|

* Microsoft BASIC
* MBASIC
* IBM BASIC/BASICA
* GW-BASIC
* QuickBASIC
* QBasic
* VBScript
* Visual Basic
* VBA
* Visual Basic .NET
* Embedded Visual Basic
* VB 5 for Microsoft Excel 5.0
* VSTO
* VSTA
* WordBASIC
* TRS-80 Basics (Level I, Level II, Level III)
* Microsoft Small Basic

Third-party VB-like|

* B4X
* Basic For Qt
* Gambas
* HBasic
* Hummingbird Basic
* LotusScript
* WinWrapBasic
* Xojo

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Locomotive BASIC. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Locomotive_BASIC&oldid=3381846"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template