sourcepawn/compiler/amx.h
author David Anderson <dvander@alliedmods.net>
Mon Oct 16 04:08:18 2006 +0000 (2006-10-16)
changeset 119 b81809fc34cf
parent 64 cc302adaac00
child 353 492a8d0d5f59
permissions -rw-r--r--
fixed dynamic arrays not generating stack correctly
     1 /*  Pawn Abstract Machine (for the Pawn language)
     2  *
     3  *  Copyright (c) ITB CompuPhase, 1997-2006
     4  *
     5  *  This software is provided "as-is", without any express or implied warranty.
     6  *  In no event will the authors be held liable for any damages arising from
     7  *  the use of this software.
     8  *
     9  *  Permission is granted to anyone to use this software for any purpose,
    10  *  including commercial applications, and to alter it and redistribute it
    11  *  freely, subject to the following restrictions:
    12  *
    13  *  1.  The origin of this software must not be misrepresented; you must not
    14  *      claim that you wrote the original software. If you use this software in
    15  *      a product, an acknowledgment in the product documentation would be
    16  *      appreciated but is not required.
    17  *  2.  Altered source versions must be plainly marked as such, and must not be
    18  *      misrepresented as being the original software.
    19  *  3.  This notice may not be removed or altered from any source distribution.
    20  *
    21  *  Version: $Id: amx.h 3633 2006-08-11 16:20:18Z thiadmer $
    22  */
    23 
    24 #ifndef AMX_H_INCLUDED
    25 #define AMX_H_INCLUDED
    26 
    27 #include <stdlib.h>   /* for size_t */
    28 #include <limits.h>
    29 
    30 #if defined FREEBSD && !defined __FreeBSD__
    31   #define __FreeBSD__
    32 #endif
    33 #if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
    34   #include <sclinux.h>
    35 #endif
    36 
    37 #if defined __GNUC__
    38   #include <stdint.h>
    39   #define HAVE_STDINT_H
    40 #elif !defined HAVE_STDINT_H
    41   #if defined __LCC__ || defined __DMC__ || defined LINUX || (defined __WATCOMC__ && __WATCOMC__ >= 1200)
    42     #if defined HAVE_INTTYPES_H
    43       #include <inttypes.h>
    44     #else
    45       #include <stdint.h>
    46     #endif
    47   #elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
    48     /* The ISO C99 defines the int16_t and int_32t types. If the compiler got
    49      * here, these types are probably undefined.
    50      */
    51     #if defined __MACH__
    52       #include <ppc/types.h>
    53       typedef unsigned short int  uint16_t;
    54       typedef unsigned long int   uint32_t;
    55     #elif defined __FreeBSD__
    56       #include <inttypes.h>
    57     #else
    58       typedef short int           int16_t;
    59       typedef unsigned short int  uint16_t;
    60       #if defined SN_TARGET_PS2
    61         typedef int               int32_t;
    62         typedef unsigned int      uint32_t;
    63       #else
    64         typedef long int          int32_t;
    65         typedef unsigned long int uint32_t;
    66       #endif
    67       #if defined __WIN32__ || defined _WIN32 || defined WIN32
    68         typedef __int64	          int64_t;
    69         typedef unsigned __int64  uint64_t;
    70         #define HAVE_I64
    71       #elif defined __GNUC__
    72         typedef long long         int64_t;
    73         typedef unsigned long long uint64_t;
    74         #define HAVE_I64
    75       #endif
    76     #endif
    77   #endif
    78   #define HAVE_STDINT_H
    79 #endif
    80 #if defined _LP64 || defined WIN64 || defined _WIN64
    81   #if !defined __64BIT__
    82     #define __64BIT__
    83   #endif
    84 #endif
    85 
    86 #if HAVE_ALLOCA_H
    87   #include <alloca.h>
    88 #endif
    89 #if defined __WIN32__ || defined _WIN32 || defined WIN32 /* || defined __MSDOS__ */
    90   #if !defined alloca
    91     #define alloca(n)   _alloca(n)
    92   #endif
    93 #endif
    94 
    95 #if !defined arraysize
    96   #define arraysize(array)  (sizeof(array) / sizeof((array)[0]))
    97 #endif
    98 #if !defined assert_static
    99   /* see "Compile-Time Assertions" by Ralf Holly,
   100    * C/C++ Users Journal, November 2004
   101    */
   102   #define assert_static(e) \
   103     do { \
   104       enum { assert_static__ = 1/(e) }; \
   105     } while (0)
   106 #endif
   107 
   108 #ifdef  __cplusplus
   109 extern  "C" {
   110 #endif
   111 
   112 #if defined PAWN_DLL
   113   #if !defined AMX_NATIVE_CALL
   114     #define AMX_NATIVE_CALL __stdcall
   115   #endif
   116   #if !defined AMXAPI
   117     #define AMXAPI          __stdcall
   118   #endif
   119 #endif
   120 
   121 /* calling convention for native functions */
   122 #if !defined AMX_NATIVE_CALL
   123   #define AMX_NATIVE_CALL
   124 #endif
   125 /* calling convention for all interface functions and callback functions */
   126 #if !defined AMXAPI
   127   #if defined STDECL
   128     #define AMXAPI      __stdcall
   129   #elif defined CDECL
   130     #define AMXAPI      __cdecl
   131   #elif defined GCC_HASCLASSVISIBILITY
   132     #define AMXAPI __attribute__ ((visibility("default")))
   133   #else
   134     #define AMXAPI
   135   #endif
   136 #endif
   137 #if !defined AMXEXPORT
   138   #define AMXEXPORT
   139 #endif
   140 
   141 /* File format version (in CUR_FILE_VERSION)
   142  *   0 (original version)
   143  *   1 (opcodes JUMP.pri, SWITCH and CASETBL)
   144  *   2 (compressed files)
   145  *   3 (public variables)
   146  *   4 (opcodes SWAP.pri/alt and PUSHADDR)
   147  *   5 (tagnames table)
   148  *   6 (reformatted header)
   149  *   7 (name table, opcodes SYMTAG & SYSREQ.D)
   150  *   8 (opcode STMT, renewed debug interface)
   151  *   9 (macro opcodes)
   152  * MIN_FILE_VERSION is the lowest file version number that the current AMX
   153  * implementation supports. If the AMX file header gets new fields, this number
   154  * often needs to be incremented. MAX_AMX_VERSION is the lowest AMX version that
   155  * is needed to support the current file version. When there are new opcodes,
   156  * this number needs to be incremented.
   157  * The file version supported by the JIT may run behind MIN_AMX_VERSION. So
   158  * there is an extra constant for it: MAX_FILE_VER_JIT.
   159  */
   160 #define CUR_FILE_VERSION  9     /* current file version; also the current AMX version */
   161 #define MIN_FILE_VERSION  6     /* lowest supported file format version for the current AMX version */
   162 #define MIN_AMX_VERSION   9     /* minimum AMX version needed to support the current file format */
   163 #define MAX_FILE_VER_JIT  8     /* file version supported by the JIT */
   164 #define MIN_AMX_VER_JIT   8     /* AMX version supported by the JIT */
   165 
   166 #if !defined PAWN_CELL_SIZE
   167   #define PAWN_CELL_SIZE 32     /* by default, use 32-bit cells */
   168 #endif
   169 #if PAWN_CELL_SIZE==16
   170   typedef uint16_t  ucell;
   171   typedef int16_t   cell;
   172 #elif PAWN_CELL_SIZE==32
   173   typedef uint32_t  ucell;
   174   typedef int32_t   cell;
   175 #elif PAWN_CELL_SIZE==64
   176   typedef uint64_t  ucell;
   177   typedef int64_t   cell;
   178 #else
   179   #error Unsupported cell size (PAWN_CELL_SIZE)
   180 #endif
   181 
   182 #define UNPACKEDMAX   (((cell)1 << (sizeof(cell)-1)*8) - 1)
   183 #define UNLIMITED     (~1u >> 1)
   184 
   185 struct tagAMX;
   186 typedef cell (AMX_NATIVE_CALL *AMX_NATIVE)(struct tagAMX *amx, cell *params);
   187 typedef int (AMXAPI *AMX_CALLBACK)(struct tagAMX *amx, cell index,
   188                                    cell *result, cell *params);
   189 typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
   190 typedef int (AMXAPI *AMX_IDLE)(struct tagAMX *amx, int AMXAPI Exec(struct tagAMX *, cell *, int));
   191 #if !defined _FAR
   192   #define _FAR
   193 #endif
   194 
   195 #if defined _MSC_VER
   196   #pragma warning(disable:4103)  /* disable warning message 4103 that complains
   197                                   * about pragma pack in a header file */
   198   #pragma warning(disable:4100)  /* "'%$S' : unreferenced formal parameter" */
   199 #endif
   200 
   201 /* Some compilers do not support the #pragma align, which should be fine. Some
   202  * compilers give a warning on unknown #pragmas, which is not so fine...
   203  */
   204 #if (defined SN_TARGET_PS2 || defined __GNUC__) && !defined AMX_NO_ALIGN
   205   #define AMX_NO_ALIGN
   206 #endif
   207 
   208 #if !defined AMX_NO_ALIGN
   209   #if defined LINUX || defined __FreeBSD__
   210     #pragma pack(1)         /* structures must be packed (byte-aligned) */
   211   #elif defined MACOS && defined __MWERKS__
   212 	#pragma options align=mac68k
   213   #else
   214     #pragma pack(push)
   215     #pragma pack(1)         /* structures must be packed (byte-aligned) */
   216     #if defined __TURBOC__
   217       #pragma option -a-    /* "pack" pragma for older Borland compilers */
   218     #endif
   219   #endif
   220 #endif
   221 
   222 typedef struct tagAMX_NATIVE_INFO {
   223   const char _FAR *name;
   224   AMX_NATIVE func;
   225 } AMX_NATIVE_INFO;
   226 
   227 #define AMX_USERNUM     4
   228 #define sEXPMAX         19      /* maximum name length for file version <= 6 */
   229 #define sNAMEMAX        31      /* maximum name length of symbol name */
   230 
   231 typedef struct tagAMX_FUNCSTUB {
   232   ucell address;
   233   char name[sEXPMAX+1];
   234 } AMX_FUNCSTUB;
   235 
   236 typedef struct tagFUNCSTUBNT {
   237   ucell address;
   238   uint32_t nameofs;
   239 } AMX_FUNCSTUBNT;
   240 
   241 /* The AMX structure is the internal structure for many functions. Not all
   242  * fields are valid at all times; many fields are cached in local variables.
   243  */
   244 typedef struct tagAMX {
   245   unsigned char _FAR *base; /* points to the AMX header plus the code, optionally also the data */
   246   unsigned char _FAR *data; /* points to separate data+stack+heap, may be NULL */
   247   AMX_CALLBACK callback;
   248   AMX_DEBUG debug       ; /* debug callback */
   249   /* for external functions a few registers must be accessible from the outside */
   250   cell cip              ; /* instruction pointer: relative to base + amxhdr->cod */
   251   cell frm              ; /* stack frame base: relative to base + amxhdr->dat */
   252   cell hea              ; /* top of the heap: relative to base + amxhdr->dat */
   253   cell hlw              ; /* bottom of the heap: relative to base + amxhdr->dat */
   254   cell stk              ; /* stack pointer: relative to base + amxhdr->dat */
   255   cell stp              ; /* top of the stack: relative to base + amxhdr->dat */
   256   int flags             ; /* current status, see amx_Flags() */
   257   /* user data */
   258   long usertags[AMX_USERNUM] ;
   259   void _FAR *userdata[AMX_USERNUM] ;
   260   /* native functions can raise an error */
   261   int error             ;
   262   /* passing parameters requires a "count" field */
   263   int paramcount;
   264   /* the sleep opcode needs to store the full AMX status */
   265   cell pri              ;
   266   cell alt              ;
   267   cell reset_stk        ;
   268   cell reset_hea        ;
   269   /* extra fields for increased performance */
   270   cell sysreq_d         ; /* relocated address/value for the SYSREQ.D opcode */
   271   #if defined JIT
   272     /* support variables for the JIT */
   273     int reloc_size      ; /* required temporary buffer for relocations */
   274     long code_size      ; /* estimated memory footprint of the native code */
   275   #endif
   276 } AMX;
   277 
   278 /* The AMX_HEADER structure is both the memory format as the file format. The
   279  * structure is used internaly.
   280  */
   281 typedef struct tagAMX_HEADER {
   282   int32_t size          ; /* size of the "file" */
   283   uint16_t magic        ; /* signature */
   284   char    file_version  ; /* file format version */
   285   char    amx_version   ; /* required version of the AMX */
   286   int16_t flags         ;
   287   int16_t defsize       ; /* size of a definition record */
   288   int32_t cod           ; /* initial value of COD - code block */
   289   int32_t dat           ; /* initial value of DAT - data block */
   290   int32_t hea           ; /* initial value of HEA - start of the heap */
   291   int32_t stp           ; /* initial value of STP - stack top */
   292   int32_t cip           ; /* initial value of CIP - the instruction pointer */
   293   int32_t publics       ; /* offset to the "public functions" table */
   294   int32_t natives       ; /* offset to the "native functions" table */
   295   int32_t libraries     ; /* offset to the table of libraries */
   296   int32_t pubvars       ; /* the "public variables" table */
   297   int32_t tags          ; /* the "public tagnames" table */
   298   int32_t nametable     ; /* name table */
   299 } AMX_HEADER;
   300 
   301 #if PAWN_CELL_SIZE==16
   302   #define AMX_MAGIC     0xf1e2
   303 #elif PAWN_CELL_SIZE==32
   304   #define AMX_MAGIC     0xf1e0
   305 #elif PAWN_CELL_SIZE==64
   306   #define AMX_MAGIC     0xf1e1
   307 #endif
   308 
   309 enum {
   310   AMX_ERR_NONE,
   311   /* reserve the first 15 error codes for exit codes of the abstract machine */
   312   AMX_ERR_EXIT,         /* forced exit */
   313   AMX_ERR_ASSERT,       /* assertion failed */
   314   AMX_ERR_STACKERR,     /* stack/heap collision */
   315   AMX_ERR_BOUNDS,       /* index out of bounds */
   316   AMX_ERR_MEMACCESS,    /* invalid memory access */
   317   AMX_ERR_INVINSTR,     /* invalid instruction */
   318   AMX_ERR_STACKLOW,     /* stack underflow */
   319   AMX_ERR_HEAPLOW,      /* heap underflow */
   320   AMX_ERR_CALLBACK,     /* no callback, or invalid callback */
   321   AMX_ERR_NATIVE,       /* native function failed */
   322   AMX_ERR_DIVIDE,       /* divide by zero */
   323   AMX_ERR_SLEEP,        /* go into sleepmode - code can be restarted */
   324   AMX_ERR_INVSTATE,     /* invalid state for this access */
   325 
   326   AMX_ERR_MEMORY = 16,  /* out of memory */
   327   AMX_ERR_FORMAT,       /* invalid file format */
   328   AMX_ERR_VERSION,      /* file is for a newer version of the AMX */
   329   AMX_ERR_NOTFOUND,     /* function not found */
   330   AMX_ERR_INDEX,        /* invalid index parameter (bad entry point) */
   331   AMX_ERR_DEBUG,        /* debugger cannot run */
   332   AMX_ERR_INIT,         /* AMX not initialized (or doubly initialized) */
   333   AMX_ERR_USERDATA,     /* unable to set user data field (table full) */
   334   AMX_ERR_INIT_JIT,     /* cannot initialize the JIT */
   335   AMX_ERR_PARAMS,       /* parameter error */
   336   AMX_ERR_DOMAIN,       /* domain error, expression result does not fit in range */
   337   AMX_ERR_GENERAL,      /* general error (unknown or unspecific error) */
   338 };
   339 
   340 /*      AMX_FLAG_CHAR16   0x01     no longer used */
   341 #define AMX_FLAG_DEBUG    0x02  /* symbolic info. available */
   342 #define AMX_FLAG_COMPACT  0x04  /* compact encoding */
   343 #define AMX_FLAG_SLEEP    0x08  /* script uses the sleep instruction (possible re-entry or power-down mode) */
   344 #define AMX_FLAG_NOCHECKS 0x10  /* no array bounds checking; no BREAK opcodes */
   345 #define AMX_FLAG_SYSREQN 0x800  /* script new (optimized) version of SYSREQ opcode */
   346 #define AMX_FLAG_NTVREG 0x1000  /* all native functions are registered */
   347 #define AMX_FLAG_JITC   0x2000  /* abstract machine is JIT compiled */
   348 #define AMX_FLAG_BROWSE 0x4000  /* busy browsing */
   349 #define AMX_FLAG_RELOC  0x8000  /* jump/call addresses relocated */
   350 
   351 #define AMX_EXEC_MAIN   (-1)    /* start at program entry point */
   352 #define AMX_EXEC_CONT   (-2)    /* continue from last address */
   353 
   354 #define AMX_USERTAG(a,b,c,d)    ((a) | ((b)<<8) | ((long)(c)<<16) | ((long)(d)<<24))
   355 
   356 #if !defined AMX_COMPACTMARGIN
   357   #define AMX_COMPACTMARGIN 64
   358 #endif
   359 
   360 /* for native functions that use floating point parameters, the following
   361  * two macros are convenient for casting a "cell" into a "float" type _without_
   362  * changing the bit pattern
   363  */
   364 #if PAWN_CELL_SIZE==32
   365   #define amx_ftoc(f)   ( * ((cell*)&f) )   /* float to cell */
   366   #define amx_ctof(c)   ( * ((float*)&c) )  /* cell to float */
   367 #elif PAWN_CELL_SIZE==64
   368   #define amx_ftoc(f)   ( * ((cell*)&f) )   /* float to cell */
   369   #define amx_ctof(c)   ( * ((double*)&c) ) /* cell to float */
   370 #else
   371   #error Unsupported cell size
   372 #endif
   373 
   374 #define amx_StrParam(amx,param,result)                                      \
   375     do {                                                                    \
   376       cell *amx_cstr_; int amx_length_;                                     \
   377       amx_GetAddr((amx), (param), &amx_cstr_);                              \
   378       amx_StrLen(amx_cstr_, &amx_length_);                                  \
   379       if (amx_length_ > 0 &&                                                \
   380           ((result) = (void*)alloca((amx_length_ + 1) * sizeof(*(result)))) != NULL) \
   381         amx_GetString((char*)(result), amx_cstr_, sizeof(*(result))>1, amx_length_ + 1); \
   382       else (result) = NULL;                                                 \
   383     } while (0)
   384 
   385 uint16_t * AMXAPI amx_Align16(uint16_t *v);
   386 uint32_t * AMXAPI amx_Align32(uint32_t *v);
   387 #if defined _I64_MAX || defined HAVE_I64
   388   uint64_t * AMXAPI amx_Align64(uint64_t *v);
   389 #endif
   390 int AMXAPI amx_Allot(AMX *amx, int cells, cell *amx_addr, cell **phys_addr);
   391 int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params);
   392 int AMXAPI amx_Cleanup(AMX *amx);
   393 int AMXAPI amx_Clone(AMX *amxClone, AMX *amxSource, void *data);
   394 int AMXAPI amx_Exec(AMX *amx, cell *retval, int index);
   395 int AMXAPI amx_FindNative(AMX *amx, const char *name, int *index);
   396 int AMXAPI amx_FindPublic(AMX *amx, const char *funcname, int *index);
   397 int AMXAPI amx_FindPubVar(AMX *amx, const char *varname, cell *amx_addr);
   398 int AMXAPI amx_FindTagId(AMX *amx, cell tag_id, char *tagname);
   399 int AMXAPI amx_Flags(AMX *amx,uint16_t *flags);
   400 int AMXAPI amx_GetAddr(AMX *amx,cell amx_addr,cell **phys_addr);
   401 int AMXAPI amx_GetNative(AMX *amx, int index, char *funcname);
   402 int AMXAPI amx_GetPublic(AMX *amx, int index, char *funcname);
   403 int AMXAPI amx_GetPubVar(AMX *amx, int index, char *varname, cell *amx_addr);
   404 int AMXAPI amx_GetString(char *dest,const cell *source, int use_wchar, size_t size);
   405 int AMXAPI amx_GetTag(AMX *amx, int index, char *tagname, cell *tag_id);
   406 int AMXAPI amx_GetUserData(AMX *amx, long tag, void **ptr);
   407 int AMXAPI amx_Init(AMX *amx, void *program);
   408 int AMXAPI amx_InitJIT(AMX *amx, void *reloc_table, void *native_code);
   409 int AMXAPI amx_MemInfo(AMX *amx, long *codesize, long *datasize, long *stackheap);
   410 int AMXAPI amx_NameLength(AMX *amx, int *length);
   411 AMX_NATIVE_INFO * AMXAPI amx_NativeInfo(const char *name, AMX_NATIVE func);
   412 int AMXAPI amx_NumNatives(AMX *amx, int *number);
   413 int AMXAPI amx_NumPublics(AMX *amx, int *number);
   414 int AMXAPI amx_NumPubVars(AMX *amx, int *number);
   415 int AMXAPI amx_NumTags(AMX *amx, int *number);
   416 int AMXAPI amx_Push(AMX *amx, cell value);
   417 int AMXAPI amx_PushArray(AMX *amx, cell *amx_addr, cell **phys_addr, const cell array[], int numcells);
   418 int AMXAPI amx_PushString(AMX *amx, cell *amx_addr, cell **phys_addr, const char *string, int pack, int use_wchar);
   419 int AMXAPI amx_RaiseError(AMX *amx, int error);
   420 int AMXAPI amx_Register(AMX *amx, const AMX_NATIVE_INFO *nativelist, int number);
   421 int AMXAPI amx_Release(AMX *amx, cell amx_addr);
   422 int AMXAPI amx_SetCallback(AMX *amx, AMX_CALLBACK callback);
   423 int AMXAPI amx_SetDebugHook(AMX *amx, AMX_DEBUG debug);
   424 int AMXAPI amx_SetString(cell *dest, const char *source, int pack, int use_wchar, size_t size);
   425 int AMXAPI amx_SetUserData(AMX *amx, long tag, void *ptr);
   426 int AMXAPI amx_StrLen(const cell *cstring, int *length);
   427 int AMXAPI amx_UTF8Check(const char *string, int *length);
   428 int AMXAPI amx_UTF8Get(const char *string, const char **endptr, cell *value);
   429 int AMXAPI amx_UTF8Len(const cell *cstr, int *length);
   430 int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value);
   431 
   432 #if PAWN_CELL_SIZE==16
   433   #define amx_AlignCell(v) amx_Align16(v)
   434 #elif PAWN_CELL_SIZE==32
   435   #define amx_AlignCell(v) amx_Align32(v)
   436 #elif PAWN_CELL_SIZE==64 && (defined _I64_MAX || defined HAVE_I64)
   437   #define amx_AlignCell(v) amx_Align64(v)
   438 #else
   439   #error Unsupported cell size
   440 #endif
   441 
   442 #define amx_RegisterFunc(amx, name, func) \
   443   amx_Register((amx), amx_NativeInfo((name),(func)), 1);
   444 
   445 #if !defined AMX_NO_ALIGN
   446   #if defined LINUX || defined __FreeBSD__
   447     #pragma pack()    /* reset default packing */
   448   #elif defined MACOS && defined __MWERKS__
   449     #pragma options align=reset
   450   #else
   451     #pragma pack(pop) /* reset previous packing */
   452   #endif
   453 #endif
   454 
   455 #ifdef  __cplusplus
   456 }
   457 #endif
   458 
   459 typedef enum {
   460   OP_NONE,              /* invalid opcode */
   461   OP_LOAD_PRI,
   462   OP_LOAD_ALT,
   463   OP_LOAD_S_PRI,
   464   OP_LOAD_S_ALT,
   465   OP_LREF_PRI,
   466   OP_LREF_ALT,
   467   OP_LREF_S_PRI,
   468   OP_LREF_S_ALT,
   469   OP_LOAD_I,
   470   OP_LODB_I,
   471   OP_CONST_PRI,
   472   OP_CONST_ALT,
   473   OP_ADDR_PRI,
   474   OP_ADDR_ALT,
   475   OP_STOR_PRI,
   476   OP_STOR_ALT,
   477   OP_STOR_S_PRI,
   478   OP_STOR_S_ALT,
   479   OP_SREF_PRI,
   480   OP_SREF_ALT,
   481   OP_SREF_S_PRI,
   482   OP_SREF_S_ALT,
   483   OP_STOR_I,
   484   OP_STRB_I,
   485   OP_LIDX,
   486   OP_LIDX_B,
   487   OP_IDXADDR,
   488   OP_IDXADDR_B,
   489   OP_ALIGN_PRI,
   490   OP_ALIGN_ALT,
   491   OP_LCTRL,
   492   OP_SCTRL,
   493   OP_MOVE_PRI,
   494   OP_MOVE_ALT,
   495   OP_XCHG,
   496   OP_PUSH_PRI,
   497   OP_PUSH_ALT,
   498   OP_PUSH_R,
   499   OP_PUSH_C,
   500   OP_PUSH,
   501   OP_PUSH_S,
   502   OP_POP_PRI,
   503   OP_POP_ALT,
   504   OP_STACK,
   505   OP_HEAP,
   506   OP_PROC,
   507   OP_RET,
   508   OP_RETN,
   509   OP_CALL,
   510   OP_CALL_PRI,
   511   OP_JUMP,
   512   OP_JREL,
   513   OP_JZER,
   514   OP_JNZ,
   515   OP_JEQ,
   516   OP_JNEQ,
   517   OP_JLESS,
   518   OP_JLEQ,
   519   OP_JGRTR,
   520   OP_JGEQ,
   521   OP_JSLESS,
   522   OP_JSLEQ,
   523   OP_JSGRTR,
   524   OP_JSGEQ,
   525   OP_SHL,
   526   OP_SHR,
   527   OP_SSHR,
   528   OP_SHL_C_PRI,
   529   OP_SHL_C_ALT,
   530   OP_SHR_C_PRI,
   531   OP_SHR_C_ALT,
   532   OP_SMUL,
   533   OP_SDIV,
   534   OP_SDIV_ALT,
   535   OP_UMUL,
   536   OP_UDIV,
   537   OP_UDIV_ALT,
   538   OP_ADD,
   539   OP_SUB,
   540   OP_SUB_ALT,
   541   OP_AND,
   542   OP_OR,
   543   OP_XOR,
   544   OP_NOT,
   545   OP_NEG,
   546   OP_INVERT,
   547   OP_ADD_C,
   548   OP_SMUL_C,
   549   OP_ZERO_PRI,
   550   OP_ZERO_ALT,
   551   OP_ZERO,
   552   OP_ZERO_S,
   553   OP_SIGN_PRI,
   554   OP_SIGN_ALT,
   555   OP_EQ,
   556   OP_NEQ,
   557   OP_LESS,
   558   OP_LEQ,
   559   OP_GRTR,
   560   OP_GEQ,
   561   OP_SLESS,
   562   OP_SLEQ,
   563   OP_SGRTR,
   564   OP_SGEQ,
   565   OP_EQ_C_PRI,
   566   OP_EQ_C_ALT,
   567   OP_INC_PRI,
   568   OP_INC_ALT,
   569   OP_INC,
   570   OP_INC_S,
   571   OP_INC_I,
   572   OP_DEC_PRI,
   573   OP_DEC_ALT,
   574   OP_DEC,
   575   OP_DEC_S,
   576   OP_DEC_I,
   577   OP_MOVS,
   578   OP_CMPS,
   579   OP_FILL,
   580   OP_HALT,
   581   OP_BOUNDS,
   582   OP_SYSREQ_PRI,
   583   OP_SYSREQ_C,
   584   OP_FILE,    /* obsolete */
   585   OP_LINE,    /* obsolete */
   586   OP_SYMBOL,  /* obsolete */
   587   OP_SRANGE,  /* obsolete */
   588   OP_JUMP_PRI,
   589   OP_SWITCH,
   590   OP_CASETBL,
   591   OP_SWAP_PRI,
   592   OP_SWAP_ALT,
   593   OP_PUSH_ADR,
   594   OP_NOP,
   595   OP_SYSREQ_N,
   596   OP_SYMTAG,  /* obsolete */
   597   OP_BREAK,
   598   OP_PUSH2_C,
   599   OP_PUSH2,
   600   OP_PUSH2_S,
   601   OP_PUSH2_ADR,
   602   OP_PUSH3_C,
   603   OP_PUSH3,
   604   OP_PUSH3_S,
   605   OP_PUSH3_ADR,
   606   OP_PUSH4_C,
   607   OP_PUSH4,
   608   OP_PUSH4_S,
   609   OP_PUSH4_ADR,
   610   OP_PUSH5_C,
   611   OP_PUSH5,
   612   OP_PUSH5_S,
   613   OP_PUSH5_ADR,
   614   OP_LOAD_BOTH,
   615   OP_LOAD_S_BOTH,
   616   OP_CONST,
   617   OP_CONST_S,
   618   /* ----- */
   619   OP_SYSREQ_D,
   620   OP_SYSREQ_ND,
   621   /* ----- */
   622   OP_HEAP_I,
   623   OP_PUSH_H_C,
   624   OP_GENARRAY,
   625   OP_NUM_OPCODES
   626 } OPCODE;
   627 
   628 #endif /* AMX_H_INCLUDED */