<<Previous

Next>>

3. Command Line Options

3.1. Usage

The PICBASIC™ Compiler can be invoked from the DOS command line using the following command format :

PBC Options Filename

Zero or more options can be used to modify the manner in which PBC compiles the specified file. Options begin with a minus ( '-' ). The character following the minus is a letter which selects the option. Additional characters may follow if the Option requires more information. Each Option must be separated by a space though no spaces may occur within an Option. Any Option not recognized by PBC will generate a fatal error.

The first item not starting with a minus is assumed to be the filename. If no extension is specified and the -Q option is not invoked, the default extension .BAS is used. If a path is specified, that directory is searched for the named file. Regardless of where the source file is found, files generated by PBC are placed in the current directory.

By default, PBC automatically launches the assembler (PM.EXE) if the compilation is performed without error. PBC expects to find PM.EXE in the same directory as PBC.EXE. If the compilation has errors or the -S option is used, PM is not launched.

If PBC is invoked with no parameters or filename, a brief help screen is displayed.

3.2. Options

Option

Description

C

Suppress PBC Extensions

D

Generates Listing, Symbol Table, and Map File

L

Generates Listing

OB

Generates Binary rather than Merged Intel HEX

P##

Specify Target (e.g. PIC16F84)

Q

Forces use of explicit extension for Source Name

S

Skips execution of Assembler when done

† Option is passed directly to PM, if invoked after compilation.

3.2.1. Option -C

In order to given the user options in extending the PBASIC language, PBC provides some additional capabilities above and beyond the original specifications for PBASIC. Commands such as PEEK and POKE, inline assembly, the CALL statement, and additional variables (W7 through W39 and B14 through B79) are language extensions. The -C option disables these extensions, forcing strict compatibility with original PBASIC on the program being compiled. Using any of these extensions with -C will generate errors.

This option is useful mainly for programs developed on the BASIC Stamp I which may have variable names which conflict with extension keywords.

3.2.2. Option -D

The -D option causes the assembler to generate a symbol table, a listing and a map file in addition to the normal executable image. See the PICmicro Macro Assembler's manual on disk for more information on the -D option.

3.2.3. Option -L

The -L option causes the assembler to generate a listing in addition to the normal executable image. See the PICmicro Macro Assembler's manual on disk for more information on the -L option.

Unlike PM, PBC's -L option doesn't allow the user to select an arbitrary name for the listing file.

3.2.4. Option -OB

The -OB option forces the assembler to generate the program's executable image as binary rather than the normal Merged Intel HEX. See the PICmicro Macro Assembler's manual on disk for more information on the -OB option.

3.2.5. Option -P##

By default, PBC compiles programs for the PIC16C84. PBC accomplishes this by adding the following line to the beginning of generated programs:

include "B16C84.INC"

The -P option can be used to select another target from the PICmicro family. For example:

PBC -p16C622 filename

would generate this line at the start of the program:

include "B16C622.INC"

This would allow the generated program to assemble and run on a PIC16C622. Check the INC directory for available B*.INC files.

3.2.6. Option -Q

Normally, when no extension is explicitly specified for the source filename, the default extension .BAS is used. The -Q option prevents this and forces the programmer to explicitly define the extension (if any) of the source filename.

3.2.7. Option -S

Normally, when PBC successfully compiles a program, it automatically launches the assembler. This is done to convert the assembler output of PBC to an executable image. The -S option prevents this, leaving PCB's output in the generated .ASM file.

Since -S prevents the assembler from being invoked, options that are simply passed to the assembler (-D, -L, and -OB) are effectively overridden by -S.

<<Previous

Next>>