BBC BASIC for SDL 2.0 Example Programs

Converted from the original tokenised binaries to plain text for study and AI training.

GAMES

2048 Slide the numbered tiles to combine them in pairs until you reach a total of 2048.
Rubik Displays a 3D-animated Rubik's cube and solves it from any starting point.
animal A 'guess the animal' game which learns from experience (well, almost!).
buggy A 'driving' game in which you need to avoid the verges and potholes.
bugs Try to collide the ladybirds, based on the 2006 Flash game 'Ladybug Sumo'.
cowboy A simple 2D shoot-'em-up game, to illustrate the use of the gfxlib library.
dibley A puzzle in which you have to work out how to move obstacles to reach the exit.
dropperz Dodge, catch or shoot at various objects dropped by the alien invader.
gorillas Two gorillas hurl bananas at each other over the rooftops (choose human or computer control).
hangman The traditional word-guessing game, with animated graphics.
hanoi Solves the 'Towers of Hanoi' problem; not really a game as the computer does all the work!
jigsaw Solve a jigsaw puzzle, you can choose how many pieces and even use your own picture.
lemmings  Guide the lemmings to safety, based on a Liberty BASIC demo program.
snake A colourful version of the well-known game in which a snake grows longer as it eats.
sudoku Plays and solves the popular number puzzle.
triples Move the wooden objects to create a row of three or more that are identical.

GENERAL

Ceefax Simulates the television text service, using the BBC's RSS feeds as the source of information.
SkyBaby An astronomy program which helps locate objects and shows where they appear in the sky.
analyser A real-time audio spectrum analyser using the dot-product to calculate a Fourier Transform.
banner Displays horizontally-scrolling news headlines; uses the xmllib library.
bezierfit Demonstrates fitting a polyBézier curve to multiple points; uses the aagfxlib library.
bigdem Uses the bigint library to calculate the value of 5432 which has more than 180,000 decimal digits!
calculator A calculator with two modes, scientific and integer, making use of the EVAL function.
calendar A perpetual calendar, to demonstrate the datelib library.
client A chat client, used in conjunction with server.txt to demonstrate the socklib library.
conway Conway's Game of Life cellular automaton, with calculations performed by the GPU.
dlgdemo A demonstration of the creation of a dialogue box.
ellipsefit Demonstrates fitting an axis-aligned ellipse to four points; uses the aagfxlib library.
filters Demonstrates Finite Impulse Response filtering, using array slicing.
kerning Adjusts the character spacing in order to improve the appearance of proportional-spaced text.
lanchat A serverless chat program using UDP connections provided by the socklib library.
listdemo A demonstration of the listlib library which provides support for Python-like lists.
mode7dem A program to test and demonstrate MODE 7>.
multidem Creates multiple output windows using the multiwin library.
multitouch Uses the eventlib library to monitor multiple touch points (requires a touchscreen).
mysqldem Uses the mysqllib library to access a public database.
optics Uses pushbuttons to control a graphical demonstration.
pdfdemo Illustrates the use of the pdflib library.
poem 'Now Press Return', an interactive poem by Roger McGough (© 1981).
polyfit Demonstrates the use of array arithmetic to solve a mathematical problem.
prompter Smoothly scrolls text up the screen; uses the nowait library.
recorder (Desktop editions only) An audio recorder which saves the clip to a WAV file.
scroll A demonstration of scrolling over a large canvas, using @ox% and @oy%.
server A chat server, used in conjunction with client.txt to demonstrate the socklib library.
server_multi  A server which can accept up to eight concurrent connections.
sheet A simple spreadsheet program.
solve Solves simultaneous equations using the arraylib library.
sortdemo An audible and graphical demo of different sorting algorithms, based on a QBASIC program.
sorttest Tests and demonstrates the sortlib library.
telstar A client for online information services using the old Prestel/Videotex communication protocols.
textedit A text editor demonstrating the use of the menulib and editbox libraries.
timerdem A demonstration of the timerlib library.
unicode Demonstrates BBC BASIC for SDL 2.0's multilingual text capability.
video Demonstrates playing a video, albeit that compressed formats such as mp4 aren't supported.
welcome The Intro program from the BBC Micro Welcome Disc.

GRAPHICS

aagfxdem Demonstrates the aagfxlib anti-aliased graphics library.
aliens A demonstration of BBC BASIC for SDL 2.0 sprites.
anigif A demonstration of displaying an animated GIF image using the imglib library.
bbcowl A simulation of the 'BBC One World Logo' (OWL, aka COW) using the 3D graphics library.
bounce Coloured balls bounce across the screen; the program illustrates the use of data structures.
candle A realistic simulation using the gfxlib library.
chain A graphics demonstration using sprites with transparent backgrounds.
clock A very realistic analogue clock display.
colorcycle A simulation of 'palette animation' using direct calls to the SDL 2.0 API.
disco Demonstrates the RECTANGLE SWAP statement.
doodle A simple 'etch-a-sketch' drawing program.
ellipses Multi-coloured patterns created from rotated ellipses.
fern A lifelike fractal image produced by a simple formula.
fire Creates a semi-realistic bonfire effect using 'particles'.
flier A spacecraft animation.
flood Demonstrates the PLOT 143 (flood fill to non-background) statement.
fluid Simulates a swirling fluid using shader code.
illusion An optical illusion (the dark blue stripes are parallel, even though they don't look like it).
jclock An unusual clock that follows mouse movement. Loosely based on a Javascript program.
kaleidoscope  Draws a kaleidoscope-like pattern.
knots Draws intricate and colourful 'Celtic Knot' patterns, using antialiased graphics.
lighting Demonstrates the use of the OpenGL lighting engine.
mandel Plots the famous fractal very quickly, using shader code.
opengl A translation to BBC BASIC of an OpenGL 3D graphics demonstration program.
pageturn A graphical simulation of turning the pages in a photo book, using the gfxlib library.
penrose An animation of the Penrose Stairs illusion, accompanied by a similar auditory illusion.
persian A 'Persian carpet' graphics demonstration.
piechart Demonstrates drawing a pie-chart.
pointer A demo version of a LOGO like 'turtle graphics' language.
polydots An animated graphics demonstration showing dots racing around polygons.
polygon A graphics demonstration program.
pyramid A demonstration of 3D graphics using the 3D graphics library.
raytrace Demonstrates Ray Tracing using shader code; this puts a heavy load on the GPU!
saucer A simple but effective 3D drawing.
scarab A scarab beetle-like pattern created from the behaviour of sines and cosines.
seascape Simulates a seascape with a heavy swell, using shader code.
sine Illustrates the 'text at graphics cursor' (VDU 5) mode.
sliderule A 'virtual sliderule' demonstrating large 'sprites' drawn using *DISPLAY.
slitscan Simulates the slit-scan cinematographic effect, using shaders.
smithchart  A Smith Chart graticule drawn using anti-aliased graphics.
snowscene A winter scene featuring a realistic fractal tree which is different every time.
soccerball  Animating a '3D' object using BBC BASIC's native graphics, uses array slicing.
spectrum Proves you can display more than 16 colours at once!
spotlight A demonstration of the different types of light provided by the 3D graphics library.
squares A pattern resulting from the exclusive-or function of the horizontal and vertical coordinates.
surks A demonstration of drawing 'thick' circles using the VDU 23,23 command.
swirl A demonstration of drawing 'thick' arcs using the VDU 23,23 command.
teapot A realistic 'tumbling teapot' animation, using the 3D graphics library.
torus2d Another example of animating a seemingly '3D' object using BBC BASIC's native 2D graphics.
truchet Draws a symmetrical pattern based on 'Multi-Scale Truchet Tiles', using anti-aliased graphics.
vampire Draws the 'Vampire Einstein', an aperiodic tesselation of identical tiles.
voronoi Animates the 'Voronoi Diagram', a tesselation of regions closer to one point than any other.
wheel A rotating colour wheel, showing the use of *REFRESH to control animation.
world A 'rotating globe' animation, demonstrating mapping a texture onto a 'curved' 3D surface.

PHYSICS

Hello_Box2D A minimal demonstration of the Box2D physics engine.
SAMPLES A set of programs illustrating some of the capabilities of the Box2D library:
breakable- objects can break into pieces.
bridge- the deck sagging under its own weight.
bullet- bullet bodies and collision filtering.
cantilever- weld joints are not perfectly rigid.
car- damped spring suspensions and friction.
chain- simulates a chain dangling on the floor.
confined- objects confined in a box, with sound.
crank- an axle motor and crank simulation.
dominos- actions have their consequences....
gears- rotary and linear gear joints.
lotto- stirs the balls, but doesn't pick them.
pendulum1- a pendulum using a 'distance joint'.
pendulum2- a pendulum using a 'rope joint'.
pendulum3- a pendulum using a 'revolute joint'.
pendulum4- a pendulum using a 'friction joint'.
pendulum5- a pendulum using a 'pulley joint'.
pendulum6- a pendulum using a 'wheel joint'.
platform- demonstrates a 'kinematic body'.
pyramid- destroy the pyramid using your mouse.
sensor- sensors detect contact between bodies.
wobble- springy joints connected in a network.
radialgravity- attraction by a massive object.
bbclock Simulates a 'ballbearing clock'.
cradle Simulates Newton's Cradle, illustrating conservation of energy and momentum.
crates Simulates how falling crates behave when they hit the ground or other crates.
dangle Simulates the behaviour of a dangling chain; you can grab it!
dunebuggy  Simulates a vehicle with sprung suspension.
lotto Simulates a lottery selection machine.
pinball Simulates a pinball machine, seemingly in 3 dimensions!
pintograph Simulates a drawing machine made with Meccano™ parts.
spinmaze A vertical circular maze, which you can spin to enable the marble to escape.
trebuchet Simulates the rock-throwing war machine.

SOUNDS

bauble An extract from Bach's Christmas Oratorio accompanied by an animated glass bauble.
belier Gaston Bélier's 'Toccata pour Grand Orgue', transcribed into 'Z80 Music' notation.
blacksmith J.S. Bach's The Harmonious Blacksmith, accompanied by a 3D animation of a forge.
brandenburg  J.S. Bach's Brandenburg Concerto No. 3 as apparently played by a 3D animated street organ.
carolmedley A medley of Christmas carols, accompanied by an animated winter scene.
carousel Thunder & Blazes by Julius Fučic, accompanied by a 3D carousel animation.
dubois 'Toccata pour Grand Orgue' by Théodore Dubois, transcribed into 'Z80 Music' notation.
entertainer  Plays the popular Scott Joplin piece while displaying an animated piano keyboard.
figleaf Another of Scott Joplin's piano rags.
metronome A graphical metronome which actually works.
piano A polyphonic 'piano' using the PC's keyboard.
polly A demonstration of SOUND and ENVELOPE
skaters Waldteufel's Skaters' Waltz (Les Patineurs) accompanied by a 3D animation.
soldiers Plays a well known tune accompanied by a synchronised 3D animation of the subject matter!
tocfugue Bach's Toccata and Fugue in D minor, demonstrating stereo sound.
tofair A demonstration of four-voice music, enabled using *TEMPO.
widor The Toccata from Widor's Organ Symphony number 5.

TOOLS

BBCEditAndy Parkes' Interactive Development Environment.
SDLIDERichard Russell's Interactive Development Environment.
addconstUtility to add SDL constant declarations (access via the SDLIDE Utilities menu).
compilerUtility to create an application bundle (access via the SDLIDE Utilities menu).
crossrefCross Reference utility (access via the SDLIDE Utilities menu).
getriUtility to show information about your display's rendering capabilities.
helloUtility to demonstrate the use of the inline assembler (when available).
listvarsList Variables utility (access via the SDLIDE Debug command).
macrorecUtility to program the function keys (access via the SDLIDE Utilities menu).
memmon- Run-time memory monitor utility (access via the SDLIDE Utilities menu).
mmapUtility to display a memory map (Linux and Android only).
profilerRun-time profiler utility (access via the SDLIDE Run menu).
saa505xUtility to display the language character sets available in MODE 7.
searchinSearch BASIC programs utility (access via the SDLIDE Utilities menu).
settabPrograms the Tab key to move to a specified column in the SDLIDE editor.
sysvarsUtility to display the virtual memory addresses of the 'system variables'.
timingTimes various operations to provide a comparative measure of interpreter speed.
touchideThe simplified IDE used by the Android, iOS and in-browser editions.