RTR logo

BBC BASIC for Windows

Command and Editing Window



Introduction to the IDE

When you start BBC BASIC for Windows you are presented with the command and editing window. This has the normal features which make up the modern Windows™ interface: a title bar, a set of drop-down menus, a toolbar, an editing pane and a status bar. It is possible to hide the toolbar and/or the status bar by means of selections in the Options menu.

You can move this window wherever you like on your Windows™ desktop, and you can re-size it by dragging one of the corners or sides. The bottom right-hand corner has a special area which makes it easier to resize the window by dragging there. BBC BASIC for Windows will remember the size of the window and set it to the same size when it is next started.


The title bar

Title bar
The title bar contains the name of the application (BBC BASIC for Windows), the name of the current BASIC 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.

If you close the window (by clicking on the close button, selecting Close from the right-click menu or using the keyboard shortcut Alt-F4) you will be prompted to save the current program if any changes have been made.


The menu bar

Menu bar
The menu bar contains the drop-down menus File, Edit, Utilities, Options, Run 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). If any of the menu items are unavailable, they will be 'greyed out' and clicking on them will have no effect.


The toolbar

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. If any of the commands are unavailable the button will be 'greyed out' and clicking on it will have no effect. The commands for which buttons are provided are as follows:

From the File menu: New, Load, Save and Print.
From the Edit menu: Undo, Redo, Cut, Copy, Paste, Find and Replace.
From the Utilities menu: Renumber and Compile.
From the Run menu: Run, Debug, Stop, Pause, Step, Step Line and Immediate.

The final (question mark) button does not correspond to any of the menu commands, but instead activates context sensitive help. If you click on this button, then click on a keyword within the editing pane, a short description of the use and function of that keyword will be displayed.


The status bar

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 is split into eight regions: a message region (which always reads "Press F1 for Help"), the current character encoding, the current length of the BASIC program, the current position of the text cursor (caret) in the editing pane, the current Insert/Overtype status, the current Caps Lock status, the current Num Lock status and the current Scroll Lock status.

Character encoding

The character encoding (ANSI or Unicode) assumed for the current BASIC program, as selected in the Options menu or determined automatically when the program was loaded.

Program length

The length, in bytes, of the currently-loaded BBC BASIC program. This corresponds to the size of the file if the program is saved in tokenised (.BBC) format, and (usually) to the value of TOPPAGE when the program is running.

Cursor position

The current text cursor (caret) position is displayed in the form x,y where x is the horizontal position (the leftmost column is 0) and y is the vertical position (the topmost line is 0).

Insert/Overtype

Pressing the Insert key on the keyboard toggles between insert mode and overtype mode. Overtype mode is indicated by OVR being displayed in the status line; in this mode any character typed will over-write the existing character in that position on the line. The normal editing mode is insert mode, in which any characters typed 'push' the rest of the line to the right to make room.

Caps Lock

Pressing the Caps Lock key on the keyboard toggles the caps lock mode on and off. Caps lock mode is indicated by CAPS being displayed in the status line; in this mode the alphabetic keys (A-Z) generate capital letters, unless the Shift key is held down in which case they generate lower-case letters. When caps lock mode if off, the alphabetic keys generate lower-case letters, unless the Shift key is held down.

Num Lock

Pressing the Num Lock key on the keyboard toggles the num lock mode on and off. Num lock mode is indicated by NUM being displayed in the status line; in this mode the number keys (0-9) in the separate numeric cluster generate numbers, unless the Shift key is held down in which case they generate cursor-movement codes. When num lock mode if off, the numeric cluster generates cursor-movement codes.

Scroll Lock

Pressing the Scroll Lock key on the keyboard toggles the scroll lock mode on and off. Scroll lock mode is indicated by SCRL being displayed in the status line; BBC BASIC for Windows ignores this mode.


File menu

File menu New Load Save Save As Chain Insert Page Setup Print Recent Files Exit

The file menu is concerned with loading, saving and printing BBC BASIC programs, and with exiting from BBC BASIC for Windows. 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 (keyboard shortcut Ctrl+N) deletes the current BASIC program from memory, giving you a 'clean sheet' into which to type a new program. If the previous program was not saved, you are first prompted to save it. If a BASIC program is currently running (i.e. its output window is open) the New command is inhibited.

Load

The Load command (keyboard shortcut Ctrl+L or Ctrl+O) loads a BBC BASIC program into memory. It will accept files in BBC BASIC (86) internal (tokenised) format, in Acorn (BBC Micro or Archimedes) internal format, or in ASCII (plain text) format. The command calls up the Load dialogue box:

Load dialogue

If the previous program was not saved, you are first prompted to save it. If a BASIC program is currently running (i.e. its output window is open) the Load command is inhibited.

Save

The Save command (keyboard shortcut Ctrl+S) saves the BBC BASIC program currently in memory to a file. The filename used is the same as that from which the program was loaded (i.e. the contents of the file are replaced). If the program was loaded from a BBC BASIC (86) or Acorn internal format (tokenised) file it will be saved as a BBC BASIC (86) internal format file (in the latter case you are warned that the file format is being altered). If the program was loaded from an ASCII (plain text) file it will be saved as an ASCII file. You can use the Save As command to override these defaults (a program must be saved in internal format if it is to be loaded at run-time with the CALL, CHAIN or INSTALL statement).

If the program was not loaded from a file (i.e. it was typed in or imported via the clipboard) the Save command will display the Save As dialogue box so you can enter the desired filename and format. If the current BASIC program is unchanged, so it doesn't need to be saved, the Save command is inhibited.

If the file you are about to overwrite has been modified by another application (e.g. another copy of BBC BASIC for Windows) since it was first loaded, the Save command issues a warning. If you continue with the Save operation the modifications carried out by the other program will be lost.

Save As

The Save As command (keyboard shortcut Shift+Ctrl+S) saves the BBC BASIC program currently in memory to a file. You are prompted to select a file name and a file format: BBC BASIC internal (tokenised) format or ASCII (plain text) format. Use Save As rather than Save if you need to change the disk, directory (folder), filename or format to something different from their current values. By default the program is saved to the directory last used for a successful Save As operation (or failing that to the user's Documents folder).

Chain

The Chain command loads a BBC BASIC program into memory and then runs it automatically. It is equivalent to Load followed by Run. If the previous program was not saved, you are first prompted to save it. If a BASIC program is currently running (i.e. its output window is open) the Chain command is inhibited.

Insert

The Insert command (keyboard shortcut Ctrl+I) loads a BBC BASIC program (or part of a program) into memory, but instead of it replacing the current program it is inserted in the program before the line containing the cursor (caret). This line, and subsequent lines, are 'moved down' to make space for the inserted lines.

The effect is similar to the Paste command, except that the inserted lines are read from a file (and may be in any of the formats accepted by the Load command). If a BASIC program is currently running (i.e. its output window is open) the Insert command is inhibited.

Page Setup

The Page Setup command allows you to select the page orientation (portrait or landscape) and set the size of the page margins. These affect the page layout when you print out the current BASIC program using the Print command.

Print

The Print command (keyboard shortcut Ctrl+P) allows you to print out one or more copies of the BASIC program currently in memory. A 'dialogue box' is displayed which allows you to: Syntax highlighting
If you have a colour printer you can choose to highlight the printout in the same colours as are used on the screen (set with the Set Colours command). Alternatively you can choose to highlight the printout using underlining, italics and bold-face emphasis; these work with either a black-and-white or a colour printer.

You can force a 'new page' by including the following statement in your program:

REM!Eject
When the statement is encountered printing will continue at the top of the next page.

Recent files

The nine most-recently loaded files are listed in the File menu, and can be re-loaded simply by clicking on the appropriate entry or by using the keyboard shortcuts Ctrl+1 to Ctrl+9 (or Alt-F followed by the digit 1 to 9). When one of the entries is highlighted, the full pathname of the file is displayed in the Status Bar. If the previous program was not saved, you are first prompted to save it. If a BASIC program is currently running (i.e. its output window is open) the recent files are inhibited.

Exit

The Exit command quits from BBC BASIC for Windows and closes all its windows. If the current program in memory has not been saved, you are first prompted to save it.


Edit menu

Edit menu Undo Redo Cut Copy Paste Delete Select All Find Find Next Replace

The edit menu is concerned with editing or searching the current BBC BASIC program (i.e. the program loaded into memory). The edit menu can be accessed by clicking on its name in the menu bar or by means of the keyboard shortcut Alt-E.

Undo  

The Undo command (keyboard shortcut Ctrl+Z) reverses the effect of the last editing operation (typing, delete, paste, renumber, insert file, replace or drop); the type of operation is indicated in the menu. If there is nothing to be undone, the message "Can't undo" is shown in grey. The maximum number of undo levels is determined by the Customize command.

Redo  

The Redo command (keyboard shortcut Ctrl+Y) reverses the effect of a previous undo command; the type of operation to be re-done is indicated in the menu. If there is nothing that can be re-done, the message "Can't redo" is shown in grey.

Cut  

The Cut command (keyboard shortcut Ctrl+X) transfers any selected text to the clipboard, and deletes it from the program. If no text is selected, the Cut command is inhibited. Once the selected text is in the clipboard, you can Paste it either elsewhere in your BASIC program or into any other application which supports pasting of text from the clipboard. Any previous contents of the clipboard are discarded.

Selected text is highlighted in reverse-video. You can select text in the following ways:

Once a block of text has been selected, you can alter the selection by holding down Shift and moving the cursor. If you want to change the start point of a selection, make the initial selection from right to left or from bottom to top. If you want to change the end point of a selection, make the initial selection from left to right or from top to bottom.

Copy  

The Copy command (keyboard shortcut Ctrl+C) transfers any selected text to the clipboard, but unlike Cut it leaves the text in the BASIC program. If no text is selected, the Copy command is inhibited. Once the selected text is in the clipboard, you can Paste it either elsewhere in your BASIC program or into any other application which supports pasting of text from the clipboard. Any previous contents of the clipboard are discarded.

See Cut for details of how text may be selected.

Paste  

The Paste command (keyboard shortcut Ctrl+V) inserts the contents of the clipboard into the BBC BASIC program at the current position of the text cursor (caret). If the clipboard contains no text, the Paste command is inhibited. You can use Paste to transfer a block of code from elsewhere in your BASIC program, or to insert a block of code which has been placed in the clipboard by any other application. For example you can transfer code examples in the BASIC documentation files into your program by first copying them to the clipboard from the Help window then pasting them at the required place.

Delete

The Delete command deletes any selected text, without copying it into the clipboard. See Cut for details of how text may be selected. The delete command has an identical effect to pressing the Delete key on the keyboard. Text which is deleted can only be recovered by using the Undo command.

Select All

The Select All command (keyboard shortcut Ctrl+A) selects the entire BASIC program. It is useful if you want to transfer the program into another application (e.g. a word processor) via the clipboard

Find  

The Find command (keyboard shortcut Ctrl+F) allows you to search your BASIC program for the occurrence of some specified text. The command opens the Find dialogue box into which you can type the text you wish to search for. You can also specify whether the case (capitals or lower-case) is significant and whether to match only an entire word (i.e. the text must be preceded and followed by non-alphabetic characters):

Find dialogue

To start the search click on Find Next, press the Return (Enter) key or use the shortcut Alt+F. The search begins at the position of the text cursor (caret) when the Find command was issued. If you want to search the entire program, ensure that you move the cursor to the start of the program before issuing the command.

If the specified text is found it is highlighted (i.e. selected) and the cursor is moved to the end of the highlighted region. The display is automatically scrolled so that the selected text is visible. Clicking on Find Next again causes the search to resume from this point and the next occurrence of the text (if any) to be found. If the text is not found before the end of the program the message "Text not found" is displayed; clicking Find Next again causes the search to restart from the beginning of the program.

You can click on Cancel at any time to abort the search and dismiss the dialogue box.

Find Next

Once the Find dialogue box has been dismissed, you can continue to search for the next and subsequent occurrences of the search string by using the Find Next command or by pressing F3. If the text is not found before the end of the program the message "Text not found" is displayed; selecting Find Next again causes the search to restart from the beginning of the program.

Replace  

The Replace command (keyboard shortcut Ctrl+R) allows you to search your BASIC program for the occurrence of some specified text and then, optionally, replace it with some different text. The command opens the Replace dialogue box into which you can type the text you wish to search for and the text you want it to be replaced with. You can also specify whether the case (capitals or lower-case) is significant and whether to match only an entire word (i.e. the text must be preceded and followed by non-alphabetic characters):

Replace dialogue

To start the search click on Find Next, press the Return (Enter) key or use the shortcut Alt-F. The search begins at the position of the text cursor (caret) when the Replace command was issued. If you want to search the entire program, ensure that you move the cursor to the start of the program before issuing the command.

If the specified text is found it is highlighted (i.e. selected) and the cursor is moved to the end of the highlighted region. The display is automatically scrolled so that the selected text is visible. To confirm that you want the text to be replaced click on Replace; this will replace the text and search for the next occurrence of the text (if any).

Alternatively if you do not wish to replace this occurrence of the text click on Find Next. This will skip the replace operation and search for the next occurrence of the text (if any). If the text is not found before the end of the program the message "Text not found" is displayed.

If you are certain that you want every occurrence of the text (from the current point to the end of the program) to be replaced, click on Replace All.

You can click on Cancel at any time to abort the search and dismiss the dialogue box.


Utilities menu

Utilities menu Trace List Variables Renumber Compile Add-ins

The utilities menu contains commands to aid debugging of your BASIC program, to renumber your program and to convert your program to a stand-alone executable file. The utilities menu can be accessed by clicking on its name in the menu bar or by means of the keyboard shortcut Alt-U.

Trace

The Trace command allows you to monitor execution of your program. Selecting this command alternately enables and disables Trace mode, as indicated by the presence of a tick mark next to Trace in the menu. You can enable (or disable) Trace mode either before executing your program or once it is running.

In Trace mode, the program statement which is currently being executed is highlighted, and this highlight moves as your program is running (unless the statement currently being executed is in a CALLed or INSTALLed module). If your program gets stuck in an 'infinite loop', you will be able to see what part of the program is being executed. If your program stops running because of an error (or an END or STOP statement) the last statement executed will remain highlighted for as long as the program's output window remains open, or until you enter a command in immediate mode.

Trace can be used in conjunction with the Pause and Step commands in order to trace execution of your program one statement at a time.

List Variables

The List Variables command opens a window which displays the current values of the variables in your program (variables which have not yet been accessed are not displayed, except for the static variables which are always listed). The displayed values change as your program runs. You can change the size of and/or scroll the List Variables window so that the variable(s) in which you are interested are displayed.

In the case of arrays, the name, number of dimensions and sizes of each dimension are displayed, but the values of the individual elements are not. If you need to monitor the value of an array element, add an appropriate statement or statements to your program to copy the value to a conventional variable.

In *FLOAT64 mode floating-point variable names (also procedure and function names) are shown with a # (hash) suffix.

You can select the List Variables command either before executing your program or once it is running. List Variables can be used in conjunction with the Pause and Step commands in order to monitor the values of variables as your program is executed one statement at a time.

Renumber  

The Renumber command allows you to renumber the lines of your program, or alternatively to remove all the line numbers (except those needed as the destination of a GOTO, GOSUB or RESTORE statement). The command opens the Renumber dialogue box into which you can type the line number for the first line of your program and the increment (step) between consecutive line numbers. Both values default to 10:

Renumber dialogue

Renumbering your program can be useful when debugging, because if an (untrapped) error occurs the line number at which the error occurred is displayed. Once your program is complete and debugged, you may prefer to remove the line numbers so as not to clutter the program listing.

The Renumber command will fail if the specified increment is zero or if the specified values would result in a line number greater than the maximum allowed (65535).

Compile  

The Compile command allows you to create a stand-alone executable file from your BBC BASIC program. Although this is not a true compiler in the traditional sense (your program is still interpreted) the end result is effectively the same. The executable file generated by the Compile command requires only Windows™ to run: it does not require BBC BASIC for Windows to be loaded, nor does it need any DLL files other than those supplied as standard with Windows. You can distribute such executables freely without any royalty for BBC BASIC being due.

The Compile command opens a dialogue box which allows you to choose the name of the executable file, select an appropriate icon, determine the initial window size and choose whether or not to 'sign', 'crunch' or 'encrypt' the program:

Compile dialogue

Executable

The filename of the executable file is set by default to be the same as the name of your BASIC program, but with the extension '.exe' rather than '.bbc' (or '.bas'). However you can change the name and/or the directory path (folder) by typing them directly into the Filename field, by clicking on the Browse button or by using the REM!Exefile compiler directive.

By default the executable file is stored in the exe subdirectory of the directory (folder) containing the BASIC program. This ensures that it is safe to run the executable file without any risk of embedded files, when extracted, overwriting wanted files in the source directory.

A default icon is used unless the specified executable file already exists, in which case the icon is taken from that file. You can change the icon by using the REM!Icon compiler directive or by clicking on the Change Icon button which calls up the Change Icon dialogue box:

Change Icon dialogue

You can choose an icon either from an existing executable file, or from a separate icon file (for example as produced by an icon editor). If a file contains a number of different icons, you can select the one you want to use. Please respect Copyright, and use only an icon which you have generated yourself or have legitimately obtained for this purpose.

If the selected icon contains multiple variants with different resolutions (e.g. 16x16, 32x32, 48x48) and/or different colour depths (e.g. 16 colours, 256 colours) all the variants will be stored in the compiled executable file. The version used will be the one most suited to the current display settings. (This only works when BBC BASIC is running under Windows NT4.0™ or later; under Windows 95, 98 or Me a 32x32 16-colour icon is stored).

You can choose to digitally sign your executable file, if you have a Code Signing Certificate. For this to work, information on the code-signing tool and its parameters must be stored in the Registry, and unless present the checkbox is disabled.

You can choose to encrypt your program and any other embedded files (libraries, fonts, bitmaps etc.); this will make it very difficult for somebody to discover their contents by examining the executable file. However the encryption is not highly secure and you should not rely on it to protect sensitive data.

Selecting the 'encrypt' option also causes your program and any embedded files to be compressed in the executable, which can result in a significant reduction in the file size.

You can choose to create a console application rather than a GUI application. A console application is intended to be run from a command prompt and usually won't have a visible window (with BBC BASIC for Windows a window is always created, but normally it will be hidden). To arrange that console input/output is used by your program it should have the following code near the beginning:

SYS "GetStdHandle", -10 TO @hfile%(1)
SYS "GetStdHandle", -11 TO @hfile%(2)
SYS "SetConsoleMode", @hfile%(1), 0
*INPUT 13
*OUTPUT 14
The program should exit (whether normally or as the result of an error) using QUIT, optionally followed by an exit code. You should always incorporate an ON ERROR statement since otherwise errors will be reported on the (hidden) output window and not be visible.

Appearance

You can set the initial width and height of your program's window, in pixels, by entering the appropriate values in the Compile dialogue box. There is little point in doing this if your program uses the MODE statement to initialise the screen, but otherwise it can be useful to set the window size to suit your application. A width or height value of zero causes Windows to select a default size.
You can choose whether the dimensions you specify apply to the entire window or only to the client area, i.e. that region of the window used for BASIC's output. The latter will often be more useful.

The initial window state can be selected from the drop-down list as Hidden, Normal, Maximised or Minimised. If Maximised is selected, the program will start with the window as large as possible (irrespective of the specified width and height). If Minimised is selected, the program will start with no window (just an icon on the Taskbar). If Hidden is selected your program will neither have a visible window nor an icon in the Task Bar; this is useful for programs which operate in the background and for console mode programs. In all three cases you should normally avoid the use of the MODE statement in your program.

You can enable the use of Windows XP™ Visual Styles by your compiled program. If this option is selected, and your program is run under Windows XP or later (with the default appearance settings), toolbars, status bars, dialogue boxes and other window furniture will have a more colourful and modern style. This selection also improves compatibility with Windows VistaWindows 7™, Windows 8/8.1™ and Windows 10™.

Crunch

You can choose to crunch your program when it is incorporated into the executable file. This reduces the size of the file, often by a significant amount, and increases the speed of execution of your program somewhat. It also makes it more difficult for somebody to discover how your program works. The following options are provided: When any of these options are selected, blank lines are also removed from your program.

When using the Remove REMs and Abbreviate names options you can include verbose comments in your program, and use long descriptive variable names, without the size or performance of the final compiled program being affected. In this way you can accord with good programming practice and make your 'source' program easier to understand and modify.

Although you can normally 'crunch' a program without it having any unwanted side effects, there are a few circumstances when it is incompatible with correct program operation:

If the crunch operation reports an error the offending statement will be highlighted.

Embedded files

If your program uses the CALL or INSTALL statement to load modules, or loads other files at run time (such as graphics files, sound files, font files etc.) you must ensure that the files are available to the compiled program where it expects to find them. This is particularly important if you want to run the program on a computer on which BBC BASIC for Windows is not installed. You can achieve this by putting the files either in the library directory (as identified by the @lib$ system variable) or in the same directory as the program itself (as identified by the @dir$ system variable) and loading them as follows:
INSTALL @lib$+"LIBFILE.BBC"
OSCLI "PLAY """+@dir$+"MIDIFILE.MID"""
SYS "AddFontResource", @dir$+"BBCWIN.FON"
Files loaded this way will automatically be incorporated into the compiled executable file and copied to appropriate locations on the target machine. Files in the library directory will be deleted from the target machine after the program has completed execution; files in the program's directory will be left there.

You can also manually edit the list of embedded files using the Add @dir$, Add @lib$ and Remove buttons. The Remove button deletes all selected (highlighted) entries in the list. You can select multiple files for addition and removal, using the Shift and Ctrl keys in the usual way (there is a limit to the number of files that can be added in one go, but more can be added by clicking on the Add button again). If the specified executable file already exists, the list of embedded files is read from that, so any previous edits will be remembered.

Note that it is not intended that this facility should substitute for a proper installer. If you need to do anything more complicated on installation than copying 'resource' files to the destination PC you should consider using an installer utility. For example see the free Inno Setup program.

You can choose to crunch embedded BBC BASIC (tokenised) program files, as well as the main program. If this option is selected any embedded files with a .BBC extension are crunched as if they were part of the main program. The same crunch options are used, and in the case of the abbreviate names option the same abbreviations are used. This ensures that any variables or structures shared between the main program and external modules, imported using INSTALL or CALL, will remain consistent. You must ensure that all imported modules are embedded, otherwise function and procedure names will not be consistent (unless you use the REM!Keep compiler directive to prevent the names being abbreviated).

Embedded files may come from the @dir$ or @lib$ folder, or a subfolder of either of these. When the executable program is run the necessary subfolder(s) will be created and the file(s) copied there. This can be useful if your program uses many resource files, perhaps sound files or bitmap files, and you prefer not to clutter up your program's folder with them. By creating subfolders called, for example, SOUNDS and IMAGES you can keep your files organised. In your program you could access these files as follows:

OSCLI "PLAY "+@dir$+"SOUNDS\TUNE1.MID"
OSCLI "DISPLAY "+@dir$+"IMAGES\PICTURE.BMP"

Compiler directives

If an existing executable file, from a previous compilation, is found at the specified location it is used to initialise the compiler options. Alternatively you can incorporate compiler directives in your BASIC program, using specially formatted REM statements.

The compiler directives must be entered exactly as shown; they are case-sensitive. They may be included anywhere in your program. In the following list square brackets indicate optional parameters:

Apart from REM!Embed, REM!Fast, REM!Keep and REM!Resource it is not useful to have more than one directive of the same kind; if you do the one that is latest in the program will be used. Generally the REM!Exefile directive (if any) should be the first, since the other compiler options will be initialised from the contents of a previously-compiled file at the specified location, if present.

Here is an example set of compiler directives:

REM!Exefile C:\Documents and Settings\RTR\Desktop\index.exe
REM!Icon C:\Program Files\Help Workshop\hcw.exe, 1
REM!Window 640, 480, client, xpstyle 
REM!Crunch spaces, lines, rems, names, embedded
REM!Embed @dir$+"images\owl.bmp", @lib$+"WINLIB2"
REM!Fast speedy%, critical{}
REM!Keep header$, footer$
REM!Resource @dir$+"resources\manifest.res"

Add-in Utilities

Up to nine add-in (or plug-in) utilities may be available in this menu. The following are installed by default: More information on these utilities, as well as a list of additional utilities available for download, can be found here.


Options menu

Options menu Syntax Colouring Lowercase Keywords Indentation Unicode Toolbar Status Bar Set Font Set Colours Set Printer Font Customize

The options menu allows you to configure BBC BASIC for Windows to suit your own preferences. These preferences are saved on exit from BASIC, and are re-established whenever you run BBC BASIC in the future. 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

Clicking on Syntax Colouring toggles this feature on and off. When Syntax Colouring is enabled all the keywords, REMarks, text strings and line numbers in your program are highlighted in colour. You can change the colours by means of the Set Colours command.

When Syntax Colouring is disabled, all the program is listed in black.

Lowercase Keywords

Clicking on Lowercase Keywords toggles on and off the acceptance of BASIC keywords in lower-case letters. When this mode is enabled all keywords are listed in lower-case (both on the screen and on the printer). A keyword will be accepted on input from the keyboard, or from a file, either in all capital letters or in all lower-case letters. A word consisting of a mixture of upper and lower-case letters will never be mistaken for a keyword.

When Lowercase Keywords mode is disabled, keywords are only accepted in all capitals and are listed in capitals. This mode is the default and is compatible with earlier versions of BBC BASIC.

Indentation

Clicking on Indentation brings up the following sub-menu:

Indentation sub-menu

Selecting each of the options causes the appropriate program blocks to be indented (by two spaces) with respect to the surrounding code. This can make the program structure much clearer, and make it easier to spot mistakes.

Be aware that if you contrive to have (for example) two NEXT statements which match the same FOR statement, or vice versa, the resulting indentation will not be correct. In a well-structured program you would hopefully never do this anyway!

Unicode

Clicking on Unicode alternately enables and disables support for Unicode and bi-directional text in string constants (i.e. enclosed in double-quotes) and REMarks (comments). When enabled, you can directly enter and edit non-ANSI text within the editor, even languages written right-to-left such as Arabic or Hebrew. This feature requires Windows 2000 or later.

Note that Unicode text is encoded as UTF-8 within your program; if you want to display it at run time you will either need to use the UTF-8 option provided by the VDU 23,22 command or use one of the Unicode-enabled Windows™ libraries (WINLIBU, WINLIB2U, WINLIB4U or WINLIB5U).

When a BASIC program is loaded the character encoding used is determined automatically (if possible) and the necessary selection made; if the selection was changed a message is displayed to inform you. If the program is not sensitive to encoding (only 7-bit ASCII characters are present in quoted strings) the selection is not changed. If the encoding cannot be determined (for example both ANSI and UTF-8 strings appear to be present in the program) a warning is issued.

Toolbar

Clicking on Toolbar toggles the toolbar on and off. You can turn the toolbar off if you want to maximise the area available for the editing pane.

Status Bar

Clicking on Status Bar toggles the status bar on and off. You can turn the status bar off if you want to maximise the area available for the editing pane.

Set Font

The Set Font command allows you to select the font style and size for use in the editing pane. The command opens the Set Font dialogue box:

Set Font dialogue

Normally all available fonts are listed; an optional registry setting causes only those fonts which have a fixed pitch (i.e. monospaced fonts) to be included. The default font is the System Fixed Font, which is selected by ticking the Use System Fixed Font option.

Set Printer Font

The Set Printer Font command allows you to select the font style and size used when you print your program using the Print command.

Normally all available fonts are listed; an optional registry setting causes only those fonts which have a fixed pitch (i.e. monospaced fonts) to be included. If no printer font has been selected the screen font is used (if the System Fixed Font has been selected a default printer font is used).

Set Colours

The Set Colours command allows you to select the colours which will be used for highlighting the various syntactical elements in your program (keywords, strings, remarks etc.), if the Syntax Colouring option has been enabled. The command opens the Set Colours dialogue box:

Set Colours dialogue

Selecting the appropriate syntactical element causes the current colour for that element to be identified by means of a box around the colour sample. You can change the colour for that element simply by clicking on the appropriate coloured rectangle, and then clicking on OK or Apply (OK closes the dialogue box, whereas Apply leaves it open so that further changes can be made).

If the selection of 48 pre-defined colours is not sufficient, you can click on Define Custom Colour which allows you to choose a colour from the full range supported by your video hardware and settings.

Customize

The Customize command allows you to customize certain settings according to your personal preferences. The command opens the Customize dialogue box:

Customize dialogue

The Default program box allows you to enter the name of a BASIC program which will be automatically loaded every time BBC BASIC for Windows is started. To ensure that this works correctly whatever the current (Start in) directory, you should enter the full path to the program file (the box will scroll horizontally as required). Alternatively you can browse for the file by clicking on the button with three dots.

The Initial user memory box allows you to set the amount of memory available for loading your BASIC programs (it also determines the initial value of HIMEM when a program is run). The default value is about two Megabytes (2097152 bytes) which should be large enough for all but the very largest programs. Increasing this value more than necessary will cause BBC BASIC for Windows to use extra memory and may affect performance if insufficient RAM is fitted in your PC; it also affects the memory requirements of compiled executables. For best performance always set this value to an exact multiple of four. For a change to take effect you must exit and re-start BBC BASIC.

The Number of undo levels setting determines how many editing operations you can reverse with the Undo command. Increasing this value can result in BBC BASIC for Windows using up much more memory and may affect performance if insufficient RAM is fitted in your PC.

The Accept keyword abbreviations setting controls whether the program editor will accept keyword abbreviations such as P. instead of PRINT. One reason why you might want to turn off this facility is that structure names may be mistaken for abbreviated keywords.

The Maximum number of columns setting determines the maximum width of the right-click context menu. You should set it so the menu always fits on your screen, with the display resolution you are using.

The Maximum number of rows setting determines the maximum height of the right-click context menu. You should set it so the menu always fits on your screen, with the display resolution you are using.

The Include ON statements setting controls whether ON CLOSE, ON ERROR, ON MOUSE, ON MOVE, ON TIME and ON SYS statements appear in the right-click context menu. In any case they only appear when at the very beginning of a program line.

The Show FN/PROC parentheses setting controls whether functions and procedures, which take parameters, are shown in the context menu with a pair of trailing parentheses (brackets). This can be useful when two functions or procedures with the same name are present, but one takes parameters and the other doesn't. Note that if the parameter list is separated from the FN/PROC name by one or more spaces, parentheses will not be shown.


Run menu

Run menu Run Debug Stop Pause Step Step Line Run To Cursor Immediate Mode

The run menu is concerned with running and debugging your BBC BASIC program. The run menu can be accessed by clicking on its name in the menu bar or by means of the keyboard shortcut Alt-R.

Run  

The Run command (keyboard shortcut F9) executes the BASIC program currently in memory. It opens a new window where any output from the program appears, and into which you type any keyboard input the program requires. Error messages also appear in this window. If there is no program currently in memory, Run has the same effect as the Immediate command.

If the program is already running (i.e. its output window is open), Run stops the program and restarts it from the beginning (note the caveat listed under Stop about any ON CLOSE routine not being executed).

If the line numbers (if any) in your program are not in ascending sequence, an error message is displayed and the first out-of-sequence line number is highlighted. You must correct the line numbers, for example by using the Renumber utility, before you can run the program.

Debug  

BBC BASIC for Windows version 6.00a or later only
The Debug command executes the BASIC program currently in memory but immediately pauses it, enables Trace mode and opens the List Variables window. This can be useful when you want to debug the code from the very start rather than using the Run To Cursor command.

Stop  

The Stop command stops the program currently running and closes its window. Stop will normally close the program immediately, whatever it is doing, but if your program is waiting for a Windows API (SYS) function to return, or is executing some assembler code, this may delay the response.

Note that any ON CLOSE routine in your program will not be executed. It is therefore better to use the normal methods of ending your program (e.g. clicking on the Close button) when possible and to use the Stop command only as a last resort.

If the program is not currently running (i.e. its output window is not open) the Stop command is inhibited.

Pause  

The Pause command (keyboard shortcut F8) pauses the currently-executing BASIC program at the start of the next statement. If the program is currently waiting for input (e.g. is executing a GET or INPUT statement) it will enter the paused state once the input has been provided. When paused, the program will produce no output nor accept any input (keypresses will still be put in the keyboard buffer). You can find out where the program has paused with the Trace command and/or examine the current values of the program's variables with the List Variables command.

If the program is not currently running (i.e. its output window is not open) the Pause command is inhibited.

Step  

The Step command (keyboard shortcut F7) allows you to single-step a paused program, one statement at a time. You can monitor the execution of the program with the Trace command and/or follow the changing values of the program's variables with the List Variables command.

If the program is not currently paused, the Step command is inhibited. If you want to single-step through only a specific part of your program, add a TRACE STEP ON statement at that point. Alternatively use the Run To Cursor command.

Step Line  

The Step Line command (keyboard shortcut F5) is similar to the Step command except that all the remaining statements in the current line (and the first statement in the next line) are executed before pausing. This is particularly useful in allowing you to 'step over' a procedure or function call without having to single-step through all its statements, or to 'step out' of a loop without having to single-step through every iteration.

If the program never executes a statement in the next line, it will not pause.

Run To Cursor

The Run To Cursor command (keyboard shortcut F6) behaves the same as the Run command except that the program automatically pauses (as if the Pause command was issued) when it reaches the line containing the text cursor (caret). This is useful if you need to single-step through part of the program but don't want to start at the beginning.

The first (or only) statement in the line containing the cursor is executed before the program pauses. If the program never executes a statement in the line containing the cursor, it will not pause. Once the program is paused, issuing the Run To Cursor command again (or pressing F6) will cause execution to continue from that point; the program will pause again if there are more statements in the line, or if the line is reentered later.

Note that the program will not pause on any of the following lines:

Immediate Mode  

The Immediate Mode command opens the output window but does not execute the BASIC program; instead the BASIC command prompt is displayed. At this prompt you can type BASIC statements which are executed immediately on pressing Return (Enter). For example you can use this facility as a calculator by typing PRINT followed by a sum:
>PRINT 2+2
Immediate Mode can also be useful for doing things like deleting a file (*DELETE), or setting a file to read-only status (*LOCK). When in immediate mode you can execute the current program by typing RUN. If the current program is already running (i.e. its output window is open) the Immediate command will stop the program before entering immediate mode.


Help menu

Help menu Help Topics Tutorial Email Website Discussion Group Message Board Facebook Page Wiki About BBC BASIC

The help menu gives access to the BBC BASIC for Windows documentation, provides links to information via email or from the web, and displays version information. 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 calls up the main help window, from which you can browse or search the BBC BASIC for Windows Help documentation. This command can also be accessed by pressing F1.

Tutorial

The Tutorial command opens the beginners' tutorial in a separate window.

Email

The Email command calls up your default mail program (if any) so that you can send a message to request help or information about BBC BASIC.

Website

The Website command calls up your default web browser (if any) and automatically directs it to the R.T.Russell home page.

Discussion Group

The Discussion Group command takes you to the online BB4W discussion group, where you can seek help and advice, report bugs, download (or upload) useful utilities and learn about new developments in BBC BASIC for Windows.

Message Board

The Message Board command takes you to the BBC BASIC Conforums message board, where you can discuss with other users all aspects of programming in BBC BASIC for Windows, including the use of advanced techniques.

Facebook Page

The Facebook Page command takes you to the BBC BASIC Group on Facebook, where you can ask questions or post pictures and videos.

Wiki

The Wiki command takes you to the BB4W Programmers' Reference Wiki. This is an ever-growing resource of articles on all aspects of programming in BBC BASIC for Windows.

About BBC BASIC

The About command displays the version number of BBC BASIC for Windows and (in the case of the full version) your personal serial number.


The editing pane

The editing pane is where the BASIC program currently loaded into memory (if any) is displayed for viewing or editing, or where a new program is entered. Most of the normal features which you expect from a Windows™ editor are available. You can manipulate and edit the program using the keyboard, mouse and touch screen (if applicable).

Keyboard commands

The following operations are available using the keyboard. Note that references to left and right apply to normal left-to-right text, and may be reversed when editing right-to-left text such as Arabic or Hebrew:

KeyOperation
Insert Toggle between insert and overtype mode. In overtype mode any character typed will over-write the existing character at that position on the line. In insert mode any character typed will 'push' the rest of the line to the right to make room. The insert/overtype status is indicated in the status bar.
Delete This key has an identical effect to the Delete command. If any text is selected (highlighted) it is deleted, without being copied to the clipboard. Otherwise, the character to the immediate right of the cursor (caret) is deleted and the rest of the line is moved left to fill the gap.
Home Move the cursor (caret) to the start of the current program line, and scroll the display horizontally (if necessary) to ensure that the cursor is visible.
Ctrl+Home Move the cursor (caret) to the start of the program, and scroll the display horizontally and/or vertically (if necessary) to ensure that the cursor is visible.
End Move the cursor (caret) to the end of the current program line, and scroll the display horizontally (if necessary) to ensure that the cursor is visible.
Ctrl+End Move the cursor (caret) to the end of the program, and scroll the display horizontally and/or vertically (if necessary) to ensure that the cursor is visible.
Page Up Display the previous 'page' of the program by scrolling the display down by one screenful (less one line) or until the first line of the program is visible, whichever is less. If the first line of the program is already in view, Page Up has no effect.
Page Down Display the next 'page' of the program by scrolling the display up by one screenful (less one line) or until the last line of the program is visible, whichever is less. If the last line of the program is already in view, Page Down has no effect.
Left Move the cursor (caret) one character to the left, and scroll the display horizontally (if necessary) to ensure that the cursor remains visible. If Shift is held down, select (or de-select) a character. If the cursor is already at the beginning of a line, the key has no effect.
Right Move the cursor (caret) one character to the right, and scroll the display horizontally (if necessary) to ensure that the cursor remains visible. If Shift is held down, select (or de-select) a character.
Up Move the cursor (caret) up one line, and scroll the display vertically (if necessary) to ensure that the cursor remains visible. If Shift is held down, select (or de-select) a line. If the cursor is already on the first line, the key has no effect.
Down Move the cursor (caret) down one line, and scroll the display vertically (if necessary) to ensure that the cursor remains visible. If Shift is held down, select (or de-select) a line. If the cursor is already on the last line, the key has no effect.
Backspace Delete the character immediately to the left of the cursor (caret), and move the cursor left one position. The rest of the line, to the right of the cursor, is moved left to fill the gap. If the cursor is at the beginning of a line, delete the preceding 'new line' (and the line number, if any) and concatenate the contents of the present line onto the end of the previous line.
Return (Enter) Insert a 'new line' at the current position of the cursor (caret). Everything to the right of the cursor will be moved onto the next line, and the rest of the program is moved down one line to make space. By this means you can split an existing line into two or more lines
Ctrl+Left Move the cursor (caret) one word to the left, and scroll the display horizontally (if necessary) to ensure that the cursor remains visible. If Shift is also held down, select (or de-select) a word.
Ctrl+Right Move the cursor (caret) one word to the right, and scroll the display horizontally (if necessary) to ensure that the cursor remains visible. If Shift is also held down, select (or de-select) a word.
Tab Normally has no effect, but can be programmed to execute a macro. See the SETTAB program supplied.
Ctrl+Backspace Delete the previous word (i.e. to the left of the cursor) and move the rest of the line left to fill the gap.
Ctrl+Delete Delete the next word (i.e. to the right of the cursor) and move the rest of the line left to fill the gap.

The 'printing' keys (letters, numbers and symbols) cause the appropriate character to be entered at the position of the cursor (caret), and the cursor is then moved right by one position. If anything is selected (highlighted) when the key is pressed, it is first deleted.

Mouse commands

The following operations are available using the mouse:

ActionOperation
Left click Clicking in the editing pane with the left mouse button causes the text cursor (caret) to be moved to the character position nearest to the mouse pointer. If Shift is held down, the region between the previous position of the text cursor and the new position will be selected. If Ctrl is held down the entire line containing the text cursor will be selected.
Left double-click Double-clicking in the editing pane with the left mouse button causes the word under the mouse pointer (and the following space, if any) to be selected. The text cursor (caret) is moved to the end of the selected region. The selected word can then be cut, copied or deleted. If the Find or Replace command is issued, the selected word is copied to the Find What field.
Left drag Holding down the left mouse button and 'dragging' the mouse pointer over the program displayed in the editing pane causes a section of the program to be selected. Dragging the mouse horizontally selects part or all of a line; dragging the mouse vertically selects a block of lines (only entire lines may be selected).
Right click Clicking in the editing pane with the right mouse button causes the Context Menu to be displayed.
Wheel Operating the mouse wheel causes the editing pane to scroll vertically, usually by one line per 'notch'.
Ctrl+Wheel Holding down the Ctrl key and operating the mouse wheel causes the editing pane to zoom; note that this will not work if you have selected the System Fixed Font.

Drag and Drop

If you move the mouse pointer over a selected (highlighted) region of your program, the pointer shape changes to an arrow. In this situation holding down the left mouse button and 'dragging' the mouse pointer initiates a Drag and Drop operation. If you drag the mouse pointer to a different point in your program (outside the selected region), and then release the left button, the selected text will be deleted from its original place and inserted where the button was released. This is equivalent to a cut-and-paste operation via the clipboard.

Alternatively, if you hold down the Ctrl key before releasing the left button the selected text is copied to the location where the button was released (a plus sign appears next to the mouse pointer indicating a copy rather than a move). This is equivalent to a copy-and-paste operation via the clipboard. If you want to cancel the Drag and Drop operation you can do that by pressing the ESCape key before you release the left button, or by releasing the button when the pointer is inside the selected area.

You can also Drag and Drop between BBC BASIC for Windows and any other program supporting that facility. You will often find that a plus sign is shown next to the mouse pointer, even if you are not holding down the Ctrl key. That signifies that you cannot delete the text in the window from which you are dragging it (for example if you drag program examples from the BBC BASIC for Windows Help window).

Context Menu

Clicking in the editing pane with the right mouse button causes the 'floating' context menu to be displayed at the position of the mouse pointer. The context menu contains one or more of the following items: If you have a touch screen you can display the context menu by pressing-and-holding until the square or circle appears. You can also access it by pressing Shift+F10.

Scroll bars

If the current program cannot be displayed in its entirety within the editing pane, vertical and/or horizontal scroll bars are displayed. These allow you to scroll the display until the part of the program in which you are interested is in view. The scroll bars can be operated in the following ways:


Registry settings

The following custom registry settings, which are not accessible via the user interface, are recognised by the IDE. They must be stored in HKCU\Software\R T Russell\BBC BASIC for Windows\Settings (or HKCU\Software\Wow6432Node\R T Russell\BBC BASIC for Windows\Settings in the case of 64-bit Windows):

NameTypeData
ConfirmOnExit REG_BINARY 00: The IDE will not prompt for confirmation on exit (unless the program is unsaved).
01: The IDE will prompt for confirmation on exit if the output window is open (default).
UsePrinter REG_BINARY 00: No check will be made for the default printer when the output window is opened.
01: The default printer will be queried when the output window is opened (default).
FixedPitchOnly REG_BINARY 00: The Set Font and Set Printer Font options will list all available fonts (default).
01: The Set Font and Set Printer Font options will list only monospaced fonts.
SignTool REG_SZ The full path and filename of your Authenticode code-signing tool (if any).
SignParm REG_SZ The parameters required by your code-signing tool (use "%s" for the EXE filename).

Left CONTENTS

CONTINUE Right


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