I'm floatin' around in ABC
Posted by Steve Revill Thu, 23 Jun 2022 08:11:00 GMT
Find yourself writing programs in BBC BASIC? Do your programs ever involve floating point maths? Well we’ve got some good news for you!
The Archimedes BASIC Compiler (ABC) 5.00 has been extended with a new option to directly output Vector Floating Point maths instructions which then run on the hardware floating point unit built into many recent Arm processors. This gives a considerable speed increase compared with its predecessor the Floating Point Accelerator which is often emulated now.
Code generation selector
Travelling at the speed of light
By way of an illustration, let’s dive into the world of Benoit Mandelbrot and visualisations of his famous Mandelbrot set.
This sample contains 4 variants to compare side by side – no programming skills required – just run the ready-baked programs. The Mandelbrot set will be drawn and the time taken plotted in the corner of the screen. It should look something like this:
Mandelbrot set
The exact times you see will vary depending on how fast your computer is and how many colours are used, but when normalised so that the slowest is 100% we see:
Runs on | Maths unit | Example running time | Normalised |
---|---|---|---|
BASIC64 interpreter | FPA | 32.46s | x1 |
ABC compiled version | FPA | 7.14s | x4.5 |
BASIC64 interpreter | VFP | 4.9s | x6.6 |
ABC compiled version | VFP | 0.91s | x35.7 |
ABC will also make use of the supporting trig and logarithm functions when required, as does BASIC VI (version 1.84 and later) as part of the OS.
Programs compiled with ABC and using VFP require VFPSupport 0.18 or later, and ABCLibrary 5.00 or later.
Extended precision isn’t available on the VFP unit.
If you wanna have a good time
ABC 5.00 is available now and part of the latest Desktop Development Environment, DDE31. Developers who updated within the last 12 months should already have received the upgrade link by email.
If you don’t need the full DDE, there’s a cut-down version with the BASIC goodness which you can get at no cost courtesy of RISCOS.FR by following the link for the BASIC-Only DDE.
Great news, Mr. Farenheit!