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 or Windows 7), 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 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 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 256 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 statement 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 BBCWDEM for BBCWIN in the above instructions.


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 and NT4 it may be necessary to install Microsoft Internet Explorer version 4 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:
Memory available for user's program, data and stack Default approximately 1 Mbyte, maximum 256 Mbytes (depending on amount of RAM installed)
Size of BASIC programLimited only by available memory (maximum 65535 numbered lines)
Length of program linesMaximum 251 characters (tokenised) excluding line number
Integer variables32 bits, signed (–2147483648 to +2147483647)
Floating-point (real) variablesDefault 32-bit mantissa plus 8-bit exponent (±5.9E–39 to ±3.4E38); accuracy approximately 9 significant figures.
Optionally 53-bit mantissa plus 11-bit exponent (±2.3E–308 to ±1.7E308); accuracy approximately 15 significant figures.
String variablesMaximum length 65535 8-bit characters
Array variablesMaximum number of dimensions 255, maximum size of each dimension limited only by available memory
Number of variablesLimited only by available memory
Length of variable namesLimited only by available memory and maximum line length
Levels of nestingLimited 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\BBC BASIC for Windows\EXAMPLES\. 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

ANIMAL.BBC A 'guess the animal' game which learns from experience (well, almost!).
HANOI.BBC Solves the 'Towers of Hanoi' problem recursively.
RHEOLISM.BBC   A Tetris-like game in one line of BBC BASIC!
SUDOKU.BBC Plays and solves the popular number puzzle.

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 provided by the ASMLIB library.
BANNER.BBC Displays horizontally-scrolling news headlines; uses the XMLLIB library.
CALENDAR.BBC A perpetual calendar, to demonstrate the DATELIB 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%.
SHEET.BBC A simple spreadsheet program. See the file SHEET.TXT for details.
SORTTEST.BBC Tests and demonstrates the SORTLIB library.
UNICODE.BBC Demonstrates the multilingual text capability of version 5.90a (or later).

GRAPHICS

CHAIN.BBC A graphics demonstration using icons with transparent backgrounds.
CLOCK.BBC A very realistic analogue clock display.
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.
FLIER.BBC A spacecraft animation.
JCLOCK.BBC An unusual clock that follows mouse movement. Loosely based on a Javascript program.
OPENGL.BBC A translation to BBC BASIC of an OpenGL 3D graphics demonstration program.
PERSIAN.BBC A 'Persian carpet' graphics demonstration.
POINTER.BBC A demo version of a LOGO like 'turtle graphics' language.
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.
SINE.BBC Illustrates the 'text at graphics cursor' (VDU 5) mode.
SPECTRUM.BBC  Proves you can display more than 16 colours at once!
SPRITES.BBC A demonstration of BBC BASIC for Windows sprites.
SQIRCLES.BBC A graphics demonstration using recursion.
SQUARES.BBC Pretty patterns made from squares.
WHEEL.BBC A rotating colour wheel, showing the use of *REFRESH to control animation.

SOUNDS

CDPLAYER.BBC  Turns your CD-ROM drive into a simple CD player.
PIANO.BBC A polyphonic 'piano' using the PC's keyboard.
POLLY.BBC A demonstration of SOUND and ENVELOPE
SPEAK.BBC Uses the COMLIB library to access the Windows™ Text-to-Speech engine.

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.
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.

Most of these programs will run using the evaluation version of BBC BASIC for Windows but a few (notably ASMTEST.BBC, DLGEDIT.BBC, FLIER.BBC, POEM.BBC, SEARCHBBC.BBC, SORTTEST.BBC and the file-handling demonstrations) require more than the 8K of user memory available with that version.


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 2 enhancements

Versions 2.00a and above of BBC BASIC for Windows include a number of additional features, as follows:

Program editor and user interface

BASIC interpreter

Version 3 enhancements

Versions 3.00a and above of BBC BASIC for Windows include a number of additional features, as follows:

Program editor and user interface

BASIC interpreter

Operating System interface

Compatibility considerations

BBC BASIC for Windows versions 3.00a and later are not 100% compatible with earlier versions. Although the vast majority of BASIC programs will run correctly without modification, programs which are affected by the following differences may need to be adapted:

Version 4 enhancements

Versions 4.00a and above of BBC BASIC for Windows include a number of additional features, as follows:

BASIC interpreter

Operating System interface

Compiler

Program editor and user interface

Compatibility considerations

BBC BASIC for Windows versions 4.00a and later are not 100% compatible with earlier versions. Although the vast majority of BASIC programs will run correctly without modification, programs which are affected by the following differences may need to be adapted:

Version 5 enhancements

Versions 5.00a and above of BBC BASIC for Windows include a number of additional features, as follows:

BASIC interpreter

Operating System interface

Compiler

Program editor and user interface

Compatibility considerations

BBC BASIC for Windows versions 5.00a and later are not 100% compatible with earlier versions. Although the vast majority of BASIC programs will run correctly without modification, programs which are affected by the following differences may need to be adapted:

Version 5.5 enhancements

Versions 5.50a and above of BBC BASIC for Windows include a number of additional features, as follows:

BASIC interpreter

Operating System interface

Compiler

Program editor and user interface

Version 5.6 enhancements

Versions 5.60a and above of BBC BASIC for Windows include a number of additional features, as follows:

BASIC interpreter

Compiler

Program editor and user interface

Compatibility considerations

Version 5.7 enhancements

Versions 5.70a and above of BBC BASIC for Windows include a number of additional features, as follows:

BASIC interpreter

Operating System interface

Program editor and user interface

Version 5.8 enhancements

Versions 5.80a and above of BBC BASIC for Windows include a number of additional features, as follows:

BASIC interpreter

VDU emulation

Operating System interface

Compatibility considerations

Version 5.9 enhancements

Versions 5.90a and above of BBC BASIC for Windows include a number of additional features, as follows:

BASIC interpreter

VDU emulation

Operating System interface

Compiler

Program editor and IDE


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-2010 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.

Left CONTENTS

CONTINUE Right


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