!
!************************************************************************
!*                                                                      *
!*                                                    G.E.Millard       *
!*   ECODES1                                          26/09/85          *
!*                                                                      *
!************************************************************************
!
{00} %constinteger      HALT =   0
!
!--------------------------------------- 32-bit (Etos) ----------------
!
{01} %constinteger      IADD =   1     { (Etos-1) + (Etos) => (Etos)   }
{02} %constinteger      ISUB =   2     { (Etos-1) - (Etos) => (Etos)   }
{03} %constinteger     IMULT =   3     { (Etos-1) * (Etos) => (Etos)   }
{04} %constinteger      IDIV =   4     { (Etos-1) / (Etos) => (Etos)   }
{05} %constinteger      INEG =   5     {          - (Etos) => (Etos)   }
{06} %constinteger      IABS =   6     {     abs( (Etos) ) => (Etos)   }
{07} %constinteger      IREM =   7     { remainder from                }
                                       {  (Etos-1) / (Etos)=> (Etos)   }
!
{08} %constinteger      IAND =   8     { (Etos-1) & (Etos) => (Etos)   }
{09} %constinteger       IOR =   9     { (Etos-1) ! (Etos) => (Etos)   }
{0A} %constinteger      INOT =  10     {          ~ (Etos) => (Etos)   }
{0B} %constinteger      IXOR =  11     { (Etos-1) !! (Etos) => (Etos)  }
{0C} %constinteger     ISHLL =  12     { (Etos-1) << (Etos) => (Etos)  }
{0D} %constinteger     ISHRL =  13     { (Etos-1) >> (Etos) => (Etos)  }
{0E} %constinteger     ISHLA =  14     { arithmetic left shift         }
{0F} %constinteger     ISHRA =  15     { arithmetic right shift        }
!
{10} %constinteger       IGT =  16     { if                            }
{11} %constinteger       ILT =  17     {    (Etos-1) <relop> (Etos)    }
{12} %constinteger       IEQ =  18     { then                          }
{13} %constinteger       INE =  19     {    true  (1) => (Etos)        }
{14} %constinteger       IGE =  20     { else                          }
{15} %constinteger       ILE =  21     {    false (0) => (Etos)        }
!
{18} %constinteger      JIGT =  24     { if                            }
{19} %constinteger      JILT =  25     {    (Etos-1) <relop> (Etos)    }
{1A} %constinteger      JIEQ =  26     { then                          }
{1B} %constinteger      JINE =  27     {    -> <label>                 }
{1C} %constinteger      JIGE =  28     { else                          }
{1D} %constinteger      JILE =  29     {    continue                   }
!
!--------------------------------------- generic (Etos) ---------------
!
{1E} %constinteger    JINTGZ =  30     { if (Etos) > 0 %then -> <lab>  }
{1F} %constinteger    JINTLZ =  31     { if (Etos) < 0 %then -> <lab>  }
{20} %constinteger     JINTZ =  32     { if (Etos) = 0 %then -> <lab>  }
{21} %constinteger    JINTNZ =  33     { if (Etos) # 0 %then -> <lab>  }
{22} %constinteger   JINTGEZ =  34     { if (Etos) >=0 %then -> <lab>  }
{23} %constinteger   JINTLEZ =  35     { if (Etos) <=0 %then -> <lab>  }
! 
{24} %constinteger      ITWB =  36     { if (Etos) < 0 then -> <lab1>  } 
                                       {           = 0 then -> <lab2>  }
                                       {           > 0 then -> <lab3>  }
!
{26} %constinteger      JUMP =  38     { -> <label>                    }
{29} %constinteger       SFA =  41     { SF => (Etos)                  }
{2A} %constinteger    RETURN =  42     { procedure exit                }
{2B} %constinteger      ASF  =  43     { SF = SF + (Etos)              }
!
{2C} %constinteger     IPUSH =  44     { (Etos) => (Mstack)            }
{2D} %constinteger      IPOP =  45     { (Mstack) => (Etos)            }
{2E} %constinteger      EXCH =  46     { (Etos-1) <=> (Etos)           }
{2F} %constinteger      DUPL =  47     { replicate (Etos)              }
{30} %constinteger   DISCARD =  48     { discard (Etos)                }
!
{33} %constinteger    INDEX1 =  51     { (@ Etos-1) + (Etos)           }
                                       {               => (@ Etos)     }
{34} %constinteger    INDEX2 =  52     { (@ Etos-1) + (Etos)*2         }
                                       {               => (@ Etos)     }
{35} %constinteger    INDEX4 =  53     { (@ Etos-1) + (Etos)*4         }
                                       {               => (@ Etos)     }
{36} %constinteger    INDEX8 =  54     { (@ Etos-1) + (Etos)*8         }
                                       {               => (@ Etos)     }
{37} %constinteger     INDEX =  55     { (@ Etos-2)                    }
                                       {     + (Etos-1)*(Etos)         }
                                       {               => (@ Etos)     }
!
{38} %constinteger       MVB =  56     { move (Etos) bytes             }
                                       {  ((@ Etos-2)) => ((@ Etos-1)) }
!
{39} %constinteger       CHK =  57     { check that                    }
                                       { (Etos-1)<=(Etos-2)<=(Etos)    }
                                       { (Etos-2) => (Etos)            }
!
{3A} %constinteger     TMASK =  58     { (Etos-1) & (Etos)             }
                                       { - to be followed by JI[N]Z    }
!
{3E} %constinteger     CPBGT =  62     { if (Etos) bytes               }
{3F} %constinteger     CPBLT =  63     {  ((Etos-2)) <relop> ((Etos-1))}
{40} %constinteger     CPBEQ =  64     { then                          }
{41} %constinteger     CPBNE =  65     {    true  (1) => (Etos)        }
{42} %constinteger     CPBGE =  66     { else                          }
{43} %constinteger     CPBLE =  67     {    false (0) => (Etos)        }
!
!-------------------------------------- generic real operations -------
!
{71} %constinteger     RADD = 113     { (Etos-1) + (Etos) => (Etos)    }
{72} %constinteger     RSUB = 114     { (Etos-1) - (Etos) => (Etos)    }
{73} %constinteger    RMULT = 115     { (Etos-1) * (Etos) => (Etos)    }
{74} %constinteger     RDIV = 116     { (Etos-1) / (Etos) => (Etos)    }
{75} %constinteger     RNEG = 117     {        - (Etos) => (Etos)      }
{76} %constinteger     RABS = 118     {   abs( (Etos) ) => (Etos)      }
!
{88} %constinteger    CVTII = 136     { (int Etos-1) => int size(Etos) }
{89} %constinteger    CVTIR = 137     { (int Etos-1) => real size(Etos)}
{8A} %constinteger    CVTRR = 138     { (real Etos-1)=> real size(Etos)}
{8B} %constinteger    TNCRI = 139     { (real Etos-1)=> int size(Etos) }
{8C} %constinteger    RNDRI = 140     { (real Etos-1)=> int size(Etos) }
!
!--------------------------------------- generic real operations ------
!
{90} %constinteger       RGT = 144     { if                            }
{91} %constinteger       RLT = 145     {    (Etos-1) <relop> (Etos)    }
{92} %constinteger       REQ = 146     { then                          }
{93} %constinteger       RNE = 147     {    1 => (Etos)                }
{94} %constinteger       RGE = 148     { else                          }
{95} %constinteger       RLE = 149     {    0 => (Etos)                }
!
{96} %constinteger      JRGT = 150     { if                            }
{97} %constinteger      JRLT = 151     {    (Etos-1) <relop> (Etos)    }
{98} %constinteger      JREQ = 152     { then                          }
{99} %constinteger      JRNE = 153     {    -> <label>                 }
{9A} %constinteger      JRGE = 154     { else                          }
{9B} %constinteger      JRLE = 155     {    continue                   }
!
{9C} %constinteger      JRGZ = 156     { if (Etos) > 0 %then -> <lab>  }
{9D} %constinteger      JRLZ = 157     { if (Etos) < 0 %then -> <lab>  }
{9E} %constinteger       JRZ = 158     { if (Etos) = 0 %then -> <lab>  }
{9F} %constinteger      JRNZ = 159     { if (Etos) # 0 %then -> <lab>  }
{A0} %constinteger     JRGEZ = 160     { if (Etos) >=0 %then -> <lab>  }
{A1} %constinteger     JRLEZ = 161     { if (Etos) <=0 %then -> <lab>  }
!
{A2} %constinteger      RTWB = 162     { if (Etos) < 0 then -> <lab1>  }
                                       {           = 0 then -> <lab2>  }
                                       {           > 0 then -> <lab3>  }
{A3} %constinteger     JTRUE = 163     { if (Etos) true  then -> <lab  }
{A4} %constinteger    JFALSE = 164     { if (Etos) false then -> <lab> }
!
!----------------------------------------------------------------------
!
{B1} %constinteger    UCHECK = 177    { if (Etos) unassigned diagnose  }
{B8} %constinteger    ESTORE = 184    { ((Etos)) = (Etos-1)            }
{B9} %constinteger EDUPSTORE = 185    { ((Etos)) = (Etos-1)            }
                                      { retain (Etos-1) as new (Etos)  }
{BA} %constinteger   PUSHVAL = 186    { push (Etos) as value param     }
{BB} %constinteger  PUSHADDR = 187    { push (Etos) as ref param       }
{BC} %constinteger      EVAL = 188    { force load of (Etos)           }
{BD} %constinteger  EVALADDR = 189    { force load of @ at (Etos)      }
{BE} %constinteger  EADDRESS = 190    { address(Etos) is required      }
{BF} %constinteger   EINTRES = 191    { (Etos) is integer fn result    }
{C0} %constinteger  EREALRES = 192    { (Etos) is real fn result       }
{C1} %constinteger     ESIZE = 193    { size of (Etos-1) is (Etos)     }

{C2}%constinteger     EPOWER = 194    { (Etos-3) @ result if cx        }
                                      { (Etos-2) base (@ base if cx)   }
                                      { (Etos-1) power(@ power if cx)  }
                                      { (Etos)   procindex             }

{C3}%constinteger    EPOWERI = 195    { (Etos-2) base                  }
                                      { (Etos-1) power (int)           }
                                      { (Etos)   procindex (0-3)       }

                                      { procindex =  0  powii          }
                                      {              1  powri          }
                                      {              2  powdi          }
                                      {              3  powqi          }
                                      {              4  powci          }
                                      {              5  powzi          }
                                      {              6  powzzi         }
                                      {              9  powrr          }
                                      {             10  powdd          }
                                      {             11  powqq          }
                                      {             12  powcc          }
                                      {             13  powzz          }
                                      {             14  powzzz         }
!
!***********************************************************************
!*                                                                     *
!*         Fortran specific codes                                      *
!*                                                                     *
!***********************************************************************
!
%constinteger CXADD       = 257       { ((Etos-3)) = ((Etos-2))        }
%constinteger CXSUB       = 258       {                      op        }
%constinteger CXMULT      = 259       {                      ((Etos-1))}
%constinteger CXDIV       = 260       { (Etos) = variant<<8 ! sizecode }

%constinteger CXNEG       = 261       { ((Etos-2)) = - ((Etos-1))      }
                                      { (Etos) = sizecode              }

%constinteger CXASGN      = 262       { ((Etos-2)) = ((Etos-1))        }
                                      { (Etos) = variant<<8            }
                                      {            ! sizecode(LHS)<<2  }
                                      {              ! sizecode(RHS)   }

%constinteger CXEQ        = 263       { (Etos) =  ((Etos-2))           }
%constinteger CXNE        = 264       {                  op ((Etos-1)) }
                                      { (Etos) = variant<<8 ! sizecode }

%constinteger ECMPLX1     = 286       { ((Etos-2))=((Etos-1),0)        }
%constinteger ECMPLX2     = 287       { ((Etos-3))=((Etos-2),(Etos-1)) }
                                      { (Etos) = sizecode              }

%constinteger ECONJG      = 279       { ((Etos-2) =  conjg((Etos-1))   }
                                      { (Etos) = sizecode              }

                                      { variant  = 0    cx op cx       }
                                      {            1    cx op real     }
                                      {            2  real op cx       }
                                      { sizecode = 0    c*8   (r*4)    }
                                      {            1    c*16  (r*8)    }
                                      {            2    c*32  (r*16)   }

%constinteger EM1EXP      = 267       { (Etos) = (-1) ** (Etos) - int  }

%constinteger EISIGN      = 268       { (Etos) = sign(Etos)            }
%constinteger ESIGN       = 269       {                  * abs(Etos-1) }

%constinteger EIMOD       = 270       { (Etos) = int(Etos-1)/(Etos)    }
%constinteger ERMOD       = 271       {                       * (Etos) }

%constinteger EIDIM       = 272       { (Etos) = if (Etos-1) > (Etos)  }
%constinteger ERDIM       = 273       {          then (Etos-1)-(Etos)  }
                                      {          else 0

%constinteger EIMIN       = 274       { (Etos) = min( (Etos-1),        }
%constinteger ERMIN       = 275       {                (Etos) )        }

%constinteger EIMAX       = 276       { (Etos) = max( (Etos-1),        }
%constinteger ERMAX       = 277       {                (Etos) )        }

%constinteger EDMULT      = 278       { (Etos) = dble((Etos-1)*(Etos)) }

%constinteger ECHAR       = 280       {  ((Etos-1)) = char(Etos)       }
%constinteger EICHAR      = 281       {      (Etos) = ichar((Etos-1))  }

%constinteger EINDEXCHAR  = 282       {      (Etos) = index( C1,C2 )   }
                                      {  ((Etos-3)) = Charad(C1)       }
                                      {   (Etos-2)  = Charlen(C1)      }
                                      {  ((Etos-1)) = Charad(C2)       }
                                      {    (Etos)   = Charlen(C2)      }

%constinteger ECONCAT     = 283       {          C1 = concat list      }
                                      {  ((Etos-3)) = Charad(C1)       }
                                      {   (Etos-2)  = Charlen(C1)      }
                                      {  ((Etos-1)) = @ concat table   }
                                      {    (Etos)   = no. items        }

%constinteger EASGNCHAR   = 284       {          C1 = C2               }
                                      {  ((Etos-3)) = Charad(C1)       }
                                      {   (Etos-2)  = Charlen(C1)      }
                                      {  ((Etos-1)) = Charad(C2)       }
                                      {    (Etos)   = Charlen(C2)      }

%constinteger ECOMPCHAR   = 285       {     (Etos) = compare( C1,C2 )  }
                                      {  ((Etos-4)) = Charad(C1)       }
                                      {   (Etos-3)  = Charlen(C1)      }
                                      {  ((Etos-2)) = Charad(C2)       }
                                      {   (Etos-1)  = Charlen(C2)      }
                                      {    (Etos)   = relop            }
                                      {  relop  =  0 >   1 <   2 =     }
                                      {            3 #   4 >=  5 <=    }

%constinteger EISHFT      = 288       { (Etos) = (Etos-1) << (Etos)    }
%constinteger EIBITS      = 289       { (Etos) = (Etos) bits from      }
                                      {       bit (Etos-1) in (Etos-2) }
%constinteger EIBSET      = 290       { (Etos) = (Etos-1)&(1<<(Etos))  }
%constinteger EIBTEST     = 291       { (Etos) = (Etos-1)!(1<<(Etos))  }
%constinteger EIBCLR      = 292       { (Etos) = (Etos-1)&\(1<<(Etos)) }
%constinteger EISHFTC     = 293       { (Etos) = (Etos-1) <<c (Etos)   }

%constinteger PROCARG     = 294
%constinteger IPROCARG    = 295
%constinteger CHARARG     = 296
%constinteger IPROCCALL   = 297
%constinteger ARGPROCCALL = 298
%constinteger CALLTPLATE  = 299
%constinteger NOTEIORES   = 300
%constinteger STKIORES    = 301

%constinteger EFCVT       = 302       { convert(Etos-1)                }
                                      { (Etos)      convert code       }
%constinteger EFCVTASGN   = 303       { (Etos-1) =  convert(Etos-2)    }
                                      { (Etos)      convert code       }
                                      { convert code=oldmode<<3!newmode}
                                      { mode =[0  bit - futures]       }
                                      {        1  I1 (byte)            }
                                      {        2  I2                   }
                                      {        3  I4                   }
                                      {        4  I8                   }
                                      {        5  R4                   }
                                      {        6  R8                   }
                                      {        7  R16                  }

%constinteger EARGLEN     = 304       { (Etos) is char arg len         }
                                      {   - on Amdahl load bottom half }

%constinteger EFDVACC     = 305       { dope vector special evaluation }
                                      { (Etos-1) => (Etos)             }
                                      { (Etos-2) + (Etos-1)*(Etos)     }
                                      {                => (Etos-1)     }

%constinteger EFNOTEVR    = 306       { (Etos) is the variable return  }
                                      { index                          }

%constinteger EFSETVR     = 307       { stack a descriptor for the     }
                                      { variable return index          }
!