<label> MAIN [EXPORT]
Operation: Define the beginning of a main procedure module.
Each program should contain one and only one MAIN proc-
edure. Designating a procedure as MAIN tells the linker to
enter it as the first entry in the jump table (i.e. it is the
first code to be executed when the program is loaded). If
no main procedure is specified within a project, program
execution begins with the first instruction in the first file.
If more than one main procedure is defined, an error will
result. A main procedure must be followed by an associated
ENDMAIN directive specifying the end of the procedure dec-
laration. The optional EXPORT command tells the assembler
and linker that the procedure should be visible to other files.
Although instructions and data don’t have to be contained
in a module, it is recommended for two reasons. First,
local labels (beginning with a “@”) can be defined within
a module. These labels will be visible only within the
scope of the module definition. Second, the linker will
insert MacsBug symbols representing each module name.
This makes disassembly within MacsBug more readable.