Category:Locomotive Basic: Difference between revisions

no edit summary
No edit summary
Line 4:
{{implementation|BASIC}}
 
'''Locomotive BASIC''' is a variant of BASIC that is built into the ROM of the [[wp:Amstrad CPC|Amstrad CPC]] series of Z80-based home computers introduced in 1984. In the 1980s, the CPC was a popular, slightly more expensive alternative to the Commodore C64/C128. It was not just suited for games but also office work because of its high resolution display and [[wp:CP/M|CP/M]] support.
 
The CPC was based on a Zilog Z80 CPU running at 4 MHz and came with a built-in cassette deck (CPC 464) or 3" disk drive (CPC 664 and
6128) as storage devices and a green screen or color monitor which also housed theits power supply. Amstrad CPC sales were particularly strong in the UK, Germany, France, and Spain.
 
The easiest way to use Locomotive BASIC today is [https://benchmarko.github.io/CPCBasic/cpcbasic.html CPCBasic], a very fast implementation in JavaScript which also allows easy pasting of code from Rosetta Code. Note that programs will run much faster in CPCBasic than on a real CPC, so animations may require an extra delay for each frame, e.g. a delay loop:<lang locobasic>for delay=1 to 10000:next</lang> or the "frame" command which will wait for the next frame.
Today, Locomotive BASIC can be used via native CPC emulators such as [http://www.winape.net/ WinAPE] (Windows) or [http://sourceforge.net/projects/javacpc/ JavaCPC] (Windows/macOS/Linux), which is also perfectly legal because Amstrad has given their permission for distributing CPC ROM images with emulators.
 
For web browsers there is also a [https://benchmarko.github.io/CPCBasic/cpcbasic.html JavaScript emulator for Locomotive Basic] itself, which allows easy pasting of code from Rosetta Code. Note that programs will run much faster in CPCBasic than on a real CPC, so animations may require an extra delay for each frame, e.g. a delay loop:<lang locobasic>for delay=1 to 10000:next</lang> or the "frame" command which will wait for the next frame. [https://www.retrovm.com/ CPCBox] is another option for the web browser option, a whole-machine JavaScript CPC emulator mainly for games which has good compatibility but which lacks copy and paste support.
 
Today, Locomotive BASIC can also be used via native CPC emulators such as [http://www.winape.net/ WinAPE] (Windows) or [http://sourceforge.net/projects/javacpc/ JavaCPC] (Windows/macOS/Linux),. whichAll isthese CPC emulators also perfectly legal because Amstrad has given their permission for distributing CPC ROM images with emulators.
 
==Getting started with Locomotive BASIC==
 
Either use the CPCBasic browser-based Locomotive Basic emulator (https://benchmarko.github.io/CPCBasic/cpcbasic.html) or download a native CPC emulator binary for your platform. A list of emulators is available at http://cpcwiki.eu/index.php/Emulators. JavaCPC (http://sourceforge.net/projects/javacpc/) or WinAPE (http://www.winape.net/) are particularly recommended.
 
In CPCBasic, enter your program, e.g.
 
<lang locobasic>10 print "Hello World!"</lang>
 
into the "CPC Basic" text box at the top and then press the Run button below it. Output goes to the blue CPC screen below. You can also interact with the CPC screen directly if you first click on it with the mouse. The Reset button stops a running program and returns you to the Ready prompt.
 
In a native emulator, just type
 
<lang locobasic>10 print "Hello World!"
run</lang>
 
to run your first Locomotive BASIC program.
 
==Features==
Line 43 ⟶ 62:
 
The extensive CPC user manual features a finely written introduction to BASIC that does not feel as rushed or dumbed-down as in some other manuals of the time. Obviously Amstrad expected many customers would want to program their CPCs themselves, not just use them with off-the-shelf software. There are even some pretty decent BASIC type-in games in appendix 3, such as clones of the arcade classics ''[[wp:Breakout (video game)|Breakout]]'' and ''[[wp:Pong|Pong]]''.
 
==Getting started with Locomotive BASIC==
 
Either use the CPCBasic browser-based Locomotive Basic emulator (https://benchmarko.github.io/CPCBasic/cpcbasic.html) or download a native CPC emulator binary for your platform. A list of emulators is available at http://cpcwiki.eu/index.php/Emulators. JavaCPC (http://sourceforge.net/projects/javacpc/) or WinAPE (http://www.winape.net/) are particularly recommended.
 
In CPCBasic, enter your program, e.g.
 
<lang locobasic>10 print "Hello World!"</lang>
 
into the "CPC Basic" text box at the top and then press the Run button below it. Output goes to the blue CPC screen below. You can also interact with the CPC screen directly if you first click on it with the mouse. The Reset button stops a running program and returns you to the Ready prompt.
 
In a native emulator, just type
 
<lang locobasic>10 print "Hello World!"
run</lang>
 
to run your first Locomotive BASIC program.
 
==References==
Anonymous user