Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Locomotive BASIC
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Advanced features == A stand-out feature among almost every other BASIC of the time is a timer-based software interrupt mechanism at 50 ticks per second using the <code>EVERY</code>, <code>AFTER</code> and <code>REMAIN</code> commands (leveraging the KERNEL for its software interrupts). Four timers were available; 0β3, with associated reducing priority - a BASIC imposition not a platform limitation and allows the programmer to run sections of their BASIC program, asynchronously, after a given delay, repeating if required, e.g. <code>EVERY 50,0 GOSUB <line></code> produces a repeating one-second call with no further work. When answering an EVERY or AFTER, there is an implicit disabling (see DI below) of all lower-priority interrupts which is automatically cleared by the corresponding <code>RETURN</code>. As with all Interrupt Service Routines (ISR), such GOSUBs should be kept as short as possible, rather setting a flag for further processing of large chunks of program than trying to complete it inside the ISR. The interrupt ability requires some method to limit its impact when unwanted. Two commands; <CODE>DI</CODE> and <CODE>EI</CODE> Disable and Enable BASIC interrupts respectively. DI should be used sparingly as it will interfere with all BASIC interrupt driven functionality: timers, colour flashing, keyboard scanning, sound output etc., thus program enclosed by DI and EI should be considered to have the same requirements as ISRs to avoid stunted program flow. Amstrad BASIC granted a relatively high level of control over the sound chip, an [[AY-3-8912]] with 3 tone channels and 1 noise channel and interrupt driven sound generation with comprehensive co-ordination of the three audio channels and associated BASIC commands: <code>SQ()</code> (Sound Queue), <code>ON SQ <channel> GOSUB <line></code> etc. The same chip was also used on late-model [[ZX Spectrum]]s, as well as the [[Atari ST]] and [[MSX]] computers, but none of those had such a complete built-in <code>SOUND</code> 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 <code>SOUND</code> 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 [[arpeggio]]s, etc.), the playback of digitally sampled sounds as in the game [[RoboCop]] for example, and so on. All disc, tape and file management managed by BASIC is through the firmware and are adequate for simple file management with commands such as <code>SAVE, LOAD, MERGE, RUN", CAT</code> etc. During this time, it was common for desktop computers to be "boot to BASIC" and that supplied with most low-cost home computers also acted as a simple [[operating system]], managing files and moving program code and data between the machine and storage medium. [[File:Locomotive BASIC loading a picture from disk.gif|thumb|upright=1.3|Loading a picture from floppy disk in Amstrad BASIC]] Also available is a parametric <code>LOAD</code> 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 a memory address as parameter to the commands <code>LOAD</code> or <code>SAVE</code> allows easy loading of raw uncompressed 16 KB screen pictures.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)