
{ $Id$ }

Notes about MorphOS version of Free Pascal:

Stack:
========================================================================

Under MorphOS, the default stack is set to 256 kB. Stack size can be set 
directly by the programmer with the compiler switch (-Cs), or with the 
{$MEMORY} directive. The memory area for the stack is dynamically 
allocated on program startup, so if you set this value too high, in low 
memory situations your program may exit immediately on startup without 
any further notice.


Syscalls:
========================================================================

Free Pascal currently supports ABox-style calls for MorphOS. Using 
additional hand-written assembly is not needed to call any ABox library
function. However, you must declare every function you're going to use 
by the following way:

Var 
  my_LibBase: Pointer;

function my_LibCall(param1: longint location 'd0',
                    param2: longint location 'd1'): LongInt; 
         SysCall my_LibBase 1234;

Where my_LibBase is the library base returned by exec's OpenLibrary() 
call, and 1234 is the call  offset. Please note that offset values in 
Free Pascal must be specified as positive values, and not negative as 
shown in MorphOS SDK.
 
The value after location can be any 68k registers from d0-d7/a0-a6. Note 
that a7 and sp cannot be used. Register names are not case sensitive.
In SysCalls you must specify location for every arguments explicity.

MOST IMPORTANT: You must open libraries explicitly _BEFORE_ using any 
functions from it, because the compiler will not do it for you. Don't 
forget to close libraries before you exit. 

Before declaring a SysCall function, please check the units provided
with FPC, the function you want to use might already be declared in one
of the units, and ready to use.


Alignment:
========================================================================

Record elements are aligned to DWORD (4 bytes) under MorphOS. Use 
{$PACKRECORDS 2} if you need word aligned structures. For byte
aligned records, use packed record.


Thanks:
========================================================================

MorphOS port of Free Pascal Compiler was possible, because Genesi 
S.a.r.l. <www.genesi.lu> provided a free Pegasos II/G4 machine to do 
the developments on it. 

{
  $Log$
  Revision 1.1  2004-06-06 18:32:50  karoly
    * initial revision

}
