BBC BASIC for Windows
BBC BASIC is the programming language originally specified and adopted by the
British Broadcasting Corporation for its
groundbreaking Computer Literacy Project of the early 1980s. It was designed
to be simple enough to be used by a complete beginner yet powerful enough to cope
with the demands of the very largest and most complex programs, and that remains
true today. During the intervening years BBC BASIC has been extended and
ported onto at least seven different CPUs and more than thirty different platforms.
BBC BASIC for Windows is an advanced version of BBC BASIC which is fully
integrated into the Microsoft Windows™ operating environment
(Windows 95, 98, Me, NT4, 2000, XP, Vista or Windows 7), providing the programmer with a familiar
language but with an up-to-date user interface. It combines the simplicity of
BASIC with the sophistication of a modern structured language, allowing you to write
utilities and games, use sound and graphics, perform calculations and create complete
Windows™ applications.
Getting Started
If you have never programmed in BASIC before, or you're so rusty that you feel the
need for a refresher course, consider working through the Beginners' Tutorial
which you can find either via the Help Menu or
online.
If you've programmed in BASIC before, but aren't familiar with BBC BASIC, then you might
like to dip into some of the tutorial chapters which cover differences between BBC BASIC
and other dialects. You can also browse this manual or look up particular features which
don't seem to work the way you're used to. The
General Information chapter may be of particular interest.
If you are used to earlier versions of BBC BASIC (on the BBC Micro, on
the Acorn Archimedes or BBC BASIC (86) on a PC) you may find the user
interface somewhat unfamiliar. When you start BBC BASIC for Windows
you are presented with a blank editing window
into which you can
type your BASIC program. Commands such as
Load,
Save,
Chain,
New and
Renumber
are activated by clicking with the mouse on drop-down
menus or (in some cases) toolbar buttons, as is usual for Windows
programs. There are also keyboard shortcuts for all the commands.
Once you have typed in, or loaded, your BASIC program you can run it
by selecting the Run command from the
Run menu or by
clicking on the
button in the toolbar.
A second window will
open in which appears any output from the BASIC program; error messages
also appear here.
If you don't want to run a BASIC program, but simply want to enter commands
for immediate execution (rather like a calculator) then select the
Immediate Mode
command from the Run menu, or click on the
button.
A second window will open into which you can type BASIC
statements, in the same way as you could with previous versions of BBC BASIC.
BBC BASIC for Windows has a Graphical User Interface, including
a BASIC program editor with syntax colouring,
live indentation,
search & replace
and many other features.
Built-in diagnostic aids such as run-time trace,
listing of variables and
single-step
execution make debugging even the most complex programs straightforward.
A unique feature is the incorporation of an assembler which
generates 32-bit code and accepts all 80486 instructions and some Pentium-specific
instructions (except special-register and privileged instructions),
including floating-point and
MMX instructions. You can access the
Windows™ Application Program Interface both from BASIC
and from assembler code,
allowing an experienced programmer to produce sophisticated applications.
The full version provides up to 256 Mbytes of user memory and allows you to create compact
(typically less than 100K) stand-alone executable
(.EXE) files from your BASIC programs,
which will run without BBC BASIC having to be installed and without the need for any
special DLLs. You can distribute such executables freely without any royalty being due.
BBC BASIC for Windows is largely compatible with
Version 5 of BBC BASIC resident in the Acorn Archimedes and Iyonix computers. It also retains
a high degree of compatibility with the BBC Microcomputer, including emulation of the
SOUND statement and the
MODE 7 (teletext) screen mode.
In addition there are a number of major enhancements over these early versions, including
data structures,
an EXIT statement,
PRIVATE variables,
long strings,
NUL-terminated strings,
event interrupts,
an address of operator,
byte variables and arrays,
a line continuation character,
indirect procedure and function calls and
improved numeric accuracy.
BBC BASIC for Windows can be run in a number of ways:
- Select it from the Start Menu (usually Start ... All Programs ... BBC BASIC for Windows).
- Double-click on its desktop icon.
- Double-click on BBCWIN.EXE (usually in C:\Program Files\BBC BASIC for Windows).
- At a command prompt issue the command BBCWIN (assuming that BBCWIN.EXE
is in the current directory, or is on the PATH).
Each of these methods starts BBC BASIC for Windows with an empty
editing window. Alternatively you can
start it and at the same time load a specified BASIC program for editing:
- Drag the BASIC program and drop it on the BBC BASIC for Windows icon.
- Right-click on the BASIC program and select edit from the list.
- At a command prompt enter the command BBCWIN progname
where progname is the name of the BASIC program you want to load
(assuming that BBCWIN.EXE is in the current directory, or is on the PATH).
If you only have the evaluation version substitute BBCWDEM for BBCWIN
in the above instructions.
In order to be able to install and run BBC BASIC for Windows your
system must meet these minimum requirements:
- IBM-compatible PC with 80386DX or later processor.
- 16 Megabytes or more of Random Access Memory.
- VGA or higher resolution display.
- 3 Megabytes or more of free hard disk space.
- Microsoft Windows™ 95, 98, Me, NT4, 2000, XP, Vista or Windows 7 (32-bit);
compatibility with 64-bit versions of Windows™ is not guaranteed.
For correct operation under Windows™ 95 and NT4 it may be necessary
to install Microsoft Internet Explorer version 4 or later.
For the SOUND statement to work correctly,
your processor clock speed should be 133 MHz or higher.
BBC BASIC for Windows meets or exceeds the following specification:
| Memory available for user's program, data and stack |
Default approximately 1 Mbyte, maximum 256 Mbytes (depending on amount of RAM installed) |
| Size of BASIC program | Limited only by available memory (maximum 65535 numbered lines) |
| Length of program lines | Maximum 251 characters (tokenised) excluding line number |
| Integer variables | 32 bits, signed (–2147483648 to +2147483647) |
| Floating-point (real) variables | Default 32-bit mantissa plus 8-bit exponent (±5.9E–39 to ±3.4E38); accuracy
approximately 9 significant figures.
Optionally 53-bit mantissa plus 11-bit exponent (±2.3E–308 to ±1.7E308); accuracy approximately 15 significant figures. |
| String variables | Maximum length 65535 8-bit characters |
| Array variables | Maximum number of dimensions 255, maximum size of each dimension limited only by available memory |
| Number of variables | Limited only by available memory |
| Length of variable names | Limited only by available memory and maximum line length |
| Levels of nesting | Limited only by available memory |
A number of example programs are supplied with BBC BASIC for Windows.
They can be found in the EXAMPLES folder (this is the default file folder following
installation). If you have selected the default location this will usually be
C:\Program Files\BBC BASIC for Windows\EXAMPLES\.
Most of these programs will run using the trial version of BBC BASIC for Windows, although
(depending on which programs you have run beforehand) you may need to restart the application first to
free up memory.
A few of them (notably ASMTEST.BBC, DLGEDIT.BBC, FLIER.BBC, POEM.BBC, SEARCHBBC.BBC, SORTTEST.BBC
and the file-handling demonstrations) require more than the 8K of user memory available with that version.
The example programs are located in sub-folders under the following
categories:
| ANIMAL.BBC |
A 'guess the animal' game which learns from experience (well, almost!). |
| HANOI.BBC |
Solves the 'Towers of Hanoi' problem recursively. |
| RHEOLISM.BBC |
A Tetris-like game in one line of BBC BASIC! |
| SUDOKU.BBC |
Plays and solves the popular number puzzle. |
| ASMTEST.BBC |
A test program for the built-in assembler. |
| ASMTEST2.BBC |
A program to test the assembler with floating-point
instructions. |
| ASMTEST3.BBC |
A program to test the assembler with MMX instructions. |
| ASMTEST4.BBC |
A program to test the extensions supported by the ASMLIB library. |
| ASMTEST5.BBC |
A program to test the extensions supported by the ASMLIB2 library. |
| BANNER.BBC |
Displays horizontally-scrolling news headlines; uses the XMLLIB library. |
| CALENDAR.BBC |
A perpetual calendar, to demonstrate the DATELIB library. |
| MODE7DEM.BBC |
A program to test and demonstrate MODE 7. |
| POEM.BBC |
'Now Press Return', an interactive poem by Roger McGough (© 1981). |
| PROMPTER.BBC |
Smoothly scrolls text up the screen; uses the NOWAIT library. |
| SCROLL.BBC |
A demonstration of scrolling over a large canvas, using @ox%
and @oy%. |
| SHEET.BBC |
A simple spreadsheet program. See the file SHEET.TXT for details. |
| SORTTEST.BBC |
Tests and demonstrates the SORTLIB library. |
| UNICODE.BBC |
Demonstrates BBC BASIC for Windows' multilingual text capability. |
| UNICODEP.BBC |
Demonstrates multilingual text and right-to-left
output to the hardcopy printer. |
| CHAIN.BBC |
A graphics demonstration using
icons with transparent backgrounds. |
| CLOCK.BBC |
A very realistic analogue clock display. |
| DOODLE.BBC |
A simple 'etch-a-sketch' drawing program. |
| ELLIPSES.BBC |
Multi-coloured patterns created from rotated ellipses. |
| FERN.BBC |
A lifelike fractal image produced by a simple formula. |
| FLIER.BBC |
A spacecraft animation. |
| JCLOCK.BBC |
An unusual clock that follows mouse movement. Loosely based on a Javascript program. |
| MANDEL.BBC |
Plots the famous fractal very quickly, using SSE instructions. |
| OPENGL.BBC |
A translation to BBC BASIC of an OpenGL 3D graphics demonstration program. |
| PERSIAN.BBC |
A 'Persian carpet' graphics demonstration. |
| POINTER.BBC |
A demo version of a LOGO like 'turtle graphics' language. |
| POLYGON.BBC |
A graphics demonstration program. |
| PYRAMID.BBC |
A demonstration of 3D graphics using the Direct3D library. |
| SAUCER.BBC |
A simple but effective 3D drawing. |
| SINE.BBC |
Illustrates the 'text at graphics cursor' (VDU 5) mode. |
| SPECTRUM.BBC |
Proves you can display more than 16 colours at once! |
| SPRITES.BBC |
A demonstration of BBC BASIC for Windows
sprites. |
| TEAPOT.BBC |
A realistic 'tumbling teapot' animation, using D3DX8BBC.DLL. |
| WHEEL.BBC |
A rotating colour wheel, showing the use of
*REFRESH to control animation. |
| CDPLAYER.BBC |
Turns your CD-ROM drive into a simple CD player. |
| PIANO.BBC |
A polyphonic 'piano' using the PC's keyboard. |
| POLLY.BBC |
A demonstration of SOUND and
ENVELOPE |
| SPEAK.BBC |
Uses the COMLIB
library to access the Windows™ Text-to-Speech engine. |
| BEEBXFER.BBC |
A utility for transferring files from a BBC Micro. |
| DLGEDIT.BBC |
A 'visual' dialogue box editor, simplifying the design of custom dialogue boxes. |
| FCONVERT.BBC |
A utility for converting Acorn data files. |
| ICONEDIT.BBC |
A simple icon (or sprite) editing program. |
| PROFILER.BBC |
An execution time profiler to help tune programs for maximum speed. |
| SEARCHBBC.BBC |
Searches .BBC files for a specified string. |
| SETTAB.BBC |
Programs the TAB key in the editor to move to a specified column. |
| WMF2EMF.BBC |
A utility for converting .WMF files to .EMF files |
BBC BASIC for Windows differs from BBC BASIC (86) for MS-DOS in the following respects:
-
Line numbers
may be omitted, except where they are required as the destination of a
GOTO,
GOSUB or
RESTORE.
-
Keywords
may optionally be accepted and displayed in
lower-case.
-
The following BASIC V statements are accepted:
- CASE...
OF...
WHEN...
OTHERWISE...
ENDCASE
- CIRCLE
[FILL] x,y,r
- ELLIPSE
[FILL] x,y,a,b
- ERROR n, "string"
- FILL x,y
- Multi-line IF...
THEN...
ELSE...
ENDIF
- INSTALL "libfile"
- LINE x1,y1,x2,y2
- MOUSE x,y,b
- MOUSE ON n
- MOUSE OFF
- OFF
- ORIGIN x,y
- QUIT
- RECTANGLE
[FILL] x,y,dx,dy
[TO xnew,ynew]
- SWAP var,var
- WHILE...
ENDWHILE
- The following BASIC V functions are accepted:
- The following BASIC V operators are accepted:
- The following statements have new forms:
- You can assign a whole array, or set the elements of an array to constant values:
- A() = B()
- A$() = B$()
- A() = 1,2,3
- A$() = "one","two","three"
- You can assign to a sub-string:
- You can access the Windows™ Application Program Interface with the
SYS statement.
- You can use binary constants, e.g. %01011111.
-
The resident assembler
generates 32-bit code and accepts all 80286, 80386
and 80486 instructions (except special-register and privileged instructions). A
few Pentium instructions (notably CPUID) are also accepted.
-
The assembler accepts 'jmp short', 'jmp far' and 'call far' as alternatives to
'jmps', 'jmpf' and 'callf'.
-
The assembler accepts 'byte', 'word' and 'dword' as alternatives to 'byte ptr', 'word ptr' and 'dword ptr'.
If you want to run a program which was originally written for BBC BASIC (86) you can include the
*EGA command in your program; this results in subsequent
MODE statements selecting modes with dimensions
compatible with BBC BASIC (86).
Versions 2.00a and above of BBC BASIC for Windows include a number of
additional features, as follows:
- Drag and Drop editing is implemented.
You can drag and drop a selected (highlighted) block of text either within the editing
pane or between BBC BASIC for Windows and any
other program supporting drag-and-drop. This can be used as an alternative to the clipboard.
- The mouse wheel (if present) can be used to scroll the editing pane, without the
necessity to load a special mouse driver. This requires Windows™ 98 or later.
- An unsaved program is automatically written to disk as a temporary file before it is
executed. If the program crashes BASIC, it will automatically be reloaded the next time
BBC BASIC for Windows is run.
- The List Variables utility has
'proportional' scroll bars.
- Real (floating-point) variables can optionally be selected as 64-bits rather than 40-bits,
using the *FLOAT command. This increases their accuracy
from approximately 9 significant figures to approximately 15 significant figures.
- The built-in assembler can accept
floating-point instructions.
- Floating point indirection is implemented, using the
| symbol.
- An address of operator has been introduced
(similar to C's & operator) using the ^ symbol.
- The LOCAL DATA and
RESTORE DATA constructs are implemented.
Also RESTORE +n is available to set the data pointer
relative to the current line.
- The SUM function works for string arrays as well
as numeric arrays (it returns a concatenation of all the array elements). Also the
SUMLEN function is implemented, to return the
total length of all the strings in an array.
- The compound assignment operators (+=, –= etc.) work with entire arrays;
for example A() += B() adds each element of B() to the corresponding element of A().
- Untrappable errors report in a
Message Box, ensuring they can always be read.
- The Backspace key can be redefined using
*KEY 24.
In particular this allows the key to return the DEL code (127) rather than BS (8) which can
improve compatibility with some BBC Micro programs.
- VDU 23,7 is implemented to scroll the 'screen'
(BASIC's output window) in any direction (up, down, left or right).
- The MODE statement positions the window (when
possible) so that none of it is hidden by the task bar or is off the edge of the screen.
- The GET or INKEY
codes returned by Alt plus a function key can also be generated by the key combination
Ctrl+Shift+<function key>.
Versions 3.00a and above of BBC BASIC for Windows include a number of
additional features, as follows:
Program editor and user interface
- The status bar displays the length of the current program.
- If any of the program is selected (highlighted) Print
defaults to 'print selection'.
- In Trace mode, single stepping into an
INSTALLed module leaves the highlight on the last 'visible' statement.
- In the program editor
CTRL/
and
CTRL/
are word left and word right respectively.
- Find and Replace save
the original scroll position in the go back list, so you can easily
return to the starting point.
- Out-of-sequence line numbers result in an error message if the Run
command is issued.
- The DEF keyword is (optionally)
highlighted in a different colour.
- The Save command issues a warning if the file you are about
to save has been modified by another application since it was originally loaded (for example by another
copy of BBC BASIC for Windows). This reduces the danger of accidentally overwriting a later
version of your BASIC program.
- The Compile command provides extra options: to set the
initial client (rather than window) size and to separately enable different aspects of the
crunch operation.
BASIC interpreter
- The maximum string length is increased from 255 to 65535 characters. This applies to
string variables (string$),
fixed strings ($address) and string
arrays.
- The keyword PRIVATE is introduced. This is syntactically
equivalent to LOCAL, except that the variables hold their values
from one call of the function/procedure to the next. It is similar in operation to the 'C' keyword static.
- LOCAL and PRIVATE
arrays are supported. LOCAL arrays are allocated on the stack, and are
freed when the FN or PROC is
exited. PRIVATE arrays are allocated on the heap, but can be accessed only in the FN/PROC in which
they are declared.
- DIM <numvar> LOCAL <expr> is implemented. This
allocates space from the stack rather than from the heap, and can be used only in a function or procedure.
The space is automatically freed on exit from the FN/PROC in which it was claimed.
- Variables may be passed by reference to procedures and
functions using the RETURN syntax. This also allows a FN/PROC
to return multiple values to the caller, and the creation of variables with names determined at run-time.
- Array arithmetic is implemented, including the dot product
A() = B().C()
Array operations can be cascaded, although higher priority operators (e.g. * and /) must come first:
A() = B() * 2 / C() + 3 - A()
- The MOD function returns the modulus (square-root of the
sum of the squares of all the elements) of a numeric array.
- The assembler will accept the no-operand variants of
fadd, fsub, fmul and fdiv.
- If bit 3 of OPT is set (values 8-15) the assembler will check
the code address (P% or O%) against the value of L%. Hence
DIM P% 100, L% -1
will cause the assembler to issue an error if the code size exceeds 101 bytes.
- In an INPUT statement, or at the immediate-mode prompt,
CTRL/V pastes in the contents of the clipboard (if any).
- MOUSE TO and MOUSE
RECTANGLE are implemented.
- A user-defined mode can have a white background by adding
128 to the final (character set) parameter.
- If OPENIN, OPENUP or
OPENOUT is passed a filename starting with a wildcard (*), the
'Open' dialogue box is displayed.
- The @dir$ system variable returns the directory from which
the program (whether .BBC or .EXE) was loaded. This is very useful when
INSTALLing library files.
Operating System interface
- The command *HARDCOPY is implemented to copy a
graphical region of the screen to the printer.
- The command *REFRESH OFF disables the automatic screen
refresh. *REFRESH ON enables the automatic refresh and *REFRESH forces an immediate refresh. These
can be useful in reducing the flicker associated with an animated display.
- OSCLI (and *) commands which take decimal parameters can
accept negative values.
Compatibility considerations
BBC BASIC for Windows versions 3.00a and later are not 100% compatible with earlier versions.
Although the vast majority of BASIC programs will run correctly without modification, programs which
are affected by the following differences may need to be adapted:
- The string descriptor has a different format, to
accomodate the maximum string length of 65535 characters. Programs can access the string descriptor
via assembly language or by means of indirection.
- The maximum number of characters read from a file by GET$#
is 65535 characters. Some programs may assume that no more than 255 characters will be read.
- When an entire array is made LOCAL, earlier versions leave
the array dimensions unchanged. Versions 3.00a and later leave the array in an undimensioned
state, requiring a DIM to be added within the function or procedure.
- Earlier versions draw dotted and dashed lines with
opaque gaps. Versions 3.00a and later draw them with transparent gaps.
- The function RND(n), where n > 1, returns different values,
which may be apparent if used to produce a specific sequence by means of a seed.
RND and RND(1) are unaffected.
- Earlier versions were tolerant of out-of-sequence line numbers.
Versions 4.00a and above of BBC BASIC for Windows include a number of
additional features, as follows:
BASIC interpreter
- Structures are implemented. Using structures and
arrays of structures you can group together related data items and handle them as a single entity.
- Byte variables are implemented, using the & character
as a suffix. They are particularly valuable as structure members.
- The @lib$ system variable is introduced,
which points to the directory (folder) containing the standard library files. You no longer have to
modify your programs according to where BBC BASIC for Windows was installed.
- The assembler accepts MMX opcodes.
- Backslash (\) is used as a line continuation
character, allowing you to split program lines if they become too long or to improve clarity.
- Setting bit 23 of @% (&800000) causes a
decimal comma rather than a decimal point to be printed.
- END, MODE and
WIDTH may be used as functions (END returns the address
of the first byte above the heap).
- WAIT can be used to pause a program for a specified
number of centiseconds.
- RIGHT$(A$) is shorthand for RIGHT$(A$,1);
LEFT$(A$) is shorthand for LEFT$(A$,LENA$-1).
- The keyword BY is introduced, signifiying that the
coordinates specified in DRAW,
FILL, MOVE and
PLOT are relative rather than absolute.
- RECTANGLE SWAP (also
PLOT 249 and 253) swaps two rectangular areas.
- The array dot product works with 1D as well as 2D arrays.
- In *FLOAT64 mode INT
can be used with values up to ±2^50.
- LOCAL is accepted even after a LOCAL DATA or
ON ERROR LOCAL statement.
Operating System interface
- The *HARDCOPY command may have the destination
parameters omitted, in which case it automatically fits the plot to the page. If all the parameters
are omitted it plots the entirety of BASIC's output window.
- The *LIST command lists to the screen
an internal-format (tokenised) BBC BASIC for Windows program file.
Compiler
- Libraries and other 'resource' files (font files, image files, sound files etc.) can be
incorporated within the executable file, and are
automatically copied onto the destination PC when the program is run.
- The program and any embedded files can optionally be
encrypted, to make it much harder for their contents to be discovered by examining the
executable file.
- Compiled BBC BASIC for Windows executables have a different
default icon from BBC BASIC (.BBC) program files.
- If the crunch operation fails, more detail of the problem is
given and the offending statement is highlighted.
- Executable files generated by the compile utility can be successfully compressed using
packing utilities such as UPX.
Program editor and user interface
- The Printer Font can be specified
independently of the screen font.
- The Run To Cursor command is implemented. This causes
your program to pause as soon as it reaches the line containing the text cursor (caret).
- The following improvements have been made to the right-click Context Menu:
- If the menu is too large it is split into multiple pages. The maximum width and height can be customized.
- ON ERROR, ON SYS etc. are optionally included within the list of procedures and functions.
- Right-clicking on PROC or FN provides a quick means of scrolling to that procedure or function.
- The number of Undo levels is customizable.
- The acceptance of keyword abbreviations (e.g. P. for PRINT) is customizable.
- The initial amount of memory available for user programs is customizable.
- You can specify a default program which is loaded automatically every time BBC BASIC for Windows
is started.
- The Run, Pause and
Step commands have the keyboard shortcuts
F9, F8 and F7 respectively.
- The number of lines scrolled by each 'notch' of the mouse wheel is determined
by the Control Panel settings (on Windows™ NT4, 2000, XP and Vista).
- The Help menu contains a command to take you to the Yahoo™ BBC BASIC
Discussion Group.
Compatibility considerations
BBC BASIC for Windows versions 4.00a and later are not 100% compatible with earlier versions.
Although the vast majority of BASIC programs will run correctly without modification, programs which
are affected by the following differences may need to be adapted:
- Because dot (.) has a new use as a structure member
delimiter, PRINT statements may be interpreted differently. For example the following statement:
PRINT s.3
would be interpreted in versions prior to 4.00a as printing the variable s followed by the numeric
constant 0.3. In version 4.00a and later it would be interpreted as printing the member named 3
of the structure s{}. To restore the original meaning add at least one space between s and .3.
- Because ampersand (&) has a new use as a byte variable
type suffix, PRINT statements may be interpreted differently. For example the following statement:
PRINT a&12
would be interpreted in versions prior to 4.00a as printing the variable a followed by the hexadecimal
constant &12. In version 4.00a and later it would be interpreted as printing the byte variable a&
followed by the decimal constant 12. To restore the original meaning add at least one space between
a and &12.
- Because backslash (\) has a new use as a line continuation character,
it cannot always be used as an assembler comment delimiter.
In such cases change the backslash to a semicolon (;) which is the preferred comment delimiter in 80x86
assembly language code.
- BY is a keyword. Programs using BY as a variable name
may need to be amended (for example change BY to By).
Versions 5.00a and above of BBC BASIC for Windows include a number of
additional features, as follows:
BASIC interpreter
- The shorthand forms LEFT$(A$) and
RIGHT$(A$), equivalent to LEFT$(A$,LENA$-1) and
RIGHT$(A$,1) respectively, can also be used on the left of an equals sign to assign
new values to the appropriate sub-strings.
- The new functions GET(X,Y) and
GET$(X,Y) return the
character at the specified text coordinates.
- The statements ON CLOSE LOCAL,
ON MOUSE LOCAL,
ON MOVE LOCAL,
ON SYS LOCAL and
ON TIME LOCAL are implemented. These can be
used within a function or procedure and restore the previous event trapping (if any) on exit.
- Indirect procedure and function calls
may be made, allowing a program to
determine which procedure or function is called at run time in a more flexible way than is
possible using ON PROC or
EVAL.
- Procedure or function names may be passed as
parameters to procedures and functions.
- The CALL statement can be used with a string
parameter to execute BASIC program code in a specified file. For example, the file may
contain declarations of constants or structure definitions. The code is discarded after it
has been executed.
- The REPORT statement and the
REPORT$ function include the filename of the
CALLed or INSTALLed module in which the last error occurred, if applicable.
- Structure prototypes are implemented. You
can declare a structure, sub-structure or structure-array to have the same members and
layout as a previously-declared structure.
- (Version 5.10a and later only) NUL-terminated
strings may be written and read by means of the $$ indirection operator.
Operating System interface
- The *TEMPO command allows you to set the
units of the duration parameter of the SOUND
statement.
- The *SYS command enables the trapping of
additional Windows™ messages using ON SYS.
- The thickness of straight lines and outline shapes (drawn with DRAW,
LINE, CIRCLE,
ELLIPSE, RECTANGLE etc.)
can be controlled using the system variable @vdu%!248.
Compiler
- The icon selected for the executable file is no
longer restricted to 16-colours and 32x32 pixels.
You can choose an icon which has multiple variants such as 256-colours or 48x48 pixels.
This facility is available only when BBC BASIC for Windows is running under Windows™ NT 4.0 or later.
- You can enable Windows XP Visual Styles for the executable file. Executables
generated using this option will have a more modern appearance when run under Windows™ XP or Vista.
This option is available only when BBC BASIC for Windows is running under Windows™ NT 4.0 or later.
- You can optionally crunch embedded BBC BASIC (.BBC)
program files and libraries, as if they were part of the main program.
- The executable file is stored, by default, in the
exe subdirectory of the directory (folder) containing the source program file.
Program editor and user interface
- Error reporting is improved. If an error occurs at run time (even if trapped with
ON ERROR) the statement responsible is highlighted
in the editor. Hovering the mouse over the highlighted statement causes the error message
to be displayed in a tooltip.
- Windows XP Visual Styles are used, when running under Windows™ XP or Vista.
- The Search menu no longer exists, and the Find and
Replace menu options have been moved to the
Edit menu as is now conventional.
- Indentation can be enabled or disabled 'in one go' with the
Enable Indentation menu option.
- You can Add REMs to, or remove REMs from, every
line in a selected block using a right-click context menu option.
- There are a number of other minor improvements to the user interface, including:
- The Enter key moves the cursor (caret) to the current indent position (unless the
previous line has a line number).
- The File...Load and File...Insert dialogue boxes list .BBC and .BAS files together.
- There are new keyboard shortcuts.
- The Customize dialogue box has a
'browse for default file' button.
- File...Insert doesn't change the current directory.
Compatibility considerations
BBC BASIC for Windows versions 5.00a and later are not 100% compatible with earlier versions.
Although the vast majority of BASIC programs will run correctly without modification, programs which
are affected by the following differences may need to be adapted:
- The size of the rectangle cleared by CLG, in the AND, OR,
Exclusive-OR and Invert plotting modes, has been corrected.
Programs which relied on the previous (incorrect) size may need to reduce the height and width
of the graphics viewport by one pixel.
- The shift operators <<, >> and >>>
no longer evaluate the shift count modulo-32. For shift counts greater than 32, results may well be
different.
- Trailing commas in structure declarations are no
longer permitted. For example the declaration DIM struct{a,b,} will result in a Mistake error.
- You may need to move a previously-compiled executable into the exe subdirectory for
the compile options to be read.
Versions 5.50a and above of BBC BASIC for Windows include a number of
additional features, as follows:
BASIC interpreter
- EXT# may be used on the left of the equals sign to set the file's
length.
- QUIT takes an optional parameter that determines the program's exit
code when compiled to a standalone executable.
Operating System interface
- WM_HELP, WM_CONTEXTMENU and WM_HOTKEY are added to the set of
messages intercepted by *SYS 1.
- The AnimateWindow API function is supported.
Compiler
Program editor and user interface
- Compatibility with Windows Vista™ is improved.
- More highlighting options are available when printing a program.
- The program's output window has a different icon from the IDE window,
so they are more easily distinguished in the task bar.
Versions 5.60a and above of BBC BASIC for Windows include a number of
additional features, as follows:
BASIC interpreter
- The EXIT FOR, EXIT REPEAT
and EXIT WHILE statements are implemented.
- Variable names may now start with the keyword OF.
- Limited support for labels has been added,
to aid conversion from other BASIC dialects (e.g. QBASIC).
Compiler
- The REM!Keep compiler directive can additionally
be used to prevent abbreviation of procedure and function names.
- Crunched libraries can successfully call procedures and
functions in the main program.
- Compiled executable files are now compatible with receiving a digital signature.
Program editor and user interface
- The Step Line debugging facility is implemented.
- The REM!Eject directive will force a new page when the program is printed.
- The Save As command automatically changes the file's extension
to suit the selected file type.
- Confirmation is requested if an attempt is made to exit the IDE when
the output window is still open.
Compatibility considerations
- EXIT is now a keyword, so programs using it as a variable name
(similarly EXIT%, EXIT$ etc.) will need to be modified if re-tokenised, i.e. edited or
imported as plain text.
- The OFF keyword must always be followed by a valid statement
separator, e.g. a colon or end-of-line.
- If the Crunch embedded files option is used, all modules
imported with INSTALL must be embedded in the executable to
ensure consistent procedure and function names.
Versions 5.70a and above of BBC BASIC for Windows include a number of
additional features, as follows:
BASIC interpreter
- The function DIM(struct{}) returns the
size of the structure, in bytes.
- The construction struct.array&() refers to the NUL-terminated string
stored in that structure member, i.e. it is equivalent
to $$^struct.array&(0).
- LOCAL arrays are DWORD-aligned, i.e. the first element is
stored at an address which is a multiple of four.
Operating System interface
- The system variables @ox% and @oy%
contain the offset (in pixels) between the 'output bitmap' and the window contents.
- The width of the text cursor (caret), in pixels, can be controlled using the VDU
variable @vdu%!252.
- The *FONT command can select a 'symbols' font
like WingDings.
Program editor and user interface
- When printing a program listing, blank lines at the
top of a page are suppressed.
- You can drag-and-drop program files from Windows™ Explorer or the Search Results window
into the editor. The existing program, if any, is replaced (this works in the same way as Notepad).
Versions 5.80a and above of BBC BASIC for Windows include a number of
additional features, as follows:
BASIC interpreter
- 64-bit floating-point (double) constants may be specified in
*FLOAT 40 mode by adding a # suffix, for example 1.23# or PI#.
- The THEN keyword has been extended to aid conversion from
other BASIC dialects (e.g. QBASIC).
VDU emulation
- VDU 23,10,18 now sets the width of the text cursor (caret),
as an alternative to @vdu%!252.
- VDU 23,16 has been implemented to provide enhanced
cursor movement control, e.g. support for right-to-left printing languages.
- VDU 23,23 now sets the thickness of solid lines and
outline shapes, as an alternative to @vdu%!248.
Operating System interface
- Enhanced support for console mode programs
has been provided by means of *INPUT 13
and *OUTPUT 14.
- *OUTPUT 15 now allows output to be redirected to the printer,
for example making it easier to emulate LPRINT.
- High-numbered input/output devices (e.g. COM10: upwards) may now be
accessed directly.
Compatibility considerations
- The place at which text output in VDU 5 mode 'wraps' from one line
to the next may be different from earlier versions. If this is a problem you can probably
compensate for it by using the new cursor
movement control facility.
Versions 5.90a and above of BBC BASIC for Windows include a number of
additional features, as follows:
BASIC interpreter
- The @tmp$ and @usr$ system variables
are introduced, containing the path to the Temporary directory and the user's Documents
folder respectively.
- The @vdu{} structure is introduced, providing a more convenient and flexible way of
accessing the VDU variables.
VDU emulation
Operating System interface
- The OPENIN, OPENOUT
and OPENUP functions now display a file selector
dialogue box when a wildcard character (* or ?) appears anywhere within the file
specification (not just at the beginning).
Compiler
- An error is generated if the cruncher detects an ENDCASE,
ENDIF, OTHERWISE or WHEN not at the start of a program line.
Program editor and IDE
- The TAB key can be programmed to execute a macro (see the SETTAB
example program).
- The Help menu now contains a link to the
Conforums message board.
- The Utilities menu can be customised to run external utilities.
BBC BASIC for Windows is thought to be free from serious bugs,
and it is highly unlikely that it could do any harm to other software or systems.
However there is NO warranty that it will not and its use is at your own risk.
BBC BASIC for Windows is the Copyright © 2001-2012 of R. T. Russell. It
is supplied for use on one computer at a time only. Neither the program nor its
accompanying documentation may be copied for simultaneous use by the
purchaser nor for use by anyone other than the purchaser.
Schools and colleges are granted permission to reproduce
or adapt sections of this manual to support teaching in a classroom context.
The name BBC BASIC is used with the permission of the British Broadcasting
Corporation.
The aPLib compression library is used
with permission. Copyright © 1998-2009 by Joergen Ibsen, All Rights Reserved.
©
Richard Russell 2012