[fa.info-mac] More on the Megamax C compiler/assembler

info-mac@uw-beaver (01/30/85)

From: erik%ucbssl.CC@Berkeley (Erik Kilk)



I have had a swarm of questions about the Megamaz C compiler.  Let me
see if I can answer all of them here.

First, it does work with a 512 or 128k mac.  I'm using a 512k mac.  On
a 128k it claims it will use the screen memory while compiling if it
needs it. It's inline 68000 assembler will stay in memory on a 512
but be swapped in and out on a 128 as you switch from assembly or
"C". 

It comes with Apple's general purpose editor, a C librarian, a linker,
a dissassembler, a code improver (this munches on your object file, I
haven't used this much), a resource maker, and the compiler/assembler.You
can switch between these programs without going back to the desktop.

It seems to run extremely fast.  When I called to make my order, I
was asked where I heard about the compiler.  I said on INFO-MAC.  I
said the reviews on your execution speed were good, and he said that
speed was their high point. 

About the toolbox.  You'll need access to Inside Macintosh.  It uses
the exact same names as Lisa Pascal as mentioned in Inside Macintosh.
You don't use any extra things.  Included with the compiler are several
demo program.  One is the "edit" program listed as a demo in Inside
Macintosh.  Except for the "C" vs Pascal syntax, it is the same, and
uses the same toolbox calls.  There are about 20 or so .h (header) files
which take only 1 to 2k each.  These are grouped by the chapters of
Inside Macintosh.  These header files define the various data structures
and constants
used by Inside Macintosh.  For example, the type "point" for the quick
draw chapter is defined in qd.h.  All the constants mentioned in
Inside Macintosh for such things as window parameters and event types
are in these header files.  Just as you have to say "uses quickdraw"
from Lisa Pascal, you have to say "#include <qd.h>" from Megamax C.
Inside Macintosh packages are included.

About using 68000 assembly.  In your source file, you place where any
"C" statement would go the structure:
		asm {
		      any number of lines of
  		      standard 68000 assembly code
		    }	
if you want to assemble code.  You can access all your C variables and
ofcourse have all the 68000 assembly addressing.  One neat thing you
can say is:  addq.w # 5 , foo
where foo is a "C" delared variable.  An example is given of writing
a subroutine in high-level "C" and the same thing in assembly code.
Your assemply code uses labels as usual, and the "C" compiler uses
macros as usual.

About the linker.  After you compile your program you get a .o file.
You then use the linker to convert this into a double clickable 
application.  The linker only links in the routines that your program
uses. A small editor program which uses windows, menues, and the text
edit routines (Apple's "edit" demo) took about 10k when it became an
application.  It receives the generic application icon.  You can use
the rmaker program to add your own icon I suppose, but I use the
resource editor (not included.)

The language.  Everything you expect in a "C" language is there.  Most
importantly the long, float, and double data types.  Floating point
uses Apple's floating point packaga automatically.  It does all math
with 80 bit precision internally.  Any toolbox routines which expect
the pascal string type have a hidden conversion routine attatched so
that C strings are used.  (C strings are null terminated, while pascal
strings have their size in the first byte.)  Compile time optimization
is done.  For example, the statement i++ results in only one 68000
instruction.  The statement  c = CONSTANT is also only one 68000 instruc.

The optimizer.  I haven't needed to use this, but it is supposed to
be a post compiler optimizer.  They claim it looks for any small
(long sized) branches and converts them to word braches.  It repeatedly
makes passes through the .o file until two successive passes are
identical. 

If you don't care to use the toolbox routines, you can program with
just the regular "C" i/o library (printf etc.)  If you start using
output without defining your own window, your application will
automatically make a window named "stdout" taking up almost the whole
Macintosh screen.  The ONLY additional routine which isn't either
standard C or Toolbox is _autowin("My Window Name").  This allows
you to name this large default window to something you want instead of
just the "stdout".  

The standard Unix file i/o and memory management tools are available.
These I feel should be in a standard "C" so I don't say they are
extra.  Forexample, fseek works, callot and cfree work (as well as
the toolbox memory management routines.  

Basically, it is like the Unix C compiler with all the Macintosh
tool box routines.  If I get a chance, I'll post a demo source 
listing.

List price is $299.  They charge $15 per update which are announced
in a newsletter.  A free update is being delivered Jan 31, if it
has any neat things I haven't mentioned here, I'll let you know what
it containes.  They will be glad you answer any problems you have,
but for non-problem support, it is $150/year which includes some
updates.