RTR logo

QB2BBC

QBASIC to BBC BASIC for Windows translator



Introduction

QB2BBC is an automatic translator from QBASIC (or QuickBasic) to BBC BASIC for Windows. Using the translator most QBASIC programs can be converted to BBC BASIC without the need for any 'human assistance'. The translated program can be run directly from QB2BBC - you don't need to install BBC BASIC as well. However, if you want to modify or add to the BBC BASIC translation you will need to purchase and install the full version of BBC BASIC for Windows to do so.

All dialects of BASIC are similar, but since BBC BASIC pre-dates and has very different origins from QBASIC (BBC BASIC first appeared in 1982, Microsoft QuickBasic in 1985 and QBASIC in 1991) there are significant differences between them. However BBC BASIC for Windows is sufficiently flexible that it can emulate the behaviour of QBASIC quite accurately, but that does mean that the translated code can sometimes be difficult to read, and isn't necessarily much like what an experienced BBC BASIC programmer would write. Don't be misled into thinking that BBC BASIC code always looks like that!

Installation

Create a suitable directory (e.g. C:\Program Files\QB2BBC\) and copy the QB2BBC.exe file there. You will need administrative privileges to copy the file and when you execute it for the first time (in Windows Vista™ and Windows 7™ use 'Run as administrator'); however it can be run from a normal user account thereafter.

You can, if you wish, create a desktop shortcut to the program by right-dragging the QB2BBC.exe file to your desktop and selecting 'Create shortcut here' from the menu that appears when you release the mouse button. You can create a shortcut in your Start Menu in a similar way.

Limitations

Although QB2BBC can successfully translate most QBASIC programs, there are a few limitations caused either by Windows or by BBC BASIC, including:
  1. A maximum of 8 open files is supported. If the QBASIC program uses channel #9 or higher an error will occur when the BBC BASIC translation is run.

  2. The only graphics line style supported is 'dotted'.

  3. Flashing text is not supported. Colour numbers greater than 15 are evaluated 'MOD 16'.

  4. The SCREEN function cannot return a character's colour attributes.

  5. PEEK, POKE and CALL ABSOLUTE are disabled for safety (they would be likely to crash BBC BASIC). PEEK returns zero.

  6. ERASE clears the contents of an array, but does not free its memory.

  7. LOCK and UNLOCK have no effect.

  8. You cannot (safely) jump out of loops using GOTO.

  9. The size of a user-defined TYPE (and hence the size of a file using such records) may be different from what it would be in QBASIC (e.g. single-precision numerics are 5 rather than 4 bytes; strings are one byte longer because of the NUL-terminator).

  10. ON PEN, ON STRIG, PEN, STRIG, IOCTL, WAIT, PMAP, PALETTE USING and POINT(n%) are not supported.

  11. RESUME and RESUME NEXT resume execution at the line (not statement) in or after the one in which the error occurred.

  12. CLS clears only the text viewport (it is equivalent to CLS 2).

  13. PAINT does not support the tile$ or background$ options.

  14. The graphics GET and PUT operations require arrays large enough to contain 4 bits-per-pixel.

Operation

When you start QB2BBC you are presented with a full-screen window (you can re-size it if you wish) containing the normal features which make up the Windows™ Graphical User Interface: a title bar, a set of drop-down menus, a toolbar and a status bar. The main part of the screen is split into two panes: the left-hand pane is where the QBASIC program appears (and can be edited) and the right-hand pane is where the BBC BASIC translation appears (which is read-only). Both panes can be scrolled horizontally and vertically as necessary.

The title bar

The title bar contains the name of the application (QB2BBC), the name of the current QBASIC program (or 'untitled' if the New command has been issued), a minimise button, a maximise button and a close button. If you right-click in the title bar you will get a context menu containing the Restore, Move, Size, Minimize, Maximize and Close items.

The menu bar

The menu bar contains the drop-down menus File, Utilities, Options, and Help. These menus may be activated by clicking on the appropriate menu name or by using a keyboard shortcut (hold down Alt and press the key corresponding to the underlined character).

The toolbar

The toolbar provides easy access to the most common commands, without having to select them from the drop-down menus, simply by clicking on the appropriate button. The commands for which buttons are provided are as follows:

From the File menu: New, Load and Save.
From the Utilities menu: Translate and Run.

The status bar

When a menu item is highlighted, the status bar displays a brief description of the function of that command. Otherwise, the status bar displays the version number and copyright information.

The File menu

The File menu contains the items New, Load, Save and Exit. The File menu can be accessed by clicking on its name in the menu bar or by means of the keyboard shortcut Alt-F.

New

The New command deletes the current QBASIC program from memory, giving you a 'clean sheet' into which to load or type a new program.

Load

The Load command loads a QBASIC program into memory. The file must be in plain text (ASCII) format and should ideally have been saved from QBASIC, since that guarantees that it will be formatted appropriately (e.g. have CAPITAL keywords). The file will normally have the extension .BAS.

Save

The Save command saves the translated BBC BASIC program. The file is saved in internal (tokenised) format suitable for loading into BBC BASIC for Windows and will normally have the extension .BBC.

Note that no method is provided for saving the QBASIC program (for example if it has been edited). If you need to save the contents of the left-hand pane right click on that pane (or press Shift+F10 when the pane has keyboard focus), select Select all from the menu, right-click again, then select Copy from the menu. You can then paste the copied text into (for example) Notepad and save it to file from there.

Exit

The Exit command quits from QB2BBC and closes its window.

The Utilities menu

The Utilities menu contains the items Translate and Run. The Utilities menu can be accessed by clicking on its name in the menu bar or by means of the keyboard shortcut Alt-U.

Translate

The Translate command translates the QBASIC program into BBC BASIC. If an error is detected, or if the program cannot be translated for any reason, a message will be displayed and the statement that resulted in the error highlighted.

Run

The Run command runs the BBC BASIC program. If no program has been created (i.e. the right-hand pane is empty) the command opens an 'immediate mode' window into which BBC BASIC statements may be entered for immediate execution.

The Options menu

The Options menu contains the items Syntax Colouring, Indentation and Set Font. The Options menu can be accessed by clicking on its name in the menu bar or by means of the keyboard shortcut Alt-O.

Syntax Colouring

The Syntax Colouring setting causes keywords, strings, REMarks and labels to be coloured in the right-hand pane. Clicking on this item toggles between the setting being enabled (indicated by a tick mark) and disabled.

Indentation

The Indentation setting causes FOR...NEXT loops, REPEAT...UNTIL loops, WHILE...ENDWHILE loops, CASE...ENDCASE constructs and multi-line IF...ENDIF clauses to be indented, making program structure easier to follow. Clicking on this item toggles between the setting being enabled (indicated by a tick mark) and disabled.

Set Font

The Set Font command allows the font used in the two program panes to be selected. The font defaults to the System Fixed Font (FixedSys).

The Help menu

The Help menu contains the items Help Topics, and About. The Help menu can be accessed by clicking on its name in the menu bar or by means of the keyboard shortcut Alt-H.

Help Topics

The Help Topics command displays this Help documentation.

About

The About command displays information about QB2BBC, including the version number.


Best viewed with Any Browser Valid HTML 3.2!
© Richard Russell 2012