DEFINITION MODULE OperationCodes;
(* Initializes lookup table for Mnemonic OpCodes.  Searches the table *)
(* and returns the bit pattern along with address mode information.   *)

   FROM Parser IMPORT
      TOKEN;


   EXPORT QUALIFIED
      ModeTypeA, ModeTypeB, ModeA, ModeB, Instructions;


   TYPE
      ModeTypeA = (RegMem3,      (* 0 = Register, 1 = Memory *)
                   Ry02,         (* Register Rx -- Bits 0-2 *)
                   Rx911,        (* Register Ry -- Bits 9-11 *)
                   Data911,      (* Immediate Data -- Bits 9-11 *)
                   CntR911,      (* Count Register or Immediate Data *)
                   Brnch,        (* Relative Branch *)
                   DecBr,        (* Decrement and Branch *)
                   Data03,       (* Used for VECT only *)
                   Data07,       (* Branch & MOVEQ *)
                   OpM68D,       (* Data *)
                   OpM68A,       (* Address *)
                   OpM68C,       (* Compare *)
                   OpM68X,       (* XOR *)
                   OpM68S,       (* Sign Extension *)
                   OpM68R,       (* Register/Memory *)    
                   OpM37);       (* Exchange Registers *)
                   
      ModeTypeB = (Bit811,       (* BIT operations - bits 8/11 as switch *)
                   Size67,       (* 00 = Byte, 01 = Word, 10 = Long *)
                   Size6,        (* 0 = Word, 1 = Long *)
                   Size1213A,    (* 01 = Byte, 11 = Word, 10 = Long *)
                   Size1213,     (* 11 = Word, 10 = Long *)
                   Exten,        (* OpCode extension required *)
                   EA05a,        (* Effective Address - ALL *)
                   EA05b,        (* Less 1 *)
                   EA05c,        (* Less 1, 11 *)
                   EA05d,        (* Less 9, 10, 11 *)
                   EA05e,        (* Less 1, 9, 10, 11 *)
                   EA05f,        (* Less 0, 1, 3, 4, 11 *)
                   EA05x,        (* Dual mode - OR/AND *)
                   EA05y,        (* Dual mode - ADD/SUB *)
                   EA05z,        (* Dual mode - MOVEM *)
                   EA611);       (* Used only by MOVE *)
                   
      ModeA = SET OF ModeTypeA;
      ModeB = SET OF ModeTypeB;


   
   PROCEDURE Instructions (MnemonSym : TOKEN; 
                           OpLoc : CARDINAL; VAR Op : BITSET; 
                           VAR AddrModeA : ModeA; VAR AddrModeB : ModeB);
   (* Uses lookup table to find addressing mode & bit pattern of opcode. *)

END OperationCodes.

