DEFINITION MODULE items;

EXPORT QUALIFIED REGISTER, MODE, ITEM, Operator, 
                 ConditionCode, MonOperator, GlobalLabel,
                 Max16BitCard, Max16BitInt, Max8BitInt,
                 NullRegItem, DataReg0, StackPreDec,
                 PackItem, PackRealStackItem, PackReg,
		 equal, immediate, address, BytesPerWord,
		 InDataReg, slaveable, UsesSlavedAddrReg, 
                 OnRealStack, ImmediateCardToInt,
		 Int16Bit, NILvalue;

TYPE REGISTER  = (D0, D1, D2, D3, D4, D5, D6, D7,
                  A0, A1, A2, NILRegister, G, ZeroRegister, L, S,
                  CCR,
                  NoReg );

     MODE      = (Immediate,
                  DataReg, AddrRegDisp, AddrRegIndex,
                  PreDec, PostInc,
                  ADDRaddrRegDisp,
                  FormalProcedure);
     
     ITEM      = RECORD
                    Mode       : MODE;
                    Register   : REGISTER;
                    DispOrData : INTEGER;
                    Index      : REGISTER
                 END;

     Operator  = (Uadd, Add, Usub, Sub, Umul, Mul, Udiv, Div,
                  Umod, Mod, 
                  And, Or, Xor,
                  Ashl, Ashr, Shl, Shr, Ror,
                  Eql, Neq, Ulss, Lss, Uleq, Leq, Ugtr, Gtr,
                  Ugeq, Geq,
		  In
                 );

     MonOperator   = (Abs, Neg, Com, Msk, Not, Bit);

     GlobalLabel   = (divide, signeddivide, multiply,
                      fadd, fsub, fmul, fdiv, fcmp, fabs, fneg, ftrunc, ffloat,
                      newprocess, transfer, 
                      gft,
                      trap);

     ConditionCode =
                (T, F, HI, LS, CC, CS, NE, EQ, VC, VS, PL, MI,
		 GE, LT, GT, LE
		);

CONST Max16BitCard       =  65535;
      Max16BitInt        =  32767;
      Max8BitInt         =  127;
      
      NILvalue           =  -1;

      BytesPerWord       =  4;

VAR NullRegItem, DataReg0, StackPreDec : ITEM;

PROCEDURE PackItem (VAR item : ITEM;
                    mode : MODE; 
                    register : REGISTER; 
		    dispOrData : INTEGER; 
		    index : REGISTER);
PROCEDURE PackRealStackItem (VAR item : ITEM; disp : INTEGER);
PROCEDURE PackReg (VAR item : ITEM; reg : REGISTER);
PROCEDURE equal (VAR item1, item2 : ITEM) : BOOLEAN;
PROCEDURE immediate (VAR item : ITEM) : BOOLEAN;
PROCEDURE address (VAR item : ITEM) : BOOLEAN;
PROCEDURE InDataReg (VAR item : ITEM) : BOOLEAN;
PROCEDURE slaveable (VAR item : ITEM) : BOOLEAN;
PROCEDURE UsesSlavedAddrReg (VAR item : ITEM): BOOLEAN;
PROCEDURE OnRealStack (VAR item : ITEM) : BOOLEAN;
PROCEDURE Int16Bit (c : CARDINAL) : INTEGER;
PROCEDURE ImmediateCardToInt (VAR item :ITEM);
END items. 
