RTR logo

R. T. RUSSELL

BBC BASIC (86) Manual



BBCRUN/BIGRUN

Annex F to
BBCBASIC(86)

Introduction

BBCRUN (BIGRUN) is the BBCBASIC(86) run-only utility which combines your program with a run-only version of BBCBASIC (BIGBASIC) to create a .EXE file. The resulting file may be run from the MS-DOS prompt (or from Windows) just like any other MS-DOS command without it necessarily being apparent that BBCBASIC(86) is involved.

The resulting program has no immediate (command) mode and other programs cannot be LOADed, SAVEd, LISTed, EDITed, etc. However, the CHAIN command is available so programs consisting of multiple modules or overlays are still possible.

When the BBCBASIC program terminates with END or STOP, or simply 'falls of the end', the program is exited and control returned to MS-DOS. Similarly, if an untrapped or untrappable error occurs, the error message is printed and control is returned to MS-DOS.

The following commands do not exist:

AUTO DELETE EDIT LIST LISTO
LOADNEWOLDRENUMBER
SAVEEDIT   
If they are encountered in a BBC BASIC program they cause a 'Syntax error'.

If you wish you can CRUNCH or UNLIST your program as it is combined into the .EXE file. Your original program is not affected in any way.

Precautions

For BBCRUN (BIGRUN) to work correctly the COMSPEC parameter in the environment must point to a valid and accessible version of COMMAND.COM. If it does not, a 'File not found' error will result. On a floppy-only computer, you must ensure that COMMAND.COM is available (by copying it on to your BBCBASIC(86) disk if necessary).

BBCRUN (BIGRUN) uses the PATH parameter in the environment. Unlike MS-DOS (PC DOS), an error will result if any elements of the PATH do not exist or cannot be accessed. If you get a 'Bad directory' error, check that your PATH is valid.

You can find out the current settings for COMSPEC and PATH by typing:

SET<Enter>
at the DOS prompt.


Additional Facilities

User Defined Characters

You have no control over the value of PAGE (the address at which the program resides); it as always &900. Since this means that the final .EXE file incorporates the region normally containing the user-defined characters (&500 to &900) you are given the option of pre-defining these when the .EXE file is built.

The easiest way to create a suitable character font file is to write a short BBCBASIC(86) program to define the characters (using VDU 23...) and then save the memory image with *SAVE USERFONT 500 +400.

For example:

 10 VDU 23,129,24,36,66,255,24,24,24,255
 20 VDU 23,130,24,60,126,255,24,24,255,255
etc
120 *SAVE USERFONT 500 +400
BBCRUN (BIGRUN) simply puts this file in the appropriate place in the final .EXE file.

For testing with BBCBASIC or BIGBASIC, you can *LOAD this file to address 500 by hand.

In order for this font data to be recognised, at least one character must be defined conventionally in the main program using VDU 23; if this is not done, the data in the file will be ignored. In the above example, character 128 would be defined by the program.

Command Line Parameters

In some cases it is an advantage to be able to pass parameters to a program from the command line. The command line (stripped of leading spaces) is available to a run-time program as a 'fixed string' at address &100. This facility is not available with BBCBASIC or BIGBASIC.

To access the command line, the first line of the program should copy this fixed string to a conventional string variable.

10 command$=$&100
This is necessary because &100 is the 'string accumulator' and it is used by BBCBASIC(86) as a scratchpad during the processing of several statements.

Since this line will not be meaningful if executed under BBCBASIC or BIGBASIC, it should be replaced while testing by a line of the form:

10 INPUT command$
When the program has been thoroughly tested the line can be changed prior to executing BBCRUN (BIGRUN).

The string at &100 will contain the entire command tail except for any re-direction or pipe commands (and the /nnn parameter to determine the amount of RAM for BIGBASIC).

If, for example, a program was run with the following command line:

C>DEMO ONE TWO THREE >NUL
The string at &100 would contain 'ONE TWO THREE'. Of course, the >NUL would have no effect unless *OPT 3 is present in the program since BBCBASIC(86) does not, by default, use MS-DOS for console output.


Using BBCRUN

The utility BBCRUN (BIGRUN) prompts you for various things (in particular the name of a BBCBASIC(86) program). BBCRUN (BIGRUN) then builds a composite .EXE file containing the interpreter and the BBCBASIC(86) program, and gives it the same name as the program, but with the extension .EXE rather than .BBC. The original .BBC file is not affected in any way.

The BBCBASIC(86) program is not checked to see whether it contains anything which is incompatible with the run-only version, such as one of the commands mentioned previously. It is up to you to make these checks and you can easily do so using the LIST IF command.

After prompting for the program name, BBCRUN (BIGRUN) asks for the name of the optional font definition file. If you do not want to load a character font definition file, simply press <Enter>. Building a font definition file is described earlier in the User Defined Characters sub-section'.

Next, BBCRUN (BIGRUN) asks whether you want to CRUNCH the program. This is generally a good thing to do, because it both shortens the executable file and makes it run more quickly. The only occasions when you would not want to run CRUNCH are when the program is incompatible with this process, for example if it refers to variables by name in DATA statements or using the EVAL function, or uses calculated line numbers in GOTO, GOSUB or RESTORE statements.

If you answer 'Y' to this prompt, the standard CRUNCH utility is invoked. If CRUNCH.COM is not found in the current search path, an error will be reported and BBCRUN (BIGRUN) will abort without building the .EXE file.

If you have chosen not to CRUNCH your program, you are asked whether you want to UNLIST it. This does not shorten the program or make it run any faster, but may be a useful precaution if you want to make it as difficult as possible for someone else to examine your code; it also eliminates the line numbers from any error messages. If you answer 'Y' to this prompt, the standard UNLIST utility is invoked. If UNLIST.COM is not found in the current search path, an error will be reported and BBCRUN (BIGRUN) will abort without building the .EXE file.

Files Needed

In order to run BBCRUN (BIGRUN), it must be in the current search path.

If you wish to CRUNCH or UNLIST your program, CRUNCH.COM or UNLIST.COM as appropriate must be in the current search path. The computer will also need to be able to find COMMAND.COM. See the Operating System Interface section for an explanation of why and how.

You will also need access to the BBCBASIC(86) program you wish to convert to an executable file. Life is easier if this program file is in the current directory.

Finally, if you wish to add a font definition file, you will need access to it. Once again, it is easier if this file is in the current directory.

Running BBCRUN (BIGRUN)

BBCRUN (BIGRUN) may be run interactively or from the command line. In the interactive mode, you are prompted for the necessary information. In the command line mode, the necessary information is provided in the command line.

Interactive Mode

To run the program, type
BBCRUN<Enter> or BIGRUN /99<Enter>
The program will prompt you with the following lines:
Enter name of BBCBASIC program:
Enter name of user defined character font file (if any):
Do you want to CRUNCH the program?
Do you want to UNLIST the program?
If BBCRUN cannot find any of the files you specify, it will abort with a 'File filename not found' error message without building the .EXE file.

The original program is unaltered even if you asked for the program to be CRUNCHed or UNLISTed. If you asked for the program to be CRUNCHed and CRUNCH.COM is not in the current search path, BBCRUN (BIGRUN) aborts with the 'Crunch failed' error message without building the .EXE file. If you asked for the program to be UNLISTed and UNLIST.COM is not in the current search path, BBCRUN (BIGRUN) aborts with the 'Unlist failed' error message without building the .EXE file.

If a .EXE file with the program name already exists, you will be asked:

File progname.EXE exists, delete it ?
If you answer 'N', BBCRUN (BIGRUN) terminates with the message 'Finished' without building the .EXE file.

When BBCRUN (BIGRUN) has finished it returns to MS-DOS with the message 'Finished'. and the normal MS-DOS prompt is displayed. The file progname.EXE now exists in the current directory and may be run by entering

progname<Enter>
from the MS-DOS prompt.

Command Line Mode

BBCRUN (BIGRUN) can be driven from the command line or from a batch file as shown below.
BBCRUN progname Creates 'progname.EXE' from 'progname.BBC'.
BBCRUN progname /C As above, but the program is CRUNCHed.
BBCRUN progname /U As above, but the program is UNLISTed.
BBCRUN progname fontfile Creates 'progname.EXE' from 'progname.BBC' and incorporates the font definition file 'fontfile'.
BBCRUN progname fontfile /C As above, but the program is CRUNCHed.
BBCRUN progname fontfile /U As above, but the program is UNLISTed.
A comma may be used instead of a space between 'progname' and fontfile. File extensions default to .BBC unless given explicitly.

BBCRUN may be replaced by BIGRUN in the above examples. If using BIGRUN you may have to add an additional /99 to limit the amount of memory used:

BIGRUN progname fontfile /C /99

Left CONTENTS

CONTINUE Right


Best viewed with Any Browser Valid HTML 3.2!
© Doug Mounter and Richard Russell 1999