ule. Again, more details about the Mshrink() function are
provided in Chapter 5.
About the Examples
Because it's easy to make GEM calls from C, and because the
language produces programs that are relatively small in size
and quick in execution for a high-level language, it has be
come the language of choice for software development on
the ST. For this reason, most of the examples in this book
will be written in C. On occasion, however, machine lan
guage examples will be included as well, to show how the C
examples may be translated to that environment. The macro
names for the C functions will be used here as they appear
in the official Digital Research GEM header files, since they
have been adopted by the manufacturers of other C compi
lers as well.
The C programs in this book are designed to work specif
ically with the Alcyon C compiler, the compiler officially sup
ported by Atari, and with Megamax C, which also provides a
very complete development environment. For these compi
lers, the int data type refers to a 16-bit word of data. Some
other compilers, such as the Lattice C compiler, use a 32-bit
integer as the default data type. When compiling the pro
grams in this book with such compilers, substitute short for
each reference to int, and keep in mind that the default size
for function returns and constants may be 32 bits instead of
16.
For the sake of simplicity, the portability macros such as
WORD were not used. These macros use the C preprocessor
to define a 16-bit data type that will be valid for any compi
ler. The reader is free to use the macros if they are seen as
more convenient.
The machine language examples were all created with
the assembler included in the Atari development package,
but they should be so generic as to assemble unchanged with
almost any good 68000 assembler.
8
CHAPTER 1