(************************************************************************
*                                                                       *
*                  D E F I N I T I O N   M O D U L                      *
*                                                                       *
*    Projekt     :   Modula Einpass Compiler (m1pc)                     *
*    Hauptmodul  :                                                      *
*    Modul       :   System                                             *
*    Beginn      :   20.02.87                                           *
*                                                                       *
*    Bearbeitung                                                        *
*    Freigegeben     <----                                              *
*                                                                       *
************************************************************************)


DEFINITION MODULE System; (* C. Vetterli, 22-Dec-85 / 22-Dec-85 *)

FROM SYSTEM IMPORT ADDRESS;  

  (* 'System' FOR MC68000/MC68010 runtime support of Modula-2.*)

  
  (* 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  = Floating ADD single *)
  FSUBs               = 7; (* System.FSUBs  = Floating SUB single *)
  FMULs               = 8; (* System.FMULs  = Floating MUL single *)
  FDIVs               = 9; (* System.FDIVs  = Floating DIV single *)
  FREMs               = 10;(* System.FREMs  = Floating REM single *)
  FCMPs               = 11;(* System.FCMPs  = Floating CMP single *)
  FNEGs               = 12;(* System.FNEGs  = Floating NEG single *)
  FABSs               = 13;(* System.FABSs  = Floating ABS single *)
  FLOATs              = 14;(* System.FLOATs = FLOAT single        *)
  TRUNCs              = 15;(* System.TRUNCs = TRUNC single        *)
  FADDd               = 16;(* System.FADDd  = Floating ADD double *)
  FSUBd               = 17;(* System.FSUBd  = Floating SUB double *)
  FMULd               = 18;(* System.FMULd  = Floating MUL double *)
  FDIVd               = 19;(* System.FDIVd  = Floating DIV double *)
  FREMd               = 20;(* System.FREMd  = Floating REM double *)
  FCMPd               = 21;(* System.FCMPd  = Floating CMP double *)
  FNEGd               = 22;(* System.FNEGd  = Floating NEG double *)
  FABSd               = 23;(* System.FABSd  = Floating ABS double *)
  FLOATd              = 24;(* System.FLOATd = FLOAT double        *)
  TRUNCd              = 25;(* System.TRUNCd = TRUNC double        *)
  FLONG               = 26;(* System.FLONG  = Floating single to double *)
  FSHORT              = 27;(* System.FSHORT = Floating double to single *)
  *)

  
  TYPE   HaltProc = PROCEDURE();

  VAR    HALTX0   : HaltProc;                   (* use only this HALT Proc *)

  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. 
  
  