(******************************************************************)
(**                                                              **)
(**)          DEFINITION MODULE System;   (* 87Dec05 *)         (**)
(**                                                              **)
(**  'System' FOR MC68000/MC68010 runtime support of Modula-2.   **)
(**                                                              **)
(******************************************************************)

(* Copyright 1987,88    Jefferson Software      *)
(* 602/243-3106 voice   12416 N 28th Dr #18-236 *)
(* 602/276-6102 bbs     Phoenix, AZ 85029-2434  *)	

(******************************************************************)
(* 87Dec05          Floating point trap version                   *)
(* 87Nov10          Release version 1.1e                          *)
(* 87Sep18  kbad    added exported UserDebug:PROC                 *)
(******************************************************************)

FROM SYSTEM IMPORT
(*TYPE      *)      ADDRESS;
  
VAR
    UserDebug : PROC; (* for application-specific error handling  *)

(* System procedure numbers used by the compiler:
 * These numbers must correspond with the procedure numbers
 * associated with a specific procedure in the DEFINITION MODULE 'System'.
 * 
 * BodyOfSystem = 0;    (* 0 is reserved for module body        *)
 * HALTX        = 1;    (* System.HALTX  = HALT-statement       *)
 * MULU32       = 2;    (* System.MULU32 = unsigned long MUL    *)
 * DIVU32       = 3;    (* System.DIVU32 = unsig. long DIV/MOD  *)
 * MULS32       = 4;    (* System.MULS32 = signed long MUL      *)
 * DIVS32       = 5;    (* System.DIVS32 = signed long DIV/MOD  *)
 * FADDs        = 6;    (* System.FADDs  = FP ADD single        *)
 * FSUBs        = 7;    (* System.FSUBs  = FP SUB single        *)
 * FMULs        = 8;    (* System.FMULs  = FP MUL single        *)
 * FDIVs        = 9;    (* System.FDIVs  = FP DIV single        *)
 * FREMs        = 10;   (* System.FREMs  = FP REM single        *)
 * FCMPs        = 11;   (* System.FDIVs  = FP CMP single        *)
 * FNEGs        = 12;   (* System.FNEGs  = FP NEG single        *)
 * FABSs        = 13;   (* System.FABSs  = FP ABS single        *)
 * FLOATs       = 14;   (* System.FLOATs = FLOAT single         *)
 * TRUNCs       = 15;   (* System.TRUNCs = TRUNC single         *)
 * FADDd        = 16;   (* System.FADDd  = FP ADD double        *)
 * FSUBd        = 17;   (* System.FSUBd  = FP SUB double        *)
 * FMULd        = 18;   (* System.FMULd  = FP MUL double        *)
 * FDIVd        = 19;   (* System.FDIVd  = FP DIV double        *)
 * FREMd        = 20;   (* System.FREMd  = FP REM double        *)
 * FCMPd        = 21;   (* System.FDIVd  = FP CMP double        *)
 * FNEGd        = 22;   (* System.FNEGd  = FP NEG double        *)
 * FABSd        = 23;   (* System.FABSd  = FP ABS double        *)
 * FLOATd       = 24;   (* System.FLOATd = FLOAT double         *)
 * TRUNCd       = 25;   (* System.TRUNCd = TRUNC double         *)
 * FLONG        = 26;   (* System.FLONG  = FP single to double  *)
 * FSHORT       = 27;   (* System.FSHORT = FP double to single  *)
 *)

PROCEDURE HALTX;    (* argument in register D0 ! *)
  
PROCEDURE MULU32;   (* arguments and quadword-result in regs. D0/D1 ! *)
PROCEDURE DIVU32;   (* arguments and quadword-result in regs. D0/D1 ! *)
PROCEDURE MULS32;   (* arguments and quadword-result in regs. D0/D1 ! *)
PROCEDURE DIVS32;   (* arguments and quadword-result in regs. D0/D1 ! *)
  
PROCEDURE FADDs ( adder, addend : REAL )                : REAL;
PROCEDURE FSUBs ( minuend, subtrahend : REAL )          : REAL;
PROCEDURE FMULs ( multiplicand, multiplier : REAL )     : REAL;
PROCEDURE FDIVs ( dividend, divisor : REAL )            : REAL;
PROCEDURE FREMs ( dividend, divisor : REAL )            : REAL;
PROCEDURE FCMPs ( first, second : REAL );           (* result in CCR *)
PROCEDURE FNEGs ( toNeg : REAL )                        : REAL;
PROCEDURE FABSs ( toAbs : REAL )                        : REAL;
PROCEDURE FLOATs( toFloat : LONGINT )                   : REAL;
PROCEDURE TRUNCs( toTrunc : REAL )                      : LONGINT;

PROCEDURE FADDd ( adder, addend : LONGREAL )            : LONGREAL;
PROCEDURE FSUBd ( minuend, subtrahend : LONGREAL )      : LONGREAL;
PROCEDURE FMULd ( multiplicand, multiplier : LONGREAL ) : LONGREAL;
PROCEDURE FDIVd ( dividend, divisor : LONGREAL )        : LONGREAL;
PROCEDURE FREMd ( dividend, divisor : LONGREAL )        : LONGREAL;
PROCEDURE FCMPd ( first, second : LONGREAL );       (* result in CCR *)
PROCEDURE FNEGd ( toNeg : LONGREAL )                    : LONGREAL;
PROCEDURE FABSd ( toAbs : LONGREAL )                    : LONGREAL;
PROCEDURE FLOATd( toFloat : LONGINT )                   : LONGREAL;
PROCEDURE TRUNCd( toTrunc : LONGREAL )                  : LONGINT;

PROCEDURE FLONG ( toConvert : REAL )                    : LONGREAL;
PROCEDURE FSHORT( toConvert : LONGREAL )                : REAL;
  
  
END System.
for things
