RTR logo

BBC BASIC for Windows

Introduction and Overview



Introduction to BBC BASIC

BBC BASIC is the programming language originally specified and adopted by the British Broadcasting Corporation for its groundbreaking Computer Literacy Project of the early 1980s. It was designed to be simple enough to be used by a complete beginner yet powerful enough to cope with the demands of the very largest and most complex programs, and that remains true today. During the intervening years BBC BASIC has been extended and ported onto at least seven different CPUs and more than thirty different platforms.

BBC BASIC for Windows is an advanced version of BBC BASIC which is fully integrated into the Microsoft Windows™ operating environment (Windows 95, 98, Me, NT4, 2000, XP, Vista, Windows 7, 8/8.1 or 10), providing the programmer with a familiar language but with an up-to-date user interface. It combines the simplicity of BASIC with the sophistication of a modern structured language, allowing you to write utilities and games, use sound and graphics, perform calculations and create complete Windows™ applications.

Getting Started

If you have never programmed in BASIC before, or you're so rusty that you feel the need for a refresher course, consider working through the Beginners' Tutorial which you can find either via the Help Menu or online.

If you've programmed in BASIC before, but aren't familiar with BBC BASIC, then you might like to dip into some of the tutorial chapters which cover differences between BBC BASIC and other dialects. You can also browse this manual or look up particular features which don't seem to work the way you're used to. The General Information chapter may be of particular interest.

If you are used to earlier versions of BBC BASIC (on the BBC Micro, on the Acorn Archimedes or BBC BASIC (86) on a PC) you may find the user interface somewhat unfamiliar. When you start BBC BASIC for Windows you are presented with a blank editing window into which you can type your BASIC program. Commands such as Load, Save, Chain, New and Renumber are activated by clicking with the mouse on drop-down menus or (in some cases) toolbar buttons, as is usual for Windows programs. There are also keyboard shortcuts for all the commands.

Once you have typed in, or loaded, your BASIC program you can run it by selecting the Run command from the Run menu or by clicking on the Run button button in the toolbar. A second window will open in which appears any output from the BASIC program; error messages also appear here.

If you don't want to run a BASIC program, but simply want to enter commands for immediate execution (rather like a calculator) then select the Immediate Mode command from the Run menu, or click on the Immediate button. A second window will open into which you can type BASIC statements, in the same way as you could with previous versions of BBC BASIC.


Overview

BBC BASIC for Windows has a Graphical User Interface, including a BASIC program editor with syntax colouring, live indentation, search & replace and many other features. Built-in diagnostic aids such as run-time trace, listing of variables and single-step execution make debugging even the most complex programs straightforward.

A unique feature is the incorporation of an assembler which generates 32-bit code and accepts all 80486 instructions and some Pentium-specific instructions (except special-register and privileged instructions), including floating-point and MMX instructions. You can access the Windows™ Application Program Interface both from BASIC and from assembler code, allowing an experienced programmer to produce sophisticated applications.

The full version provides up to 512 Mbytes of user memory and allows you to create compact (typically less than 100K) stand-alone executable (.EXE) files from your BASIC programs, which will run without BBC BASIC having to be installed and without the need for any special DLLs. You can distribute such executables freely without any royalty being due.

BBC BASIC for Windows is largely compatible with Version 5 of BBC BASIC resident in the Acorn Archimedes and Iyonix computers. It also retains a high degree of compatibility with the BBC Microcomputer, including emulation of the SOUND and ENVELOPE statements, and the MODE 7 (teletext) screen mode.

In addition there are a number of major enhancements over these early versions, including data structures, an EXIT statement, PRIVATE variables, long strings, NUL-terminated strings, event interrupts, an address of operator, byte variables and arrays, a line continuation character, indirect procedure and function calls and improved numeric accuracy.


Running BBC BASIC

BBC BASIC for Windows can be run in a number of ways: Each of these methods starts BBC BASIC for Windows with an empty editing window. Alternatively you can start it and at the same time load a specified BASIC program for editing: If you only have the evaluation version substitute BBCWDEM6 for BBCWIN6 in the above instructions.

BBCWIN6.EXE has one optional command-line switch, -c, which automatically invokes the Compile utility:

bbcwin6 -c progname.bbc
Once the compile dialogue has been dismissed by the user BBC BASIC for Windows terminates.


Minimum system requirements

In order to be able to install and run BBC BASIC for Windows your system must meet these minimum requirements: For correct operation under Windows™ 95, 98 or NT4 it may be necessary to install Microsoft Internet Explorer version 5.5 or later.

For the SOUND statement to work correctly, your processor clock speed should be 133 MHz or higher.


Specification

BBC BASIC for Windows meets or exceeds the following specification:
Version 5Version 6
Memory available for user's program, data and stack Default approximately 1 Mbyte, maximum 256 Mbytes (depending on amount of RAM installed) Default approximately 2 Mbytes, maximum 512 Mbytes (depending on amount of RAM installed)
Size of BASIC programLimited only by available memory (maximum 65535 numbered lines) Limited only by available memory (maximum 65535 numbered lines)
Length of program linesMaximum 251 characters (tokenised) excluding line number Maximum 251 characters (tokenised) excluding line number
Integer variables32 bits, signed (−2147483648 to +2147483647) 32 bits, signed (−2147483648 to +2147483647)
64 bits, signed (−9223372036854775808 to +9223372036854775807)
Floating-point (real) variablesDefault 32-bit mantissa plus 8-bit exponent (±5.9E−39 to ±3.4E38); precision approximately 9 significant figures
Optionally 53-bit mantissa plus 11-bit exponent (±2.3E−308 to ±1.7E308); precision approximately 15 significant figures
Default 64-bit mantissa plus 16-bit exponent (±3.4E−4932 to ±1.1E4932); precision approximately 19 significant figures
Optionally 53-bit mantissa plus 11-bit exponent (±2.3E−308 to ±1.7E308); precision approximately 15 significant figures
String variablesMaximum length 65535 8-bit characters Length limited only by available memory
Array variablesMaximum number of dimensions 255, maximum size of each dimension limited only by available memory Maximum number of dimensions 255, maximum size of each dimension limited only by available memory
Number of variablesLimited only by available memory Limited only by available memory
Length of variable namesLimited only by available memory and maximum line length Limited only by available memory and maximum line length
Levels of nestingLimited only by available memory Limited only by available memory

Example programs

A number of example programs are supplied with BBC BASIC for Windows. They can be found in the EXAMPLES folder (this is the default file folder following installation). If you have selected the default location this will usually be C:\Program Files (x86)\BBC BASIC for Windows\EXAMPLES\.

Most of these programs will run using the trial version of BBC BASIC for Windows, although (depending on which programs you have run beforehand) you may need to restart the application first to free up memory. A few of them (notably ASMTEST.BBC, DLGEDIT.BBC, SEARCHBBC.BBC, SORTTEST.BBC and the file-handling demonstrations) require more than the 32K of user memory available with that version.

The example programs are located in sub-folders under the following categories:

FILING

F-?????.BBC          A set of 12 programs to demonstrate file handling.

GAMES

2048.BBC Slide the numbered tiles to combine them in pairs until you reach a total of 2048.
ANIMAL.BBC A 'guess the animal' game which learns from experience (well, almost!).
BUGGY.BBC A 'driving' game in which you need to avoid the verges and potholes.
DIBLEY.BBC A puzzle in which you have to work out how to move obstacles to reach the exit.
HANOI.BBC Solves the 'Towers of Hanoi' problem; not really a game as the computer does all the work!
RHEOLISM.BBC   A Tetris-like game in one (highly convoluted) line of BBC BASIC!
SUDOKU.BBC Plays and solves the popular number puzzle.
TRIPLES.BBC Move the wooden objects to create a row of three or more that are identical.

GENERAL

ASMTEST.BBC A test program for the built-in assembler.
ASMTEST2.BBC A program to test the assembler with floating-point instructions.
ASMTEST3.BBC A program to test the assembler with MMX instructions.
ASMTEST4.BBC A program to test the extensions supported by the ASMLIB library.
ASMTEST5.BBC A program to test the extensions supported by the ASMLIB2 library.
BANNER.BBC Displays horizontally-scrolling news headlines; uses the XMLLIB library.
BEZIERFIT.BBC Demonstrates fitting a polyBézier curve to multiple points; uses the GDIPLIB library.
CALENDAR.BBC A perpetual calendar, to demonstrate the DATELIB library.
CLIENT.BBC A chat client, used in conjunction with SERVER.BBC to demonstrate the SOCKLIB library.
CONWAY.BBC Conway's 'Game of Life' cellular automaton, using shader code to calculate its 'evolution' very quickly.
ELLIPSEFIT.BBC Demonstrates fitting an axis-aligned ellipse to four points; uses the GDIPLIB library.
KERNING.BBC A simple demonstration of how the appearance of proportional-spaced text can be improved by kerning.
LANCHAT.BBC A serverless chat program using UDP connections provided by the SOCKLIB library.
MODE7DEM.BBC A program to test and demonstrate MODE 7.
POEM.BBC 'Now Press Return', an interactive poem by Roger McGough (© 1981).
PROMPTER.BBC Smoothly scrolls text up the screen; uses the NOWAIT library.
SCROLL.BBC A demonstration of scrolling over a large canvas, using @ox% and @oy%.
SERVER.BBC A chat server, used in conjunction with CLIENT.BBC to demonstrate the SOCKLIB library.
SHEET.BBC A simple spreadsheet program. See the file SHEET.TXT for details.
SORTDEMO.BBC Graphically demonstrates different sorting algorithms and compares their speeds.
SORTTEST.BBC Tests and demonstrates the SORTLIB library.
UNICODE.BBC Demonstrates BBC BASIC for Windows' multilingual text capability.
UNICODEP.BBC Demonstrates multilingual text and right-to-left output to the hardcopy printer.

GRAPHICS

ALIENS.BBC Demonstrates the use of the IMGLIB library to load and plot rotated and scaled images.
ANIGIF.BBC Demonstrates displaying an 'animated GIF' graphic, using the IMGLIB library.
BOUNCE.BBC Coloured balls bounce across the screen; the program illustrates the use of data structures.
CHAIN.BBC A graphics demonstration using icons with transparent backgrounds.
CLOCK.BBC A very realistic analogue clock display.
DISCO.BBC Demonstrates the RECTANGLE SWAP statement.
DOODLE.BBC A simple 'etch-a-sketch' drawing program.
ELLIPSES.BBC Multi-coloured patterns created from rotated ellipses.
FERN.BBC A lifelike fractal image produced by a simple formula.
FLASHING.BBC Emulates the BBC Micro's flashing colours.
FLIER.BBC A spacecraft animation.
FLOOD.BBC Demonstrates the PLOT 143 (flood fill to non-background) statement.
FLUID.BBC A plasma-like swirling fluid, generated using the SHADERLIB library (shader code by Teqqles).
GDIPDEM.BBC Demonstrates the GDIPLIB anti-aliased graphics library.
JCLOCK.BBC An unusual clock that follows mouse movement. Loosely based on a Javascript program.
LIGHTING.BBC Demonstrates the use of the Direct3D lighting engine.
MANDEL.BBC Plots the famous fractal very quickly, using SSE instructions.
OPENGL.BBC A translation to BBC BASIC of an OpenGL 3D graphics demonstration program.
PENROSE.BBC A well known optical (and auditory) illusion!
PERSIAN.BBC A 'Persian carpet' graphics demonstration.
PIECHART.BBC Demonstrates drawing a pie-chart.
POINTER.BBC A demo version of a LOGO like 'turtle graphics' language.
POLYDOTS.BBC An animated graphics demonstration showing dots racing around polygons.
POLYGON.BBC A graphics demonstration program.
PYRAMID.BBC A demonstration of 3D graphics using the Direct3D library.
SAUCER.BBC A simple but effective 3D drawing.
SCARAB.BBC A scarab beetle-like pattern created from the behaviour of sines and cosines.
SEASCAPE.BBC A realistic seascape created in real-time using the SHADERLIB library (by Alexander Alekseev).
SINE.BBC Illustrates the 'text at graphics cursor' (VDU 5) mode.
SLIDERULE.BBC A demonstration of large sprites created using FN_createspritefrombmp.
SLITSCAN.BBC An emulation of the optical 'slit scan' technique using the SHADERLIB library (by Roy Wiggins).
SNOWSCENE.BBC A winter scene featuring a realistic fractal tree which is different every time.
SPECTRUM.BBC  Proves you can display more than 16 colours at once!
SPOTLIGHT.BBC A demonstration of the different types of light provided by the 3D graphics library.
SPRITES.BBC A demonstration of BBC BASIC for Windows sprites.
SQUARES.BBC An attractive pattern resulting from the exclusive-or function of the horizontal and vertical coordinates.
SURKS.BBC A demonstration of drawing 'thick' circles using the VDU 23,23 command.
SWIRL.BBC A demonstration of drawing 'thick' arcs using the VDU 23,23 command.
TEAPOT.BBC A realistic 'tumbling teapot' animation, using D3DX8BBC.DLL.
WHEEL.BBC A rotating colour wheel, showing the use of *REFRESH to control animation.
VORONOI.BBC A shader-based demonstration of an animated Voronoi Diagram (© 2013 by Inigo Quilez).
WORLD.BBC A 'rotating globe' animation, demonstrating mapping a texture onto a 'curved' surface.

PHYSICS

These programs demonstrate some of the capabilities of the Box2D physics engine (BOX2DLIB, BOX2DGFX and BOX2DDBG libraries).

CRADLE.BBC A simulation of Newton's Cradle, which demonstrates conservation of energy and momentum.
CRATES.BBC Simulates crates falling under the influence of gravity and tumbling over each other.
DANGLE.BBC Simulates a dangling chain, which you can grab with the mouse.
PINBALL.BBC A working simulation of a pinball table, combining 2D physics with 3D graphics.
PINTOGRAPH.BBC  Simulates a pantograph-like drawing engine made from Meccano™ components.

SOUNDS

CDPLAYER.BBC  Turns your CD-ROM drive into a simple CD player.
ENTERTAINER.BBC  Plays the popular Scott Joplin piece while displaying an animated piano keyboard.
METRONOME.BBC  Displays a simulated, working, metronome.
PIANO.BBC A polyphonic 'piano' using the PC's keyboard.
POLLY.BBC A demonstration of SOUND and ENVELOPE.
SKATERS.BBC A demonstration of four-voice music, enabled using *TEMPO.
SOLDIERS.BBC Plays a well known tune accompanied by a synchronised 3D animation of the subject matter!
SPEAK.BBC Uses the COMLIB library to access the Windows™ Text-to-Speech engine.
TOCFUGUE.BBC A demonstration of stereo sound using the HQSOUND library.
TOFAIR.BBC Another demonstration of the High Quality sound library.
WIDOR.BBC The Toccata from Widor's Organ Symphony number 5.

TOOLS

BEEBXFER.BBC A utility for transferring files from a BBC Micro.
DLGEDIT.BBC A 'visual' dialogue box editor, simplifying the design of custom dialogue boxes.
FCONVERT.BBC A utility for converting Acorn data files.
ICONEDIT.BBC A simple icon (or sprite) editing program.
PROFILER.BBC An execution time profiler to help tune programs for maximum speed.
SAA505X.BBC Lists the alternative teletext character sets in the MODE7LIB library.
SEARCHBBC.BBC  Searches .BBC files for a specified string.
SETTAB.BBC Programs the TAB key in the editor to move to a specified column.
WMF2EMF.BBC A utility for converting .WMF files to .EMF files

WINDOWS

DLGDEMO.BBC  A demonstration of the creation of a dialogue box.
GUIDEMO.BBC A program with a Windows™-style interface.
MDIDEMO.BBC Demonstrates the Windows™ Multiple Document Interface.
MENU.BBC A demonstration of how to add a menu bar.
MENU2.BBC As MENU.BBC, but using a popup menu.
MULTIDEM.BBC Creates multiple output windows using the MULTIWIN library.
OPTICS.BBC Uses pushbuttons to control a graphical demonstration.
REBAR.BBC Creates a 'rebar' control using the WINLIB5A library.
SOLVE.BBC Solves simultaneous equations using the ARRAYLIB and WINLIB5 libraries.
TEXTEDIT.BBC A simple text editor, utilising Windows' built-in edit control.
VSCROLL.BBC A demonstration of the use of a scroll bar.
WIDGETS.BBC A demonstration of a floating tool bar, a trackbar and a progress bar.


Differences from BBC BASIC (86)

BBC BASIC for Windows differs from BBC BASIC (86) for MS-DOS in the following respects: If you want to run a program which was originally written for BBC BASIC (86) you can include the *EGA command in your program; this results in subsequent MODE statements selecting modes with dimensions compatible with BBC BASIC (86).


Version 6 changes

Versions 6.00a and later of BBC BASIC for Windows incorporate some significant changes compared with earlier versions, as follows:

BASIC interpreter

Operating System interface

Compiler

Program editor and IDE

Compatibility considerations

Most programs should not require any alteration to run properly in BBC BASIC for Windows version 6. However in a few cases changes may be necessary to ensure compatibility, as follows:


Notices

BBC BASIC for Windows is thought to be free from serious bugs, and it is highly unlikely that it could do any harm to other software or systems. However there is NO warranty that it will not and its use is at your own risk.

BBC BASIC for Windows is the Copyright © 2001-2021 of R. T. Russell. It is supplied for use on one computer at a time only. Neither the program nor its accompanying documentation may be copied for simultaneous use by the purchaser nor for use by anyone other than the purchaser.

Schools and colleges are granted permission to reproduce or adapt sections of this manual to support teaching in a classroom context.

The name BBC BASIC is used with the permission of the British Broadcasting Corporation.

The aPLib compression library is used with permission. Copyright © 1998-2014 by Joergen Ibsen, All Rights Reserved.

Left CONTENTS

CONTINUE Right


Best viewed with Any Browser Valid HTML 3.2!
© Richard Russell 2021