Compiler Options
Options available for the QB45's BC compiler.
Note that these options apply to the BC compiler only. Switches exclusive for PDS or VBDOS are not discussed here.

General syntax:
bc program_name [/options] [, object] [, listfile] [;]



Assembly - Includes the assembly source code in the listing file. A file name must be provided for the list file, or it won't be written.


Array huge - Enable support for dynamic arrays that may exceed 64K in total data size.

Some comments from Mr. Ethan Winer about this switch:

This option affects numeric, TYPE, and fixed-length string arrays only, and not conventional string arrays. Normally, BASIC calculates the element addresses for array references directly, based on the segment and other information in the array descriptor. This is the most direct method, and thus provides the fastest performance and smallest code.

When /ah is used, all access to non-string dynamic arrays is instead made through a called routine. This called routine calculates the segment and address of a single array element, and because it must also manipulate segment values, increases the size of your programs. Therefore, /ah should be avoided unless you truly need the ability to create huge arrays. Even if a particular array does not currently exceed the 64K segment limit, BASIC has no way to know that when it compiles your program.

One limitation that /ah will not overcome is BASIC's limit of 32,767 elements in a single dimension. That is, the statement REDIM Array%(1 to 32768) will fail, regardless of whether /ah is used. There are two ways to exceed this limit: one is to create a TYPE array in which each element is comprised of two or more variables. The other is to create an array that has more than one dimension.


Communications - Specify the size of the receive buffer when writing programs that open the COM port.


Debug - The compiler generates additional code to help debugging. This parameter always makes the compiled programs larger and run more slowly. Therefore, it should be avoided once a program is running correctly.


Error - Needed if the program uses ON ERROR or RESUME with a line label or number.


Microsoft binary format - Converts numbers from IEEE to MBF format when writing values to disk, and viceversa.


stand alOne - Creates a stand-alone executable file that doesn't require the BRUN runtime library to be present.


Row - Stores multi-dimensioned arrays in row, rather than column order.


String - Avoids to combine strings constants at compiling time.

Some comments from Mr. Ethan Winer about this switch:

Using /s affects your programs in two ways. The first is partially described in the BASIC manuals, which is to tell BC not to combine like string constants as it compiles your program. BASIC makes available as much string memory as possible in your programs, by consolidating identical constant string data. For example, if you have the statement PRINT "Insert disk in drive A" seven times in your program, the message is stored only once, and used for each instance of PRINT.

In order to combine like data the BC compiler examines each string as it is encountered, and then searches its own memory to see if that string is already present. Having to store all of the strings your program uses just to check for duplicates impinges on BC's own working memory. At some point it will run out of memory, since it also has to remember variable and procedure names, line labels and their corresponding addresses, and so on. When this happens, BC has no recourse but to give up and display an "Out of memory" error message.

The /s switch is intended to overcome this problem, because it tells the compiler not to store your program's string constants. Instead of retaining the strings in memory for comparison, each is simply added to the object file as it is encountered. However, strings four characters long or shorter are always combined, since short strings are very common and doing that does not require much of BC's memory.

The second (undocumented) thing /s does is to add two short (eight bytes each) assembly language subroutines to the very beginning of your program. Two of the most common string operations are assignments and concatenations, which are handled by routines in the runtime library. Normally, a call to either of these routines generates thirteen bytes of code, including the statements that pass the appropriate string addresses.

The subroutines that /s adds are accessed using a near rather than a far call, and they receive the string addresses in CPU registers rather than through the stack. Therefore, they can be called using between three and nine bytes, depending on whether the necessary addresses are already in the correct registers at the time. The inevitable trade-off, however, is that calling one subroutine that in turn calls another reduces the speed of your programs slightly.

In many cases--especially when there are few or no duplicated string constants--using /s will reduce the size of your programs. This is contrary to the Microsoft documentation which implies that /s will make your programs larger because the duplicate strings are not combined.


Terse - Don't display the copyright notice or any warning (non-fatal) error messages when compiling.

/V and /W

eVent - Required for programs that use event handling, such as ON KEY, ON COM, ON PLAY, or the like (but not ON GOTO or ON GOSUB). These options do similar things, however, the /v switch checks for events at every program statement while /w checks only at numbered or labeled lines.


neXt - Similar to /E, but for RESUME, RESUME 0, or RESUME NEXT; that's it, without a line label or number.

Document compiled by Hexadecimal Disaster.

QbCompilerParams - page last edited 2003-11-13 19:10:15 by (home) (edit)
Blast WIKI - by RoboticBoy - edited and tweaked for our evil purposes by Hexadecimal Disaster