!Q_BBC

Translates Q BASIC to BBC Basic.

October, 2005

Martin Carradus


Copyright © 2005 Leaf Mindcraft



Downloading, Unpacking and Using !Q_BBC


Return to Home Page...

Link to Next in Home Page Table...

Link to Previous in Home Page Table...

This is an Acorn RISC OS software application that converts/translates from Q Basic Program Files to BBC Basic Program Files, and is available for free download.

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

Double click on a QBasic 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 QBasic 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 BBC Basic file is offered for saving in the same directory as the QBasic file, but with the file name prefixed by "BBC".

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

The translated file then should duplicate the effect of the QBasic program within the BBC Basic environment.


Known Bugs
==========

QBasic will not run a FOR loop when its index initially exceeds its final value, unlike BBC Basic, which always executes a FOR loop at least once, so there is a problem there. Also QBasic initialises all variables to zero. BBC Basic does not automatically initialise variables. The BBC Basic interpreter message 'Unknown or missing variable' means that you have not initialised a variable before the point at which its value is required to be known. An output listing of all the identifiers used in the program can be produced that attempts to detect and mark those variables that are used before their point of initilisation.

There could be numerical analysis problems to do with the accuracy of the representation of numbers. QBasic has integer variables of both 16 bits and 32 bits and floating point of 32 bits and 64 bits, whereas BBC Basic always uses 32 bits for integer variables and 40 bits for floating point variables.

Many QBasic constructs were found to be untranslatable to BBC Basic. A message appears either within a special PROC or FN call in the translated file when this occurs. In the case of some errors, the resulting actual BBC Basic line length may not agree with the line length given in the file and BBC Basic editors will not accept it, giving out the message: 'Bad Basic program'. However if only simple constructs are being used e.g. DO, WHILE and FOR loops, GOTO, GOSUB, ON... GOTO, ON ... GOSUB, SELECT, IF ... THEN ... ELSE ... ,EVAL, numerical calculations, logical conditions and PRINT and INPUT, then the QBasic should perform exactly the same in BBC Basic.

NB. Version 2.00 now handles syntax errors much better without producing invalid BBC Basic.

Unfortunately the commands DRAW, PLAY, PUT and GET have not been translated. Also other graphics commands suffer from the fact that BBC Basic graphic co-ordinates are measured from the lower left hand corner of the screen, whereas QBasic graphics are measured from the upper left hand corner. The author has attempted to deal with this appropriately. Also the scaling is different. IBM Screen modes were also found to be difficult to match with equivalent Acorn Screen modes. The IBM colouring system is also not the same as the Acorn scheme.

In addition, PEEK, POKE and random access files could not be mimicked in BBC Basic.

Extra PROCs and FNs, which were needed to mimic certain constructs in both GW-BASIC and QBasic, are present in the supplied 'BBCLib', which is called in via an injected LIBRARY command. 'BBCLib' should be in when the BBC Basic is running or an error is generated. It is also present within the !Q_BBC application. One function attempts to translate from IBM file names to equivalent Acorn file names.

Currently, will not handle multi-line DEF FN statements.

!Q_BBC attempts to detect non- QBasic programs and complains.

Every attempt has been made to test out the translator, but the author was unable to obtain live code and just had to devise test programs, so bugs could still exist undetected.

NB !Q_BBC will only handle those QBasic programs with line labels, not numbers. The author has produced an application, !QLine_Out, present with !Q_BBC, which strips out line numbers from a QBasic program and outputs an equivalent labelled QBasic program. This, in turn, can be offered to !Q_BBC for translation. !QLine_Out will detect and leave unchanged those programs already with labels. !Q_BBC will complain about line numbers in the supplied QBasic.


Click on Icon to DownLoad Zipped !Q_BBC Version 4.00 Dated January 17th 2009. Now 32-bit compatible.


This document was generated on 1st February 2009 for Acorn Applications written and distributed by Martin Carradus.