BBC BASIC for SDL 2.0 is an advanced cross-platform version of BBC BASIC which will run in Windows, MacOS, Linux (x86), Raspberry Pi OS, Android, iOS and in a browser. 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 applications.
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 first start BBC BASIC for SDL 2.0 (desktop editions) you will be asked to choose one of the two supplied IDEs (Integrated Development Environments). These provide similar capabilities but are significantly different in their detailed interface, so you may want to experiment with both to discover which you prefer.
In both cases you will be 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 GUI 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.
A unique feature is the incorporation of an assembler which generates code appropriate to the host platform (32-bit x86, 64-bit x86, 32-bit ARM or 64-bit ARM); the iOS and in-browser editions are exceptions and do not have an assembler. You can access the SDL 2.0 Application Program Interface both from BASIC and from assembler code, allowing an experienced programmer to produce sophisticated applications.
The desktop editions allow you to create a stand-alone application bundle from a BASIC program, which will run without BBC BASIC having to be installed. You can distribute such applications freely without any royalty being due.
BBC BASIC for SDL 2.0 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.
Platform | Requirements |
---|---|
Windows | Windows Vista or later, 32-bits or 64-bits. |
Mac OS | OS-X 10.6 (Snow Leopard) or later, x86 CPU, 64-bits only. |
Linux | x86 CPU, 32-bits or 64-bits (glibc 2.27 or later). |
Raspbian | Raspberry Pi 2 or later (RPi 3 or 4 preferred), 32-bits or 64-bits. |
Android | Android 4.4 (KitKat) or later. |
iOS | iPod 6th gen, iPhone 5S, iPad Air, iPad Mini 2 or later (64-bits). |
In-browser | Most desktop browsers (except IE and Safari), Chrome on Android. |
x86 platforms | ARM or in-browser platforms | |
---|---|---|
Memory available for user's program, data and stack | Default approximately 2 Mbytes, maximum 256 Mbytes | Default approximately 2 Mbytes, maximum 256 Mbytes (16 Mbytes for the in-browser edition) |
Size of BASIC program | Limited only by available memory (maximum 65535 numbered lines) | Limited only by available memory (maximum 65535 numbered lines) |
Length of program lines | Maximum 251 characters (tokenised) excluding line number | Maximum 251 characters (tokenised) excluding line number |
Integer variables | 32 bits, signed (−2147483648 to +2147483647) 64 bits, signed (−9223372036854775808 to +9223372036854775807) |
32 bits, signed (−2147483648 to +2147483647) 64 bits, signed (−9223372036854775808 to +9223372036854775807) |
Floating-point (real) variables | 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 | 53-bit mantissa plus 11-bit exponent (±2.3E−308 to ±1.7E308); precision approximately 15 significant figures |
String variables | Length limited only by available memory | Length limited only by available memory |
Array variables | Maximum 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 variables | Limited only by available memory | Limited only by available memory |
Length of variable names | Limited only by available memory and maximum line length | Limited only by available memory and maximum line length |
Levels of nesting | Limited only by available memory | Limited only by available memory |
The example programs are located in sub-folders under the following categories:
2048.bbc | Slide the numbered tiles to combine them in pairs until you reach a total of 2048. |
Rubik.bbc | Displays a 3D-animated Rubik's cube and solves it from any starting point. |
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. |
dropperz.bbc | Dodge, catch or shoot at various objects dropped by the alien invader. |
gorillas.bbc | Two gorillas hurl bananas at each other over the rooftops (choose human or computer control). |
hangman.bbc | The traditional word-guessing game, with animated graphics. |
hanoi.bbc | Solves the 'Towers of Hanoi' problem; not really a game as the computer does all the work! |
jigsaw.bbc | Solve a jigsaw puzzle, you can choose how many pieces and even use your own picture. |
lemmings.bbc | Guide the lemmings to safety, based on a Liberty BASIC demo program. |
snake.bbc | A colourful version of the well-known game in which a snake grows longer as it eats. |
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. |
Ceefax.bbc | Simulates the television text service, using the BBC's RSS feeds as the source of information. |
SkyBaby.bbc | An astronomy program which helps locate objects and shows where they appear in the sky. |
banner.bbc | Displays horizontally-scrolling news headlines; uses the xmllib library. |
bezierfit.bbc | Demonstrates fitting a polyBézier curve to multiple points; uses the aagfxlib library. |
client.bbc | A chat client, used in conjunction with server.bbc to demonstrate the socklib library. |
calendar.bbc | A perpetual calendar, to demonstrate the datelib library. |
dlgdemo.bbc | A demonstration of the creation of a dialogue box. |
ellipsefit.bbc | Demonstrates fitting an axis-aligned ellipse to four points; uses the aagfxlib library. |
kerning.bbc | Adjusts the inter-character spacing in order to improve the appearance of proportional-spaced text. |
lanchat.bbc | A serverless chat program using UDP connections provided by the socklib library. |
mode7dem.bbc | A program to test and demonstrate MODE 7. |
multidem.bbc | Creates multiple output windows using the multiwin library. |
multitouch.bbc | Uses the eventlib library to monitor multiple touch points (requires a touchscreen). |
optics.bbc | Uses pushbuttons to control a graphical demonstration. |
poem.bbc | 'Now Press Return', an interactive poem by Roger McGough (© 1981). |
polyfit.bbc | Demonstrates the use of array arithmetic to solve a mathematical problem. |
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. |
solve.bbc | Solves simultaneous equations using the ARRAYLIB library. |
sortdemo.bbc | An audible and graphical demonstration of different sorting algorithms, based on a QBASIC program. |
sorttest.bbc | Tests and demonstrates the sortlib library. |
telstar.bbc | A client for online information services using the old Prestel/Videotex communication protocols. |
textedit.bbc | A text editor demonstrating the use of the menulib and editbox libraries. |
unicode.bbc | Demonstrates BBC BASIC for SDL 2.0' multilingual text capability. |
aagfxdem.bbc | Demonstrates the aagfxlib anti-aliased graphics library. |
aliens.bbc | A demonstration of BBC BASIC for SDL 2.0 sprites. |
anigif.bbc | A demonstration of displaying an animated GIF image using the imglib library. |
bounce.bbc | Coloured balls bounce across the screen; the program illustrates the use of data structures. |
candle.bbc | A realistic simulation using the gfxlib library. |
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. |
ellipse.bbc | Multi-coloured patterns created from rotated ellipses. |
fern.bbc | A lifelike fractal image produced by a simple formula. |
flier.bbc | A spacecraft animation. |
flood.bbc | Demonstrates the PLOT 143 (flood fill to non-background) statement. |
jclock.bbc | An unusual clock that follows mouse movement. Loosely based on a Javascript program. |
lighting.bbc | Demonstrates the use of the OpenGL lighting engine. |
mandel.bbc | Plots the famous fractal very quickly, using shader code. |
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 3D graphics library. |
saucer.bbc | A simple but effective 3D drawing. |
scarab.bbc | A scarab beetle-like pattern created from the behaviour of sines and cosines. |
sine.bbc | Illustrates the 'text at graphics cursor' (VDU 5) mode. |
sliderule.bbc | A demonstration of large sprites created using FN_createspritefrombmp. |
spectrum.bbc | Proves you can display more than 16 colours at once! |
snowscene.bbc | A winter scene featuring a realistic fractal tree which is different every time. |
spotlight.bbc | A demonstration of the different types of light provided by the 3D graphics library. |
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 the 3D graphics library. |
wheel.bbc | A rotating colour wheel, showing the use of *REFRESH to control animation. |
world.bbc | A 'rotating globe' animation, demonstrating mapping a texture onto a 'curved' surface. |
samples | A sub-directory containing programs illustrating the capabilities of the Box2D physics engine. |
bbclock.bbc | Simulates a 'ballbearing clock'. |
cradle.bbc | Simulates Newton's Cradle, illustrating conservation of energy and momentum. |
crates.bbc | Simulates how falling crates behave when they hit the ground or other crates. |
dangle.bbc | Simulates the behaviour of a dangling chain; you can grab it! |
dunebuggy.bbc | Simulates a vehicle with sprung suspension. |
lotto.bbc | Simulates a lottery selection machine. |
pinball.bbc | Simulates a pinball machine, seemingly in 3 dimensions! |
pintograph.bbc | Simulates a drawing machine made with Meccano™ parts. |
trebuchet.bbc | Simulates the rock-throwing war machine. |
brandenburg.bbc | J.S. Bach's Brandenburg Concerto No. 3 as apparently played by a 3D animated street organ. |
entertainer.bbc | Plays the popular Scott Joplin piece while displaying an animated piano keyboard. |
figleaf.bbc | Another of Scott Joplin's piano rags. |
metronome.bbc | A graphical metronome which actually works. |
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! |
tocfugue.bbc | Bach's Toccata and Fugue in D minor, demonstrating stereo sound. |
tofair.bbc | Another demonstration of four-voice music. |
widor.bbc | The Toccata from Widor's Organ Symphony number 5. |
BBCEdit.bbc | Andy Parkes' Interactive Development Environment. |
SDLIDE.bbc | Richard Russell's Interactive Development Environment. |
compiler.bbc | Utility to create an application bundle (access via the SDLIDE Utilities menu). |
crossref.bbc | Cross Reference utility (access via the SDLIDE Utilities menu). |
getri.bbc | Utility to show information about your display's rendering capabilities. |
hello.bbc | Utility to demonstrate the use of the inline assembler (when available). |
listvars.bbc | List Variables utility (access via the SDLIDE Debug command). |
macrorec.bbc | Utility to program the function keys (access via the SDLIDE Utilities menu). |
memmon.bbc | Run-time memory monitor utility (access via the SDLIDE Utilities menu). |
mmap.bbc | Utility to display a memory map (Linux and Android only). |
profiler.bbc | Run-time profiler utility (access via the SDLIDE Run menu). |
saa505x.bbc | Utility to display the language character sets available in MODE 7. |
searchin.bbc | Search BASIC programs utility (access via the SDLIDE Utilities menu). |
sysvars.bbc | Utility to display the virtual memory addresses of the 'system variables'. |
timing.bbc | Times various operations to provide a comparative measure of interpreter speed. |
touchide.bbc | The simplified IDE used by the Android, iOS and in-browser editions. |
BBC BASIC for SDL 2.0 is the Copyright © 2015-2022 of R. T. Russell
The name BBC BASIC is used with the permission of the British Broadcasting Corporation.
CONTENTS |
CONTINUE |