Contents | < Browse | Browse >

M2 Compiler
_________________________________________________________________________


The compiler version documented here is:
M2 M68K Compiler 2.5-AOS4-Pre-Release (21.1.2005)
Copyright (c) 2004 by Tom Breeden

Compiler Switches

Run time checking control
-r Range Chk = checks of indexing, subrange, implied type conversions.
-v Overflow Chk = checks of arithmetic operations.
-y Strict ISO = to disallow non-ISO syntax.

All switches start with a dash (minus). The boolean switches should be explicitly specified on or off by a following plus or minus character.
e.g, "-r-" or "-r+"

Code Generation Control
-x <num> Optimize Level (MUST BE 7 (or 0) CURRENTLY)
-l Global Direct Addr, ie don't use A4 to address module global variables

Debugging and Information
-g Generate Ref File
-V Verbose
-T Trace (compile progress)

Import and Output Control
-o <str> Out Files Dir
-s <str> Sym Files Dir - "M2L:" will always be searched.
-k Clr Module Key - compile to an unchecked module key, 0

Settings of compiler resource sizes
-h <num> Heap Size
-i <num> Ident Buf Size
-a <num> Adr Reloc Buf Size
-b <num> Const Buf Size

Embedded switches

Range checking and overflowchecking can be turned on and off within the source code by using the construct (*$R+) or (*$V+) and (*$R-*) or (*$V-*). No space should be left between the "*" and the "$".

(*$D+/-*) = Turn on/off non-var Dynamic Array copying

Library Auto-Open

The startup code always opens the five libraries dos, graphics, intuition, and layers (as well as setting System.ExecBase).

Nearly all other modules that use a shared library will open that library in the module initialization code (and close it in the termination code), so you usually will not have to call OpenLibrary in your code.

Direct AmigaLibrary Calls

As a language extension, additional material can be added between square brackets in a procedure declaration at level 0 to specify a special calling mode for standard Amiga shared libraries.

These brackets should be placed between the keyword PROCEDURE and the procedure's name in the declaration. Within the brackets must appear four items, separated by comma:

first, the literal string "ALIB"
second, a literal string specifying registers for parameter passing
third, a reference to the variable that is to be used as the library base upon opening the library.
fourth, a negative integer which is the procedure's offset in the shared library.

An example declaration:

PROCEDURE ["ALIB", "A0,A1,D0,A2", System.ExecBase, -30] ThisProc(VAR P0:Data; P1:DataPtr; P2:INTEGER; VAR P3:INTEGER);

Each parameter is associated sequentially with a register in the register list string. VAR parameters have their address put into the register. Non-VAR parameters cannot be structured types or REAL.

The library base variable must be of type compatible with ADDRESS and either be imported or declared earlier.

Module Keys

The module version key was changed from a 48 bit timestamp to a 32 bit "Fletcher" type checksum. The extra bits are currently zeroed.

The checksum is only calculated on significant characters in the DEF file, ie it does not include spaces or tabs (unless in a literal) or comments, so a DEF file can be reformatted graphically and comments added/changed and it will still compile to the same key value.


Other compiler info

A null char is placed at end of every literal string.

SYSTEM module    Type low-level information and extensions

Limitations

maximum code size for any one module is 32766 bytes.
no tagged NEW/DISPOSE
no LONGREAL Constants
no localization

.