The BBC Computer Literacy Project
Document 1 - BBC Computer Literacy Project Update, outlining the BBC Microcomputer, peripherals and upgrades
UPDATE: JUNE 16TH 1981
BBC CONTINUING EDUCATION TELEVISION
BBC COMPUTER LITERACY PROJECT
The BBC is to launch a major new project in the field of computer literacy, in January 1982. The aim of the project is to introduce interested adults to the world of computers and computing, and to provide the opportunity for viewers to learn through direct experience how to program and use a microcomputer. The project is built around a ten-part television series, and includes a book, a linked microcomputer system complete with User Guide, a range of applications programs, and an associated course in programming in BASIC provided by the National Extension College.
This project forms part of a long-term commitment by BBC Education to public information in the broad field of microelectronics, which has included the three-part series
'The Silicon Factor', and in the current year also includes the five-part series on applications of computers in business and industry, 'Managing the Micro' (7th June - 5th July 1981, BBC-1, Mondays at 2330), an two programmes on the implications of microelectronics for teachers, 'Technology for Teachers'
(28th September & 5th October 1981, at 1615-1640 on BBC-2).
THE TELEVISION SERIES (also see attached sheet)
The ten television programmes will be first broadcast on Sunday mornings on BBC-1, weekly from January 10th 1982, and repeated for schools and colleges weekly on Mondays at 1500 on BBC-2 from January 11th 1982. There will be a further repeat latenight on BBC-1 on Mondays from March 22nd 1982, and the series will probably have several further repeats in later years.
The series aims to illustrate and explain the fundamentals of computing at both a practical and a theoretical level. The programmes will be built around themes and the examples of what computers can be used for will be drawn from a wide range in the real world. Although the use of large and small computers will be shown we will aim to illustrate principles through the use of the microcomputer wherever possible (see also the note on the supporting software for the BBC system).
The explanation and use of a computer language will arise naturally out of the themes of the series and each programme will contain a practical illustration of the use of BASIC coding. The approach will be pitched at a level which beginners can understand. All the studio demonstrations will offer insights into the use of the personal microcomputer and, since the 'lay' presenter will himself be introduced to the techniques from scratch, these will encourage the audience to feel that they could perform similar tasks if they had access to a machine.
Viewers who buy the book or follow the course should be able to go rather further into the subject; but since in the end the only way one can learn about computing in any depth is to gain practical experience of it, the hardware and software of the BBC Microcomputer system is being specially provided in order to create the opportunity for direct "hands-on" experience. All parts of the project will use the same dialect of BASIC.
The specification is fairly standard (quite close to Microsoft-5) and pretty well structured upwards. There is a powerful BASIC interpreter, compatible with standard MICROSOFT, however it has been possible to incorporate a number of extensions. These include long variable names, integer type and extensive string operations, all using normal MICROSOFT syntax. Attention has been paid to the need for structures and the BBC BASIC supports IF... THEN... ELSE, REPEAT... UNTIL, WHILE... ENDWHILE, and multi-line named functions and procedures with local variable declarations. Assembly language routines can be written into a BASIC program and high resolution colour graphics are well supported. There are numerous other powerful extensions.
This will look at the wide range of things computers can do in the real world, and, broadly, at how they work. There will be sections on personal computing - what's possible and what's not - and an introduction to problem solving in plain English, leading to a section introducing the basic principles of computer programming. It will be available in bookshops and from BBC Publications, 35 Marylebone High Street, London W1M 4AA, from January 1982.
THE NEC COURSE
The National Extension College is providing a 30-hour introductory course in programming in BASIC in association with the BBC project (with which it will be software compatible). It will be possible to follow the course as a home-based correspondence student, to use it as a flexi-study course with a combination of home-based work and work in a supporting college, or simply to buy and use the course material independently. Arrangements are being made for equipment to be made available to students in various institutions, on a workshop basis. It is hoped that this will be the first of a range of such courses in this field. For details of the course, and of supporting services write to THE NATIONAL EXTENSION COLLEGE, 18 Brooklands Avenue, Cambridge, CB2 2HN.
A referral service will be available in association with the series, to put viewers in touch with local sources of advice and help.
THE BBC MICROCOMPUTER SYSTEM
The BBC Microcomputer system will consist of two alternative models of a microcomputer (which can both use either a domestic TV receiver or a monitor as the display unit), a range of expansion options, a Teletext receiver, a Prestel option, and a disk system. The greater part of the system will be available by cash post from the fourth quarter of 1981.
1. The Microcomputer (price £235 from Autumn 1981).
The stanard model of the microcomputer is based on a 2 MHz 6502 microprocessor with 16k of RAM and 32k ROM; the ROM includes a 16k BASIC and a 16k operating system, which includes a machine O.S., a cassette O.S., a disk O.S., and a network 0.S. The system has a variety of eight different display modes, notably a teletext mode, a 80 x 25 characters mode, and a 320 x 256 high resolution graphics mode; it can display up to eight colours.
The system has cassette, television, and video interfaces, and a full travel keyboard. It has been designed with the capability for substantial expansion in terms of RAM, second processor, and high-speed communication to other computers.
The enhanced model of the microcomputer (price £335 from Autumn 1981) will have the following additional features: memory extension to 32k RAM, A-D interfaces, Centronics (printer) interface, RS232 (5-0-5V) interface, "Tube" and Bus connector. These will permit users to interface their equipment with a wide range of existing peripherals, including, for instance, printers.
A User Guide, which will include an equipment manual, a detailed software specification, a guide to programming, and a range of simple introductory programs, will be boxed in with both models of the microcomputer and included in the price. It will also be separately available approximate price £8.50).
2. Additional interfaces
- a disk interface (price £70) will be available from Autumn 1982, which can be connected to a range of disk drives.
- a networking interface (price £47) will be available from Autumn 1982. This will make it possible to connect a number of microcomputers to each other, and to a central disk system or printer.
3. Second processor expansion options
There will be a range of expansion options available in an add-on box.
- a second 8-bit processor (3 MHz 6502 with additional 64k RAM) will be available from early 1982 (price £399).
a second 8-bit processor (Z-80 with additional 64k RAM) will be available from March 1982 (price £399). This will give a CPM facility (see below).
a further 16-bit microprocessor (with additional 128k of RAM) will be available from early 1982 (approximate price £995).
4. Disk expansion options
- through the disk interface option (approximate price £70) it will be possible to use the system in association with a range of available disk drives. Two disk drives will be available as part of the system. A single drive (max. price £265) and a double drive (max. price £495).
- through the Z-80 second processor expansion (available from March 1982) it will be possible to use the microcomputer in association with CPM-based disk systems. This will make it possible to run and store CPM-based applications programs.
5. Teletext receiver (approximate price £115). The teletext receiver will be contained in a separate case, and will be capable of receiving teletext transmissions from the BBC and IBA for display on a domestic TV receiver, and of downloading computer programs, transmitted in the form of telesoftware, directly into the memory of either model of the microcomputer. For an additional cost there will be a Viewdata option which will provide access to British Telecom's Prestel databank.
A range of compatible software is being developed in association with the BBC Microcomputer System
Many of the ideas in the television series will be supported by a range of applications programs designed to run on the BBC microcomputer. These are being commissioned to be part of the overall learning 'package'. In effect they are small scale programs which mimic the 'professional' programs used in the real world or which help to reinforce understanding of
the principles of computing discussed in other parts of the project.
It is hoped that this initial inventory of software will include:
1. An introductory 'systems' package
2. A home data base management program
3. A high level language utility (e.g. a quiz-writing program)
4. A music package
5. A simple computer aided design package
6. Some programs which 'learn'
8. Simulations — scientific
9. A possible control 'kit'
10. Simple home finance package
11. Educational practice programs
The programs would be available on cassette or as listings.
Available software will eventually include a wide range of applications programs, including games, instructional programs, programs of practical use in the home, programs for the use of hobbyists, and programs which should be of practical use to the small businessman. Some of these programs will be available in printed form, some in recorded form on disk or cassette, and some through telesoftware. Some of this software is being specially written, and some is being adapted from existing programs, and the BBC is actively interested in any available software which may be suitable for this system. At the simpler levels we are hoping it will be possible to run some BBC software on other similar systems, and other software on the BBC system, with comparatively little modification. Details of available software will be available later.
Roberts Salkeld BBC,
Broadcasting House, Room 125,
Document 2 - Hardware Specification
The BBC Microcomputer System
PART II - HARDWARE SPECIFICATION
This document specifies the hardware characteristics of the Microcomputer Unit of the BBC Microcomputer System, as agreed between the British Broadcasting Corporation and Acorn Computers Limited. It forms part of the overall specification, software and hardware, of the BBC Microcomputer System.
Written by: R. T. Russell, BBC Engineering Designs Department.
(C) Copyright British Broadcasting Corporation 1981.
THE BBC MICROCOMPUTER SYSTEM
Part 1 - The Microcomputer Unit
The machine will be designed to the highest engineering standards and all component parts will be used within the manufacturers' recommended limits. Particular care will be taken with printed-circuit layout and supply decoupling. Unused gate inputs will not be left open-circuit. All items in this specification will apply to the standard model of the BBC machine unless specifically indicated otherwise. With the sole exception of the Econet interface, integrated circuit sockets will be fitted in all unequipped positions.
Dimensions: 400mm wide by 300 mm deep by 60mm high approx.
Material: Injection moulded thermoplastic.
External appearance: Colour scheme and markings to be agreed by BBC.
The case will be designed to enclose the printed circuit board(s) and mains power supply and to provide a rigid support for the keyboard. It must be sufficiently strong to withstand rough handling in transit, particularly with regard to the mounting of heavy items such as the mains transformer.
The case will be of two-part construction, the upper shell supporting the keyboard PCB and the lower shell the main PCB and power supply. Electrical connection between the two parts will be by flexible ribbon cable of sufficient length to allow easy access for servicing or modification. Precautions will be taken to prevent malfunction resulting from electrical coupling between ribbon cable conductors.
All printed circuit boards will be copper-on-fibreglass and will have screen-printed component legends. The main logic board will be through-hole-plated and have a solder resist.
Apertures will be provided for expansion connectors plus sufficient ventilation slots to allow for continuous use at a local ambient temperature of 35C without subjecting the internal components or case material to a temperature in excess of their rated maximum (with all expansion options fitted).
The two parts of the case will be secured together by four or more metal screws (not self-tapping). The case will be provided with non-slip non-scratch feet commensurate with its use in a domestic environment (on polished furniture etc.).
The unit will meet the appropriate BEAB, BSI and European standards and will be so marked. It will be constructed in accordance with BSI Class 1 requirements, i.e. all exposed metalwork is to be connected to earth via the earth lead of the 3-core mains cable.
Due regard must be given to the fact that the owner will be encouraged to open the case in order to fit I.C.'s and connectors; it is therefore essential that all points which could be at mains potential when power is applied be inaccessible to the "standard finger".
There must be no sharp edges or corners which could cause damage to person or clothing when the covers are in place. It would be preferable for no sharp edges be exposed even when the case is opened.
The keyboard will be in standard QWERTY format using a pitch between keys and between rows of 0.75", with a conventional row-stagger of 0.375" and 0.1875". There will be four rows of alphanumeric keys plus a space-bar and an additional top row of ten software-definable keys, 73 keys in all. The two SHIFT keys and the RETURN key will be at least 1.5 times e normal key size and the space bar will be at least 5.5" long with an appropriate mechanism to allow it to be pressed with equal ease anywhere along its length. The keyboard will be fixed at a convenient operating angle.
There will be four cursor-control keys at the right-hand end of the main keyboard; LEFT, UP, RIGHT and DOWN. It must be possible to generate all ASCII codes (0/0 to 7/15) by using the SHIFT and CTRL keys in conjunction with the other keys. The space bar and zero key must not be affected by depressing the SHIFT key; the numeric keys 0123456789:;,-./ must not be affected by depressing the CTRL key.
The keys will have positive action with a total travel of approximately 0.2", the keypress being detected at approximately 50% total travel. The action must be acceptable to a professional typist. The keyboard will have two-key rollover on all keys except SHIFT, CTRL, SHIFT LOCK and CAPS LOCK. It must be possible under software control to determine whether a key is held depressed or has been released.
A RESET (or BREAK) key will not be provided on the main keyboard but there will be a press-button RESET switch accessible at the rear of the machine and mounted so as to minimise the possibility of being accidentally depressed.
The legend on the keys will be achieved by two-shot moulding; both pound sign and number symbol (hash) must be included. The detailed keyboard layout and key type is subject to approval by the BBC (the proposed keyboard layout is attached). The keyboard should, as far as possible, be resistant to liquid spills and cigarette ash. The RETURN key will be a different colour from the rest.
The keyboard is software scanned but this is made transparent to the
user, and processing overhead minimised, by interrupting the processor and scanning the keyboard only when a key is pressed.
The power supply will accept a mains input of between 220 and 260 volts rms at a frequency of 47-63 Hz. The total consumption will not exceed 50V A. The output will be +5v at sufficient current to power the machine with all on-board expansions, continuously rated, with preferably some excess capacity. The power supply will withstand an overload indefinitely and will protect itself from damage through overheating, even at 260v mains. The power supply will NOT be a switched-mode type.
There will be sufficient filtering to reduce electromagnetic interference conducted into the mains wiring to acceptable proportions (the exact maximum level to be agreed). There will be no exposed mains terminals within the case; if an auxiliary mains outlet is provided this must be of high quality and shuttered. A three core flying lead will be provided, terminated and anchored to the case during manufacture, having standard colours and meeting all electrical regulations governing domestic equipment. This lead is to be at least three metres in length. A high quality square-pin plug, complete with a 3 amp fuse, will be supplied ready fitted.
COMPOSITE VIDEO OUTPUT
A 1v pk-pk (75 ohms) composite video (PAL coded) output will be provided on a 75 ohm BNC socket accessible at the rear of the machine. The socket will not be fitted in the basic machine but all circuitry associated with the video output will be included as standard. The TV standard will be 625-lines, 50-field interlaced, PAL, with a field-sync pulse consisting of a single broad pulse of 128us duration. The PAL subcarrier need not be line-locked but must be in the range 4.43361875 MHz +/- 100Hz over the temperature range 5-35C (ambient). The signal must be capable of being displayed in colour on a typical PAL (baseband input) monitor and preferably of being recorded and replayed in colour on an appropriate video cassette recorder (VHS, Beta, VR2000 and U-Matic formats).
The UHF output will be from an Aztec modulator fixed tuned to approximately channel 36, for feeding to a domestic TV set. This will be negative modulated by a video signal as defined in the previous section, and must be capable of being displayed in colour on a typical domestic receiver. A flying lead will be provided, terminated by a standard Belling Lee plug, at least 2m in length. This lead will either be terminated inside the machine or will be supplied loose with a Phono plug for connection to the modulator through a suitable aperture in the rear panel of the machine.
Four outputs at TTL levels will be provided, being red, green & blue video signals and a composite (mixed) sync pulse signal. These will be suitable for driving a high input impedance
RGB monitor. The TV standard will be as previously defined. The connector for these outputs need not be fitted in the basic machine.
AUDIO CASSETTE INTERFACE
A cassette modem will be incorporated to allow storage of programs and data on a standard audio cassette recorder, mono or stereo. The format will be asynchronous serial data with one start bit (space), eight data bits (LSB first) and a minimum of one stop bit (mark) per byte at one of two alternative speeds, 300 baud and 1200 baud. In the low-speed mode a MARK bit (logic 1) will be encoded as 8 cycles of 2400Hz tone and a SPACE (logic 0) as 4 cycles of 1200Hz tone. In high-speed mode a MARK will be 2 cycles of 2400Hz and a SPACE will be 1 cycle of 1200Hz tone. It must be possible to switch between low-speed (CUTS) mode and high-speed mode under software control, without internal modification.
The demodulator will be insensitive to input level variations of up to +6dB or -12dB and must recover the UAR/T clock from the tape in order to track short and long-term speed variations, It must cater for an instantaneous speed error of at least 10% WITHOUT relying on the inherent insensitivity to speed of asynchronous data, i.e. bit-centre sampling must be maintained. The demodulator must be insensitive to phase of the playedback signal.
Input and output levels will be standard DIN. Appropriate low-pass filtering will be incorporated in the output to avoid subjecting the cassette recorder to high-frequency components which could cause overloading or other forms of distortion. The input circuitry will incorporate band-pass filtering to reduce the sensitivity of the demodulator to high and low frequency noise, hum etc.
The cassette connector will be a seven-pin DIN socket wired so that if a stereo recorder is used both channels are recorded but replay is from the left channel only. A DIN to DIN connecting lead will be supplied.
A relay will be included in the basic machine which can be used to switch the cassette recorder tape-transport motor on and off. This relay will be adequately rated taking into account that the load may be highly inductive. The relay will be driven by the operating system so as to allow, in particular, the easy storage and recall of cassette data files. Connections to the relay contacts will be brought to pins 6 & 7 of the DIN connector.
RS423 SERIAL INTERFACE
When the cassette interface is not in use, the serial port will be available to provide a bi-directional RS423 (+/-5v) interface for driving a serial printer etc. Provision will be made on the main
PCB to include the necessary interface i.c's and a voltage converter for -5v, but these need not be fitted in the basic machine. Baud rate will be selectable under software control to one of two values, these values being pre-selected by internal wire links. One speed will be selectable from the group 19200, 9600. 4800, 2400 and 1200 bauds and the other speed from the group 600, 300. 150 and 75 bands: the speeds will be accurate to within 0.2%. A simple handshaking input will be provided which will inhibit the serial output when negative and will enable it when positive (RS423 levels). It must be possible for the user to provide his own printer driver software to implement, for example, form feed or handshake using the reverse serial channel.
The RS423 connector be a 6-pin DIN type and a suitable adaptor lead to a 25-way D-type socket will be provided as part of the RS423 option. It may be necessary to have more than one variety of adaptor lead to suit various types of printer. In the standard version the following pins on the D-type will be wired: 2 - serial input, 3 - serial output, 7 - signal ground, 20 - handshake. In addition pin 6 will be wired to a single-bit RS423-level output, capable of being set high or low under software control, which is normally held high (+5v).
PARALLEL PRINTER INTERFACE
A parallel printer output to
Centronics specifications will be provided. The 6522 I/O device will be fitted in the basic machine but the buffer components and connector need not be fitted as standard although provision will be made for these on the main
It must be possible for the user to intercept the normal driver software for the parallel printer so as to add special features such as software form-feed.
FLOPPY DISK INTERFACE
Provision will be made on the main
PCB to fit a floppy disk controller plus data separator and buffer devices to allow interfacing to one or two mini-floppy or 8" floppy drives. Neither these devices nor the connector need be fitted in the basic machine.
The disk connector will be a 34-way type to SA400 specification, but all control signals must be present to allow an SA800 specification interface to be implemented by means of an adaptor cable. A wire link on the main PCB will select the appropriate data rate, i.e. 125 kbits/sec for mini-floppy and 250 kbits/sec for 8" floppy. Both hardware and software must be capable of supporting 8" disks to the IBM 3740 specification, although this may necessitate fitting an additional ROM which is not present in the basic machine. There is no requirement for double-density operation.
Provision will be made on the main
PCB to fit a four-channel twelve bit analogue to digital converter device to which external X-Y joystick controls can be connected. The ADC and connector need not be fitted in the basic machine. The connector will be a D-type and will be common with the light-pen input (q.v.).
Provision will be made on the main
PCB to fit a 6854 I/O device plus buffering to implement a standard Econet interface. Neither these devices nor the connector need be fitted in the basic machine.
PROCESSOR BUS INTERFACE
Un-buffered address, data and control signals will be available (provisionally on a 26-way IDC connector) to provide a high-speed interface to an external language processor (e.g. the
CP/M option). The interface is only suitable for this purpose and will use a short length of ribbon cable as interconnection between the two units. The connector will not be fitted in the basic machine.
TELETEXT RECEIVER INTERFACE
A buffered processor bus interface will be provided for connection to the teletext receiver/data grabber. Interconnection between the main machine and the teletext receiver will be by means of ribbon cable having alternate ground conductors, allowing a cable length of at least 30 cm. The connector will be fitted as standard in the basic machine, but when adding the teletext receiver option it will be necessary to fit two buffer i.c.'s and a read-only-memory device containing the teletext and telesoftware firmware.
A loudspeaker will be fitted in the basic machine as standard. This will be fed from a 6522 device and will be capable of producing tones under software control. The volume will be pre-set by a fixed resistor.
ELAPSED TIME CLOCK
An elapsed-time clock will be included in the basic machine, having a resolution of 10ms. The clock can be set and tested under software control.
A TTL-compatible 8-bit port plus 2 control bits will be provided in the basic machine for user input/output. Final details of the combinations of inputs and outputs in which the port bits can be used is subject to agreement with the BBC. The connector will be a ribbon cable header, having alternate 0v conductors, fitted as standard. Two bits of the user I/O will also be available on the analogue-input/light-pen connector.
A set of internal links will define the input, output and storage channels, and the screen display option, to be used on machine start-up. Default options will be as follows:
Console input - Keyboard.
Console output - VDU display in mode 4.
File input - Cassette recorder, high speed.
File output - Cassette recorder, high speed.
An input will be provided which allows the connection of a simple light-pen, fed to the
6845 CRT controller. This input will use the same connector as the analogue inputs. The light pen itself will not be supplied with the basic machine.
VDU SCREEN FORMATS
There will be 8 selectable display formats as follows (RAM requirements in bytes are shown in brackets):
0. 80*25 2-colour text (foreground/background). (16K)
1. 640*256 2-colour graphics & 80*32 text. (20K)
2. 320*256 4-colour graphics & 40*32 text. (20K)
3. 160*256 16-colour graphics and 20*32 text. (20K)
4. 40*25 2-colour text. (8K)
5. 320*256 2-colour graphics & 40*32 text. (10K)
6. 160*256 4-colour graphics & 20*32 text. (10K)
7. 40*25 teletext-format display. (1K)
The alphanumeric characters displayed in modes 0, 1, 4 & 5 are generated in high-resolution graphics with the "character generator" being
part of the operating system ROM. These characters are on an 8*8 matrix (7*5 with one-line descenders). In display modes 0 and 4 there are forced gaps between character rows and therefore continuous vertical lines (on forms etc.) are not possible. The character set is subject to agreement with the BBC but in general is
ASCII with the exception that code 6/0 gives a pound sign. For consistency between codes, incoming telesoftware will be code-converted so that 2/3 (pound) becomes 6/0, 5/15 (hash) becomes 2/3 and 6/0 (wide bar) becomes 5/15. The complementary conversion will take place in the VDU driver for display mode 7 (teletext).
In modes 0 to 6 the "colours" are selectable from a palette of 16 effects being black, red, green, yellow, blue, magenta, cyan, white and the same eight colours automatically flashing.
Mode 7 uses a teletext character generator which provides a full teletext/prestel format display including character rounding, doubleheight, 8 display colours, 8 background colours, non-contiguous graphics, held graphics, flash etc.
The circuitry to generate all these display modes will be present in the basic machine, but it will not be possible to use display modes 0 to 3 unless the 16K RAM expansion option has been fitted.
All display modes use nominally 40us active horizontal display period and 256 lines per field active vertical period, i.e. 77% and 89% respectively of the nominal TV display area.
Processor access to the display refresh RAM will be totally transparent and the display will therefore be completely glitch-free.
The CPU is a 6502A running at a 2MHz clock rate except when accessing some input-output devices, when the effective clock frequency is reduced to 1 MHz.
The basic machine is equipped with 16 Kbytes dynamic random-access-memory (5v type), 16 Kbytes operating system ROM (character generator, input/output handlers, disk operating system etc.) and 16 Kbytes language
ROM (BASIC interpreter). The RAM is capable of expansion to 32 Kbytes and the ROM to 64 Kbytes (being another 16 Kbyte language ROM - e.g. Pascal plus 16 Kbytes of ROM/ EPROM containing applications software etc. Only one of the language ROMs, or the ROM/ EPROM , can be enabled at any given time under software control).
RADIO FREQUENCY INTERFERENCE
The level of R.F. radiation from the machine is to be minimised. The exact maximum level is to be agreed by the BBC.
© BBC 1981
BBC MICROCOMPUTER KEYBOARD LAYOUT
CBT & RR 01-04-81
© BBC 1981
BBC MICROCOMPUTER KEY CODES
Key: CTRL RTR 03-04-1981
NORMAL Issue 2 23-04-1981
SHIFT LOCK is equivalent to holding down SHIFT
CAPS LOCK converts codes 61 to 7A inclusive to codes 41 to 5A
Note: when "cursor edit" mode is switched off, the cursor control and COPY keys produce the following codes:
_ 88 _ 89 _8A _ 8B COPY 8C
Document 3 - BASIC Outline
BBC Microcomputer System
(c) Copyright BBC 1981
The BBC Micro-computer
Outline specification of the
BASIC language interpreter
© BBC 1981
Listed below are commands, statements and functions which form the 'common core'.
ATN AUTO BEEP CALL CHAIN CHR$ CLEAR CLOSE# CLS COLOUR CONT COS
DATA DEF FN DELETE DIM
FOR ... TO ...NEXT ... STEP GET
IF ... THEN ... ELSE INKEY
INPUT LINE INPUT# INSTR
INT LEFT$ LEN LET LIST LN
LOAD LOG LVAR MID$ MOVE NEW NEXT NOT
ON X GOTO
ON X GOSUB
These extensions should be avoided in simple programs that are intended to be used on a variety of machines.
ASN BGET# BPUT# COUNT DEF PROC DEG ENDPROC EVAL FALSE HIMEM HTN
INKEY LOCAL LOMEM MOD
REPEAT ... UNTIL REPORT
WHILE ... ENDWHILE
This document provides an outline of the facilities offered by the BASIC interpreter. Other documents will provide details of other aspects of the total system.
The BASIC interpreter works through one of three file systems: a cassette file system, a disk file system and a network file system. The user can easily move between file systems and can pass complicated commands direct to the file system while in BASIC or any other language or environment.
The BASIC interpreter will contain an assembler as in the ATOM computer except that different characters will be used for hexadecimal notation and for 'immediate'. A screen editor is incorporated.
Variable names may be of unlimited length and all characters are significant. Variable names must start with a letter. They can only contain the characters A..Z, a..z, 0..9 and underline. Embedded keywords are allowed. Upper and lower case variables of the same name are different. The following types of variables are allowed:
A real numeric
A% integer numeric
FNA numeric function
FN$A string function
The variables A%..Z% are regarded as special in that they are not cleared by the commands or statements RUN, CHAIN and CLEAR. In addition A%, X% and Y% have special functions in CALL and USR routines.
The variables A%..Z% are called 'static variables'. All other varaibles are called 'dynamic variables'
Real variables have a range of +-10^38 and functions evaluate to 9 significant figure accuracy. Internally every real number is stored in 40 bits
Integer variables are stored in 32 bits and thus have a range of about +- 2000 million
String variables may contain up to 255 characters
All arrays must be dimensioned before use
All statements and functions can also be used as commands.
A function giving the absolute value of its argument.
A function giving the arc cosine of its argument in radians.
A function which returns the last known value of analogue to digital channel N. The Analogue to Digital converter is cycled repeatedly and this function will therefore execute very quickly.
X=9 AND Y
A binary operation which carries out the bitwise AND between its two arguments as 32 bit integers.
IF (X=9 AND Y=(O) THEN PRINT "hello"
logical AND as part of IF ... AND ... THEN ...
gives 72 the ASCII value of 'H'
A function returning the ASCII character value of the first character of the argument string. If the string is null then zero will be returned.
A function giving the arc sine of its argument in radians.
A function giving the arc tangent of its argument in radians.
A command allowing the user to enter lines without first typing in the number of the line.
AUTO mode is left with <ESC> or with a line starting with EOT ( ASCII code 4)
automatically offers line numbers 10,20,30 Œ
Offers 220,230,240, Œ
BEEP X, Y
A statement causing a tone to be added to the BEEP queue for generation.
Half-period between 1 and 65535 micro-seconds gives frequencies between 500 kHz and 7.6 Hz.
Duration is given in centi-seconds.
A statement which gets a byte (X) from the file opened on channel number N.
A statement which puts a byte to the file whose channel number is the first argument. The second argument's least significant byte is sent.
A statement to call a piece of machine code.
The second example above calls the subroutine at location 12340 and passes the parameters to the subroutine. Parameters are passed in a "Parameter Block" the address of which is stored in a fixed location near the start of the BASIC interpreter. The number of parameters passed may be zero. On entry to the subroutine the Parameter Block contains the following values
Number of parameters - l byte
parameter type - 1 byte
parameter address - 2 bytes
parameter type ] repeated as often
parameter address ] as needed
The parameters are variable parameters and will be changed on execution of the subroutine.
0 - 8 bit byte
1 - 32 bit integer variable (e.g. S%=5432)
2 - 40 bit floating point number (e.g V=1234.567)
128 - A string at a defined address
>128 - A string varaible such as A$
In the case of a string the parameter address is the address of a String Information Block which gives the the adaress of the string etc.
The processors A,X,Y registers are initialised to the least significant bytes of the integer variables A%, X%, Y%. See also USR.
A statement which will load and run the program whose name is specified in the argument.
All variables except A% to Z% are cleared.
returns A$ = 'H'
A string function whose value is a string of length 1 containing the ASCII character specified by the least significant byte of the numeric argument.
A statement which clears all variables to zero (except A%..Z%) ano empties all strings.
A statement used to CLOSE a sequential file.
CLOSE# 0 will CLOSE all sequential files.
Clears the screen to the current background move the text cursor to top left (0,0) and the graphics pointer and origin to bottom left (0,0)
A statement setting the current foreground colour mode for the "soft" displays. (See GRAPHICS for description of soft displays). All lines and characters for these displays will will be set in this colour.
All lines and characters for these displays will be set in this colour.
8 flashing black
9 flashing red
10 flashing green
11 flashing yellow
12 flashing blue
13 flashing magenta
14 flashing cyan
15 flashing white
These colours are as defined for Viewdata and give
a correct grey scale on monochrome displays. This statement will be expanded to control other facilities.
A command used to restart execution after a break caused either by the word STOP or by pressing the <ESC> key. No program changes are allowed. A program cannot CONT into the body of a FOR ... NEXT loop, a REPEAT ... UNTIL loop, a WHILE ... ENDWHILE loop, a function or a procedure.
A function giving the cosine of its radian argument.
A function returning the number of characters printed since the last new line. See also POS
DATA 10,2,HELLO,"THIS IS A COMMA,"
DATA " LEADING SPACES"
String data not enclosed in quotes must not contain embedded keywords. The keyword DATA must be at the start of a line, not even preceded by spaces.
A function which converts radians to degrees.
A program object which must precede declaration of a user function FN.
The keyword DEF must be at the start of a line not even preceded by spaces.
lines 100 to 150 inclusive
lines 4000 to end of program
lines from start of program to 120.
An array of 13 elements
DIM CUSTOMER$ (3, 2)
A four by three string array
A statement which dimensions arrays. Arrays must be predeclared before use. After dimensioning all elements of arrays are zero or null strings.
DRAW X, Y
Draw a line to X,Y in the current foreground colour.
DRAW X,Y is equivalent to PLOT 5,X,Y.
Optional end of program may occur anywhere and as often as is required.
Part of the DEF PROC ... ENDPROC structure.
Part of the WHILE ... ENDWHILE structure.
IF A=B THEN C=D ELSE PRINT "We've got this one right!"
Part of the IF..THEN..ELSE structure.
A function returning the line number of the line where the last error occurred.
Returns the error number of the last error which occurred.
A function which applies the interpreter's expression evaluation program to the characters held in the argument string.
An easy way to pass a function into a program from a user input.
A function returning e to the power of its argument.
A function which returns the length, in bytes, of the file opened on channel N.
would print 0.
A function returning 0.
DEF FNMEAN(A,B,C)= (A+B+C)/3
A reserved word used at the start of all user defined string functions.
A reserved word used at the start of all user defined procedures.
DEF FN$REV(A$) LOCAL B$,Z
FOR Z=1 TO LEN(A$): B$=MID$(A$,Z,1)+B$: NEXT =B$
The function is terminated and assigned a value by finding an = sign after a statement delimiter.
FOR X=1 TO 16 STEP 0.3: PRINT X: NEXT X
FOR A%=0 TO MAXIMUM_LENGTH
FOR TEMPERATURE=O TO 9
A statement initialising a FOR ... NEXT loop. Always executes at least once
Any numeric assignable item may be used as the control variable. Integer control variables are much faster than real variables.
will wait for a character from the current input stream and return the ASCII value. The input stream may or may not be the keyboard. See also INKEY.
will wait for the next character from the current input stream and return it in A$.
A statement which clears the screen and initiates operation in the specified graphics mode, Mode, in the range 0-7 and with optional coloured background, colour, in the range 0-15.
0. 640x256 2 colour graphics and 80x32 text (20K)
1. 320x256 4 colour graphics and 40x32 text (20K)
2. 160x256 16 colour graphics and 20x32 text (20K)
3. 80x 25 2 colour text (16K)
4. 320x256 2 colour graphics and 40x32 text (10K)
5. 160x256 4 colour graphics and 20x32 text (10K)
6. 40x 25 2 colour text ( 8K)
7. 40x 25 teletext ( 1K)
Graphics modes 0 to 3 will not be available on the unexpanded machine since they require more than 16K of memory.
Graphics modes 0 to 6 are referred to as SOFT displays since in these modes the character set is entirely user defined.
For text characters the origin (0,0) is at the top left of the screen. The screen is 40 or 80 characters wide and 25 or 32 lines high.
For graphics commands the origin is at the bottom left. Regardless of the graphics mode the screen is addressed as 640 horizontal points and 512 vertical points. Internal scaling is applied to suit the selected graphics mode.
HIMEM = HIMEM-40
HIMEM contains the address of the first free byte that BASIC does not use. This cannot be used inside a FOR ... NEXT, REPEAT ... UNTIL, WHILE ... ENDWHILE structure, a function or a procedure. The user is cautioned to use this facility with care!.
A function which returns the hyperbolic tangent of its argument.
IF X=5 THEN Y=6:Z=8 ELSE PRINT "STRUCTURED BASIC"
IF X>5 GOTO 100
IF LENGTH=5 THEN 2000
IF A=1 PRINT "HELLO".
tests the keyboard to see if a key is pressed. The function returns -1 if no key is pressed, or the ASCII value of the key pressed.
Waits for up to 100 centi-seconds for a key to be pressed. If a key is pressed during this time then the functions returns immediately with a number representing the ASCII value of the key pressed. If no key is pressed in the specified time then the function returns zero.
returns a null string if no key is pressed or a single character string if a key has been pressed.
X$=INKEY$ (100 )
as for X=INKEY (100 )
default input is from keyboard
INPUT "length of rod";X
Prints the prompt 'length of rod' on the screen and then waits for a valid numeric reply.
INPUT "length of rod",X
Prints the prompt 'length of rod?' on the screen and then waits for a valid numeric reply.
INPUT strips leading spaces off strings.
An invalid reply produces a standard error message and then issues a question mark. This condition can be trapped with ON ERROR GOTO.
INPUT LINE A$
accepts the whole of the INPUT including commas, inverted commas and leading spaces.
A statement which reads data in internal format from a file and places the data in the stated variables.
The position of B$ in A$
start search at position Z. Returns 0 if not found.
INT is a function truncating a real number to the lower integer.
gives the LEFT 3 characters of B$.
would give size=5, the length of the word "HELLO" X=LEN (A$ )
List the complete program
Lists line 10 only
Lists lines 10 to 40.
Lists from line 100 to the end of the porgram.
A function giving the natural log of Y.
LOAD "PROG1" LOAD A$
This command loads internal format files from the current file system.
Declares variables for local use. May be used in functions and procedures.
X = LOG (Y)
A function giving the LOG to base 10 of Y.
LOMEM = LOMEM+100
LOMEM gives the first location in memory above which all dynamic variables are stored. The default is TOP - the first free address after the end of the user program. Moving LOMEM causes loss of all dynamic variables.
This must not be used inside a FOR ... NEXT, REPEAT ... UNTIL, WHILE ... ENDWHILE structure, a function or a procedure.
Lists all variables and their current values (except arrays).
takes the fourth, fifth and sixth letters from A$ into C$.
X=A% MOD B%
A binary operation giving the binary unsigned remainder of an integer division.
move the graphics pointer to X,Y.
Equivalent to PLOT 4,X,Y.
Erases the current program.
The program may be recovered with OLD.
Part of the FOR ... NEXT structure.
IF NOT (RATE>5 AND TIME<100) THEN ...
recovers the file deleted by NEW.
ON ERROR GOTO 100
Suppresses error messages and passes control to line 100
ON ERROR END
turns off user handling of error conditions.
ON X GOTO 100,120,130 ELSE PRINT "HELP":GOTO 100
notice the ELSE option.
ON Y GOSUB 100,200,300 ELSE GOTO 9000.
A function which returns the channel number allocated to the file. The file is opened for input and updating (random access). If the file does not exist then 0 is returned.
A function which returns the channel number of the file which is to be opened for output.
X=7 OR Y
Bitwise logical OR
IF (X=9 OR Y=10) THEN PRINT "HELLO"
Logical bitwise OR between the two arguments.
Moves the effective origin of all graphics commands to X,Y.
The starting 'page' of the current program where 'page' refers to 256 bytes.
Programs always start on a 'page' boundary and the '2' in the above example refers to 2 'pages' of 256 bytes.
assign X the value 3.14159265.
Yes 9 significant figures.
plots to the point at X,Y with the attribute K. The effect of each value of K will be:
0 move relative to last point
1 draw line relative in foreground colour
2 draw line relative in complemetary colour to present
3 draw line relative in background colour
4 move to absolute position
5 draw line absolute in foreground colour
6 draw line absolute in complementary colour
7 draw line absolute in background colour
8 move relative
9 plot point relative in foreground colour
10 plot point relative in complementary colour
11 plot point relative in background colour
12 move absolute
13 plot point absolute in foreground colour
14 plot point absolute in complementary colour
15 plot point absolute in background colour
is is easy to plot strings starting
at a specific location.
returns the colour of point X,Y on the screen, or -1 if the point is off the screen.
the horizontal position of the cursor. The left position is 0 and the right position is 39 or 79
PRINT "HELLO";Y$,"GOODBYE";X$ PRINT 1'2;3
PRINT X Y A$ 'B$
The position of each printed item is determined by the punctuation used to separate the items in the list. A comma causes the next numeric value to be printed right hand justified in the next zone. A semicolon causes the next value to follow the previous one with no extra spaces. Typing one or more spaces between expressions has the same effect as typing a comma.
If a semicolon terminates the print list then the next PRINT statement will begin printing on the same line. An apostrophe in the print list forces a new line at that point. If the print list terminates without a semicolon, then a carriage return is printed at the end of the line.
Numbers are printed right justified in each zone. Negative numbers start with a - sign. Numbers less that 1 will be printed with a zero before the decimal point. Real numbers that are integers will be printed as integers.
writes data in internal format to the file opened as channel N. All numerics are written as 5 bytes and all strings as the bytes in the string plus <CR>.
A reserved word used at the start of all user defined procedures, which may then be called by name. Any number of parameters, including zero, may be passed. The parameters are variable parameters. The procedure does not have to be declared before it is called.
FOR Z=0 TO X
PRINT "Hello - how about this for BASIC!"
PTR# (N) =20
PTR# moves a byte pointer to a file opened on channel COSTFILE and thus enables random access.
converts Y degrees to X radians.
Reinitializes the random number generator.
used in conjunction with DATA.
renumbers starting with line 10 and an increment of 10
renumbers starting with line 1000 and incrementing by 10
as above but with an increment of 5.
X =X +10
PRINT "Hello Roy, what do you think of it so far?"
Prints the error message associated with the last error.
resets the DATA pointer to the specified line.
is used after ON ERROR GOTO to retry the line which caused the error. This cannot be used inside a FOR ... NEXT, REPEAT ... UNTIL, WHILE ... ENDWHILE structure, a function or a procedure. An alternative exit would be with GOTO.
Used after GOSUB.
the rightmost four characters of B$ are returned.
Get the next random number in the range 0-0.9999
X=RND (0 )
Get the last random number again
X=RND (-1 )
Resets the random number generator
Behaves like X=RND
X =RND (6 )
Gets a random integer in the range 1-6.
Gets a random 32 bit integer value.
Sets all dynamic variables to zero and starts execution of the program.
SAVE "FRED" SAVE A$
Saves the program on the current file system.
X = SGN(Y)
returns -1 for a negative number
0 for zero
+1 for a positive number.
X = SIN (Y)
The sin of Y.
Insert 6 extra spaces between A and B
Only works on INPUT and PRINT.
X = SQR(Y)
The square root of Y.
Used with FOR ... NEXT.
Stops execution of the program and prints
STOP AT LINE 100.
produces a string representing the number X.
produces a concatenation of N copies of S$.
prints spaces to move to position 10. If the cursor is beyond the position requested then a new line will be issued and the cursor will then move to the correct column (as per ANSI). The left position is 0.
move directly to X,Y and then print B$. This will not work with a printer.
0,0 is at top left of the screen.
The tangent of Y.
Part of IF ... THEN ... ELSE.
The elapsed time in centi-seconds.
Used in FOR ... TO ... STEP.
The first free location after the end of the current program. Thus the length of the program is given by TOP-PAGE *256 .
turns TRACE on
turns TRACE off
Trace N (1-32767) lines of BASIC prog.
wou1d print -1.
Used in the REPEAT ... UNTIL structure.
passes A%, X% and Y% in the A,X and Y registers and returns a 24 bit integer composed of registers Y,X and A (msb to lsb).
If A$ does not start with a space, a number, a plus or a minus sign, then zero is returned.
returns the vertical position of the cursor.
Line 0 is the top line on the display, line 24 or 31 is the bottom line.
WHILE X>5:PRINT X:GOSUB 1000:ENDWHILE
It is not certain that this structure will be incorporated in the initial release but we hope to do so.
will cause a newline to be output when column 60 is reached.
J=5 XOR B
A binary operation which carries out the bitwise exclusive OR between its two arguments as 32 bit integers.
Operators and special symbols
+ - * / ^ ( )
< <= = >= <> these may also be used with strings
+ string concatenation
* pass the command line to the operating system
[ start assembler code
] end of assembler code
& hexadecimal numbers
# immediate value for assembler
? 8 bit indirection
! 32 bit indirection
; stay on same line
: multiple statement separator
force new line in print statement
<CR> enter line
<ESC> interrupt BASIC program
” string delimiter
~ print value in hexadecimal
The following defines the overall order of precedence, items in one group will be executed in the order they are met.
1. unary minus NOT functions procedures () brackets indirection
3. * / MOD
4. + -