Difference between revisions of "Locomotive BASIC"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(/* Added link and BBC Basic)
Line 1: Line 1:
 
{{stub}}
 
{{stub}}
 +
 
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.
 
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.
  
 
== Description ==
 
== Description ==
  
Locomotive BASIC, was one of the best and fastest BASIC implementation of that era. It featured a comprehensive graphic capabilities with it's PLOT, DRAW, PAPER, INK, PEN, BORDER, CIRCLE and FILL commands, a feature that was missing in Commodore BASIC.
+
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.
  
It had a very extensive sound commands, granting almost full control of the [[AY-3-8912]]. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.
+
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 menagment, with MEMORY and LOAD commands. The later, alowed for loading of raw screen data, thus providing easy picture showing. Also, the LOAD command together with CALL, PEEK and POKE provided an easy method for mixing basic and assembly code, granting possibility to speed up BASIC routines, witch, being interpreted were inevitably slow.
+
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.
  
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided something that could be called "stub of a structure programing", feature that was beaten only by the BBC Micro's BASIC.
+
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of "structured programming", though nowhere near the extent of the PROCedures of [[BBC BASIC]].
  
 
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.
 
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.
 +
 +
== History ==
 +
 +
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 shipped with [[BASIC 1.0]] on ROM.
 +
 +
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:
 +
 +
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)
 +
* Better handling of string arguments to RSXs (|DIR,"*.BAS" rather than a$="*.BAS":|DIR,@a$)
 +
* FILL command (fill area with solid colour)
 +
* COPYCHR$ function (fetch character from screen)
 +
* Better garbage collection
 +
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)
 +
* FRAME (CALL &BD19)
 +
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)
 +
* GRAPHICS PAPER, GRAPHICS PEN commands
 +
* ON BREAK CONT (disable ESCape)
 +
* CLEAR INPUT (flush keyboard buffer)
 +
 +
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.
 +
 +
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.
  
 
== Command list ==
 
== Command list ==

Revision as of 10:41, 1 September 2006

Template:Stub

Locomotive BASIC was a BASIC interpreter for the Amstrad CPC range of computers.

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.

With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of "structured programming", though nowhere near the extent of the PROCedures of BBC BASIC.

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.

History

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 shipped with BASIC 1.0 on ROM.

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:

  • DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)
  • Better handling of string arguments to RSXs (|DIR,"*.BAS" rather than a$="*.BAS":|DIR,@a$)
  • FILL command (fill area with solid colour)
  • COPYCHR$ function (fetch character from screen)
  • Better garbage collection
  • Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)
  • FRAME (CALL &BD19)
  • Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)
  • GRAPHICS PAPER, GRAPHICS PEN commands
  • ON BREAK CONT (disable ESCape)
  • CLEAR INPUT (flush keyboard buffer)

Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.

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.

Command list

Commands and operators

AFTER
[...]
AUTO
[...]
BORDER
[...]
CALL
[...]
CAT
[...]
CHAIN
[...]
CLEAR
[...]
CLG
[...]
CLOSEIN
[...]
CLOSEOUT
[...]
CLS
[...]
CONT
[...]
CURSOR
[...]
DATA
[...]
DEF
[...]
DEFINT
[...]
DEFREAL
[...]
DEFSTR
[...]
DEG
[...]
DELETE
[...]
DI
[...]
DIM
[...]
DRAW
[...]
DRAWR
[...]
EDIT
[...]
EI
[...]
END
[...]
ENT
[...]
ENV
[...]
ERASE
[...]
ERL
[...]
ERROR
[...]
EVERY
[...]
FILL
[...]
FN
[...]
FOR TO STEP NEXT
[...]
FRAME
[...]
GOSUB
[...]
GOTO
[...]
GRAPHICS
[...]
IF THEN ELSE
[...]
INK
[...]
INPUT
[...]
KEY
[...]
LET
[...]
LINE
[...]
LIST
[...]
LOAD
[...]
LOCATE
[...]
MASK
[...]
MEMORY
[...]
MERGE
[...]
MID$
[...]
MODE
[...]
MOVE
[...]
MOVER
[...]
NEW
[...]
ON BREAK
[...]
ON ERROR
[...]
OPENIN
[...]
OPENOUT
[...]
ORIGIN
[...]
OUT
[...]
PAPER
[...]
PEN
[...]
PLOT
[...]
PLOTR
[...]
POKE
[...]
PRINT
[...]
RAD
[...]
RANDOMIZE
[...]
READ
[...]
RELEASE
[...]
REM
[...]
REM
[...]
RENUM
[...]
RESTORE
[...]
RESUME
[...]
RETURN
[...]
RUN
[...]
SAVE
[...]
SOUND
[...]
SPC
[...]
SPEED
[...]
SQ
[...]
STOP
[...]
SUB
[...]
SWAP
[...]
SYMBOL
[...]
TAB
[...]
TAG
[...]
TAGOFF
[...]
TROFF
[...]
TRON
[...]
USING
[...]
WAIT
[...]
WHILE WEND
[...]
WIDTH
[...]
WINDOW
[...]
WRITE
[...]
ZONE
[...]

Operators

AND
[...]
MOD
[...]
NOT
[...]
OR
[...]
XOR
[...]

Functions

ABS
[...]
ASC
[...]
ATN
[...]
BIN$
[...]
CHR$
[...]
CINT
[...]
COPYCHR$
[...]
COS
[...]
CREAL
[...]
DEC$
[...]
DERR
[...]
EOF
[...]
ERR
[...]
EXP
[...]
FIX
[...]
FRE
[...]
HEX$
[...]
HIMEM
[...]
INKEY
[...]
INKEY$
[...]
INP
[...]
INSTR
[...]
INT
[...]
JOY
[...]
LEFT$
[...]
LEN
[...]
LOG
[...]
LOG10
[...]
LOWER$
[...]
MAX
[...]
MIN
[...]
PEEK
[...]
PI
[...]
POS
[...]
REMAIN
[...]
RIGHT$
[...]
RND
[...]
ROUND
[...]
SGN
[...]
SIN
[...]
SPACE$
[...]
SQ
[...]
SQR
[...]
STR$
[...]
STRING$
[...]
TAN
[...]
TEST
[...]
TESTR
[...]
TIME
[...]
UNT
[...]
UPPER$
[...]
VAL
[...]
VPOS
[...]
XPOS
[...]
YPOS
[...]

(Please, fill in. Looks like a lot of work ;-) ...)

Other Basic Dialects avaliable for the CPC

BBC Basic

Web links