Translates/Converts from BBC Basic to Acorn ANSI C.

Spring & Summer 2012

Martin Carradus

Copyright © 2012 Leaf Mindcraft

Downloading, Unpacking and Using !BBC_C32

Return to Home Page...

This is an Acorn RISC OS software application that converts from BBC Basic Program Files to Acorn ANSI C Text Files, and is available for free download.

Link to Next in Home Page Table...

Link to Bottom of Home Page Table...

After having downloaded and unzipped the !BBC_C32 Application, drag the application to a suitable directory on your hard disc. Double click on the !BBC_C32 icon to load it onto the icon bar.

Double click on a BBC Basic file or drag it to the bar icon to enter its file name into the main 'SetUp' panel slot. Alternatively clicking on the bar icon brings up the main 'SetUp' panel and the BBC Basic file can be dragged to this panel, or the file name can be typed manually into the slot at the top of this panel.

Select options from the 'SetUp' panel and then click on the 'Run' icon. After a while a translated C Text file is offered for saving in the same directory as the BBC Basic, with the same name as the Basic file but prefixed by a capital 'C'.

Additional Help is available from the bar icon menu, or by using the Acorn facility !Help, present in the 'Apps' directory.

For information on compilation, please consult either the on-line or Impression manual.

For more Technical Information, please consult the text file 'TechNote' within !BBC_C32.

There was a major bug in previous versions (to do with arrays), which only came to light in upgrading to RISC OS 4.

Now with versions 8, it has been further enhanced by offering the choices either that the BBC Basic is using a Library or forms a Library in its own right.

The buttons to make these choices will now be found just off the bottom of the main 'SetUp' panel.

Also within !BBC_C32, please read the text file '!ReadMe' for conditions of use and for cost and address to apply to for your own licensed version.

The versions previously supplied were rather 'buggy' - you are now advised to use the 32-bit compatible version 8.73 available for download by clicking on the icon below. I have now been working on this for eighteen and a half years, right through a Mid-Life Crisis following redundancy, so if there are further bugs, I don't want to know any more!

Previous Versions 8.72 made procedure and function local variables available to sub-procedures and functions that share them. These versions were very memory hungry, and crashed with larger Basic programs. Version 8.73, that is much more conservative with memory, is now available for download.

Now Version 8.75 attempts to deal with GOTOs that are out of bounds of the calling PROCedure (C Function), that the C compiler doesn't seem to like (in most cases, where this isn't happening, you won't notice any difference), also slight bugs with logical equalities with MID$, LEFT$ and RIGHT$, and indirected control blocks in PROCedure and FN arguments cured.

Version 8.75c 'free's strings of their previous value when they are reassigned, and also selectively 'free's any Wimp Control blocks on exit from the converted C program. An additional option has been added to the 'SetUp' panel, to declare all global variables as 'static', for re-entrant Wimp programs.

Version 8.76 replaces the 'bbc_read' C Library Function, which mimics the BBC Basic construct 'READ', by inline code in the converted C source code, and attempts to cater for passing values from BBC Basic variable names embedded in DATA statements. Also, if there are variable names in array DIMs, where the actual values come from DATA statements, then these values are READ from the DATA statements, and result in these values being supplied to the '#define' statements, in the converted C source code, that are generated by !BBC_C32 to satisfy such variable DIM declarations.

Version 8.77b:- Certain C compilers 'choke' over the Library 'array' function declarations in "leaf.h". This has been overcome by 'data typing' ('casting') both the arrays in the function calls and in the function declarations.

Version 8.80:- Attempts to deal with 'variable' GOTOs and GOSUBs. (See 'Technote' inside it, or in 'Notes' for details.)

Version 8.90:- Numerous other small 'bugs' cured. Now produces much less false 'syntax' error messages. The messages, now, seem only to concern genuine programming 'slips'.

Version 8.90a:- More 'bug fixes', in particular 'memory grabbing' with large BBC Basic programs.

Version 8.90b:- Corrects MAJOR problems with Version 8.90a.

Version 8.91:- More 'bug fixes'. After nearly 19 years, this is about as good as it gets, folks!

Version 8.92:- Some FINAL 'bug fixes'!! There were MAJOR problems, that now, hopefully, have been cured.

Click on icon to DownLoad Zipped !BBC_C32 Version 8.94, Dated 14th September 2012, and Libraries 'LeafLib' and 'LeafLib32' dated 30th April 2011. One 26 and one 32 bit compatible Library. Both now include 'bbc_' and 'os_' specific C functions previously supplied by RISC_OSLib. ('os_' functions now removed to separate Library Files, due to Linker conflicts.) Problems with C Functions 'bbc_restore' and 'bbc_read' cured. C Function 'bbc_restore' now takes in the BBC Basic line separation.


e.g. Command Needed for a Path 'my_path.' is of the form 'Set C$Path my_path.', either on the command line (Press F12), or in an Obey File (e.g. !Run).

NB 2. There should be a System Variable 'SharedCLibrary$Path' that has the Path of the Shared C Library in it. To access this value enclose it in angle brackets (< and >).

Alternatively, if you have the Acorn C and C++ compiler, either 26-bit or 32-bit, ('AcornC_C++', or 'AcornC\C++'), then running, or just viewing, the included application '!SetPaths' seems to do the trick.

NB 3. If you get the message '!BBC_C32 needs at least 10240K to start up', then open up the !BBC_C32 application (Hold down 'Shift' and double click over its icon), then get the internal 'Desc' text file into a text editor. In the first group of items in this file, you will find a 'wimpslot 10240k' statement. Edit this initial WimpSlot allocation to a size acceptable to your computer's amount of RAM available.

NB 4. With large BBC Basic programs, !BBC_C32 sometimes claims large amounts of memory, runs out of memory, and crashes. If you then run the BBC Basic through again, then often this doesn't happen again. Try, try, try again! (But now see below)

NB 5. Problem above, with large BBC Basic programs, now seems to have been cured. Was working on emulating EVAL. Can't be bothered, any more!

NB 6. Note "leaf.h" and both the Libraries now updated, so that the Library C Function 'bbc_restore' will now take in the BBC Basic line separation as a final argument.

NB 7. Attempted to 'gild the lily' with Version 8.93, but only seemed to 'cure' the estimation of the BBC Basic line separation, and alleviate the 'memory grabbing' behaviour somewhat.

NB 8. Version 8.94 attempts to deal with Wimp Control Blocks, in such a way to reduce Compiler errors.

This document was generated on 14th September 2012 for Acorn Applications written and distrbuted by Martin Carradus.