Command Line Parameters

About the Command Line Parameters

    GCBASIC [/O:output.asm] [/A:assembler] [/P:programmer] [/K:\{C|A}] [/V] [/L] [/NP] filename

    GCBASIC [/O:output.asm] [/A:assembler] [/P:programmer] [/K:{C|A}] [/V] [/L] [/WX]  [/NP] filename

    GCBASIC /version
Switch Description Default

/O:filename

Sets the name of the assembly file generated to filename.

Same name as the input file, but with a .asm extension.

/A:assembler

Batch file used to call assembler(1). If /A:GCASM is given, Great Cow BASIC will use its internal assembler.

The program will not be assembled

/P:programmer

Batch file used to call programmer(1). This parameter is ignored if the program is not assembled.

The program will not be downloaded.

/K:{C|A}

Keep original code in assembly output. /K:C will save comments, /K:A will preserve all input code.

No original code left in output.

/V

Verbose mode - compiler gives more detailed information about its activities.

-

/L

Show license and exit.

-

/NP

Do not pause on errors. Use with IDEs.

Pause when an error occurs, and wait for the user to press a key.

/WX

Force compiler to ensure all include files are valid.

 

/version

Shown build date and version of the compiler.

 

/S

Load the settings from a specified file, rather than use the defaults.

 

filename

The file to compile.

-

(1) For the /A: and /P: switches, there are special options available. If %FILENAME% is present, it will be replaced by the name of the .asm file. %FN_NOEXT% will be replaced by the name of the .asm file but without an extension, and %CHIPMODEL% will be replaced with the name of the chip. The name of the chip will be the same as that on the chip data file.

A batch file to load the ASM from Great Cow BASIC into MPASM. Command line should be like this:

    C:\progra~1\microc~1\mpasms~1\MPASMWIN /c- /o- /q+ /l- /x- /w1 %code%.asm

A batch file to compile in Great Cow BASIC then load the ASM from Great Cow BASIC into GPASM. Command line should be like this:

    gcbasic.exe %1 /NP /K:A /A:"..\gputils\bin\gpasm.exe %~d1%~p1%~n1.asm"

To instruct MAKEHEX.BAT to use GPASM. You have GPUTILS installed. The batch file should be edited as follows:

    REM Create the ASM
    gcbasic.exe /NP /K:A %1
    REM Use GPASM piping to the GCB error log
    gpasm.exe "%~d1%~p1%~n1.asm" -k -i -w1 >> errors.txt

To summarise, you can use any of the following:

    gcbasic.exe filetocompile.gcb /A:GCASM /P:"icprog -L%FILENAME%" /V /O:compiled.asm

Great Cow BASIC will compile the file, then assemble the program, and run this command:

    `icprog -Lcompiled.hex`

You can also create/edit the gcbasic.ini file :

    'Assembler settings
    Assembler = C:\Program Files\Microchip\MPASM Suite\mpasmwin
    AssemblerParams = /c- /o- /q+ /l+ /x- /w1 "%FileName%"

    'Programmer settings
    Programmer = C:\Program Files\WinPic\Winpic.exe
    ProgrammerParams = /device=PIC%ChipModel% /p "%FileName%"

This example will use MPASM to assemble the program. It will run the program specified in the assembler = line, and give it these parameters:

    `/c- /o- /q+ /l+ /x- /w1 "compiled.asm"`

Then, it will run the programmer, and give it these parameters when it calls it:

    `/device=PIC16F88 /p "compiled.hex"`

%ChipModel% will get replaced with the chip you are using, so this the chip Great Cow BASIC will pass to WinPIC.