Introduction MTB Statements File System Compiler Applications Reference Guide Index

Overview Creating MTB Source Programs Compiling MTB Programs Compiler Directives Special Characters

Overview Interactive Mode Command Mode

Interactive Mode

To execute the MTB compiler from the READY prompt of the QMONITOR program, type MTB. The following prompts are displayed:

Command File:

If you are using a command file to control the compiler, enter the command file name, and (optionally) a comma and the Comet directory where the command file is located. For more information on MTB command files, see the Command Mode documentation.

If you are not using a command file, press Enter to proceed to the next prompt.

Source File:

Enter the name of the source program to be compiled. You may enter up to 12 characters (eight for the source file name, one for a comma, and three for the directory where the source file is located). If you do not enter a directory name, the compiler will search through the currently accessed Comet directories for the source file.

If you press the Enter key without typing anything, the program will exit back to the READY prompt of the QMONITOR program.

Object File:

Enter the name of the object program to be created. You may enter up to 12 characters (eight for the object file name, one for a comma, and three for the directory where the object program is to be created). If you do not enter a directory name, the compiler will create the object program on a directory named DSK (if one exists).

Listing File:

Enter the device name where the compiler listing will be printed or displayed. The default listing device is your terminal. (Note: In previous versions of the MTB compiler, the default listing device was the printer named LP1.)

Options:

Enter the compiler options you would like to use. These include the following:

Option Description
B byte-align COMMON
E errors only (default)
S source listing
X create cross-reference file

These options are explained below.

Note that you may use compiler options in three places:

  1. at this prompt
  2. in a command file (i.e., !L T00,S,X)
  3. in the "#MTB" compiler options file (see below for more information).

Above Correct?

If your file names, listing devices, and compile options are correct, type Y and press the Enter key to begin compilation. Otherwise, type N to re-enter the above fields.

Compiler options

The MTB compiler supports several optional parameters. These control memory allocation, the listing device, and the type of listing the compiler will produce. These options may be used in interactive mode (see previous page), in an MTB command file list command (see below for more information), or in the "#MTB" compiler options file (see below for more information).

Option Description
B Byte-align COMMON

The MTB compiler's default method of aligning data elements is based on word boundaries. This function is normally transparent to the user and was included in the original MTB compiler to speed up data retrieval and storage. With today's hardware, word boundaries are no longer a factor in operating speed. Because word alignment could result in an additional byte being allocated for each data element defined, we have added a new option to the MTB compiler.

The "B" option causes the MTB compiler to "byte-align" the COMMON data variables declared in your program. The "B" option reduces memory requirements and also allows you to intermix MTB and QICBASIC object programs (QICBASIC programs use byte-aligned fields).

The default data alignment method for the compiler remains "not byte-aligned." This option lets you override the default.

Caution: Programs using COMMON data fields must all be compiled with the same data alignment method (the default or the "B" option); if not, your programs' COMMON data will be garbled.

E Errors only (default)

The "E" option causes the MTB compiler to produce an errors-only listing when a program is compiled. The "E" option is the default listing option.

S Source listing

The "S" option causes the MTB compiler to produce a source code listing when a program is compiled. If compiler errors are present, they will be printed and underlined with a rows of asterisks.

X Write to Cross Reference File

This option causes cross reference information to be written to data file on the same directory as the source file. The cross-reference file is named "MXREFxxx", where "xxx" is the user's partition number.

The compiler erases "MXREFxxx" and creates a new one each time MTB is invoked by the user, but adds to it when successive compilations are performed using a command file. This permits the user to obtain a comprehensive cross reference of all programs in a system, if desired.

The cross-reference file is a sequential file with 756- byte records. Each record contains 27 entries of 28 bytes each. The entry format is:

Field Size Description
Symbol 8 The symbol or statement label
String flag 1 "$" if a string field, otherwise blank. Note: This byte can duplicate the "$" in the symbol field if the symbol is less than 8 characters.
Sort control 1 0 for symbol definitions, 1 for references

The sort control field will force statement label definitions to the top. This means that the first line number will appear out of order if the statement label is referenced in the program before it is defined.

File name 8 Name of source file or usefile
Line number 7 Editor line number from source file
Type 1 Type of statement or data value,using the following hex values:
F0    FORMAT statement
E0    Executable statement

All other variable types are bit-coded:
01    String 
02    Variable, not constant
04    LOCAL
08    COMMON
0C    Constant (can't be both local and $COM)
20    Array
Precision 1 Field precision. Ignore if non-numeric.
Length 1 Field length. Ignore if statement label, otherwise string length (including length byte) or numeric length.

Compiler options file (#MTB)

You can create a file called "#MTB" (any data file type) and put in overriding options for the compiler. For example, if you want to byte-align COMMON and get an errors-only listing for all of your compilations, the first record in the "#MTB" file should contain the letters "BE".

If you are using an MTB command file for your compilation, the compiler recognizes and combines the options (E,S,O,B,A,X) from your "#MTB" file with those specified in the list command (!L) of your command file.

If you are using the interactive mode, the options contained in "#MTB" will be displayed in the "Options" field.