kolibrios-fun/programs/develop/c--/trunk/opcodesc.h--

592 lines
22 KiB
Plaintext
Raw Normal View History

//CODE GENERATION DESCRIPTORS
// =========================
// >>> DESCRIPTION CODES <<<
// =========================
//T_<MNEMONIC>:
// DB <TRANSFER SIZE|# OF OPERANDS|ALLOWED OPERANDS>
// [DB <OPERAND CODES>]
// [DB <PROCESSOR VERSION>]
// DB <TYPE OF OPCODE DESCRIPTION>
// DB <OPCODE DESCRIPTOR>
// DB 0
//OR DB _END //IF THERE'RE NO MORE INFO ABOUT THIS MNEMONIC
// OPERATION SIZE CODES
enum { _B, //OPERATION MAY BE OF SIZE BYTE,WORD OR DWORD SEIN. THE OPCODE'S
// W BIT INDICATES IF IT'S A BYTE OR WORD OPERATION.
// FOR DWORD OPERATIONS, THE W BIT MUST BE TRUE (WORD OPERATION)
// AND THE RAND:PREFIX MUST BE GENERATED.
_W, //OPERATION SIZE MAY BE WORD OR DWORD.
_D, //OPERATION MAY ONLY BE DWORD.
WB, //1. OPERAND WORD, 2. OPERAND BYTE
_DW, //1. OPERAND DWORD, 2. OPERAND WORD
BW, //1. OPERAND BYTE, 2. OPERAND WORD
NB, //ONLY BYTE SIZE.
_OW, //ONLY WORD SIZE.
_OD, // Only DWORD size
AF}; //ONLY ABSOLUTE FAR 32/48 BIT ADDRESS
#define _JB 1 //OPERAND IS A JUMP - DESTINATION +/-128
#define _JW 2 //OPERAND IS A JUMP - DESTINATION +/-32678
// 0-2 = OPERATION SIZE CODE
// 3-4 = # OF OPERANDS NEEDED.
// # OF OPERANDS
#define OL0 0
#define OL1 0o10
#define OL2 0o20
#define OL3 0o30
#define OLBITS 0o30 //MASKS FOR # OF OPERANDS.
#define NOLBITS 0o347
#define TRANSBITS 0o7 //MASKS FOR OPERATION SIZE CODES.
#define NTRANSBITS 0o370
// IF OL1, USE THIS OPERAND TYPES:
#define SOJ 0b00000000 //JUMP
#define SOE 0b00100000 //EA
#define SOR 0b01000000 //REG
#define SOC 0b01100000 //CONST
#define SO3 0b10000000 //_3
#define SOS 0b10100000 //SREG
#define SOM 0b11000000 //EA-MEMORY-POINTER
#define SOO 0b11100000 //THERE IS INFORMATION USING THE OPERAND SIZE CODE BITS.
#define SOO_FS 0o340 //FS-REGISTER
#define SOO_GS 0o341 //GS-REGISTER
#define SOO_AF 0o342 //ABSOLUTE ADRESS
#define SOO_CC 0o343 //SIGNED BYTE
#define OPBITS 0b11100000
// IF OL2, USE THOSE INSTEAD:
// 00000000B //DIRECT DESCRIPTOR
//AR,CO
#define ERO 0b00100000 //FIXED EA,REG ORDER
#define REO 0b01000000 //FIXED REG,EA ORDER
#define DER 0b01100000 //EA,REG OR REG,EA DEFINED BY A D-BIT
#define ECO 0b10000000 //EA,CONSTANT// SIZE DEFINED BY W-BIT
#define ECCO 0b10100000 //EA,CC
#define RCO 0b11000000 //REG,CONSTANT// SIZE DEFINED BY W-BIT
#define EAO 0b11100000 //EA,? // SECOND OPERAND DESCRIBED BY OLD DESCIPTORS
//?=_1,rCL,CO
// OPERAND TYPE CODES
enum { R, //GENERAL REGISTER
E, //EFFEKTIVE ADRESS
CO, //CONSTANT
_SR, //SEGMENT REGISTER
SYSR, //SYSTEM REGISTER
_DR, //DEBUG REGISTER
_TR, //TASK REGISTER
_CR, //CONTROL REGISTER
_CR4, //
_AF, //ABSOLUTE 32/48 BIT FAR ADDRESS
AR=11, //AX/AL REGISTER, INDICATED BY OPERATION SIZE
_1}; //CONSTANT VALUE 1
// IF OL3, USE THIS:
// INSTRUCTION WITH THREE OPERANDS ARE ALWAYS OF SIZE WORD.
// THE FOLLOWING CODES DESCRIBE THE 3RD OPERAND.
enum { CB3, //BYTE CONSTANT
CW3, //WORD CONSTANT
CC3, //SBYTE CONSTANT
CL3}; //CL REGISTER
// OPCODE DESCRIPTORS
enum{ O=1, //OPCODE IS A BYTE
OW, //OPCODE IS A WORD
OS, //OPCODE IS A BYTE PLUS A SECOND BYTE THAT IS DESCRIBED BY AN
//OCTAL STRING.
S, //OCTAL STRING FOLLOWS FOR OPCODE
XRM, //MODRM BYTE
XPM, //MODRM MIT P-FLAG (GRUPPE VON ARITHMETIC INSTRUCTIONS)
XSM, //MODRM MIT SEGMENTREGISTER
X0M,X1M,X2M,X3M,X4M,X5M,X6M,X7M //MODRM WITH CONSTANT R DIGIT
};
byte OVERRIDETAB={0o46,0o56,0o66,0o76,0o144,0o145};
// ---- <20><><EFBFBD><EFBFBD><EFBFBD><E0AEA2><><E0A5A3><EFBFBD>
enum{ rAL ,rCL ,rDL ,rBL ,rAH ,rCH ,rDH ,rBH, // 0-7 byte regs
rAX ,rCX ,rDX ,rBX ,rSP ,rBP ,rSI ,rDI, // 8-15 16-bit word regs
rEAX,rECX,rEDX,rEBX,rESP,rEBP,rESI,rEDI,// 16-23 32-bit regs
rCR0,rCR1,rCR2,rCR3,rCR4,rCR5,rCR6,rCR7,// 24-31 control regs
rDR0,rDR1,rDR2,rDR3,rDR4,rDR5,rDR6,rDR7,// 32-39 debug regs
rTR0,rTR1,rTR2,rTR3,rTR4,rTR5,rTR6,rTR7,// 40-47 test regs
rES,rCS,rSS,rDS, rFS,rGS}; // 48-53 seg regs
byte Registers={
"AL","CL","DL","BL","AH","CH","DH","BH",
"AX","CX","DX","BX","SP","BP","SI","DI",
"EAX","ECX","EDX","EBX","ESP","EBP","ESI","EDI",
"CR0","CR1","CR2","CR3","CR4","CR5","CR6","CR7",
"DR0","DR1","DR2","DR3","DR4","DR5","DR6","DR7",
"TR0","TR1","TR2","TR3","TR4","TR5","TR6","TR7",
"ES","CS","SS","DS","FS","GS",_END};
byte Sizes={"BYTE","WORD","DWORD",_END};
// ---- <20><><EFBFBD><EFBFBD><E1A0AD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
byte PCOMMANDS1={
0, //P FLAG STARTS AT 0
_B+OL2+EAO,AR,CO,S,"0P4",
_B+OL2+DER,S,'0','P','0',XRM,0,
_W+OL2+ECCO,O,0o203,XPM,0,
_B+OL2+ECO,O,0o200,XPM,_END};
byte PCOMMANDS2={
4, //P FLAG STARTS AT 4
_B+OL1+SOE,O,0xF6,XPM,_END};
byte PCOMMANDS3= 0; //P FLAG STARTS AT 0
byte PCOMMANDS3_={
_B+OL2+EAO,-1,_1,O,0xD0,XPM,0,
_B+OL2+EAO,-1,rCL,O,0xD2,XPM,0,
_B+OL2+ECCO,O,0xC0,XPM,_END};
byte PCOMMANDS4={
4, //P FLAG STARTS AT 4
_W+OL2+ERO,OS,0xF,'2','P','3',XRM,0,
WB+OL2+ECO,OW,0xF,0o272,XPM,_END};
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2AEA2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
byte T_DAA={ O,0o47,_END};
byte T_DAS={ O,0o57,_END};
byte T_AAA={ O,0o67,_END};
byte T_AAD={ OW,0o325,0o12,_END};
byte T_AAM={ OW,0o324,0o12,_END};
byte T_AAS={ O,0o77,_END};
byte T_CWDE={ O,0o230,_END};
byte T_CBW={ OW,0x66,0o230,_END};
byte T_CDQ={ O,0o231,_END};
byte T_CWD={ OW,0x66,0o231,_END};
byte T_XLATB={ O,0o327,_END};
byte T_NOP={ O,0o220,_END};
byte T_WAIT={ O,0o233,_END};
byte T_LOCK={ O,0o360,_END};
byte T_HLT={ O,0o364,_END};
byte T_INTO={ O,0o316,_END};
byte T_IRET={ O,0o317,_END};
byte T_POPFD={ O,0o235,_END};
byte T_POPF={ OW,0x66,0o235,_END};
byte T_PUSHFD={ O,0o234,_END};
byte T_PUSHF={ OW,0x66,0o234,_END}; //PUSHF / (#) PUSHFD
byte T_SAHF={ O,0o236,_END};
byte T_LAHF={ O,0o237,_END};
byte T_CMC={ O,0o365,_END};
byte T_CLC={ O,0o370,_END};
byte T_STC={ O,0o371,_END};
byte T_CLI={ O,0o372,_END};
byte T_STI={ O,0o373,_END};
byte T_CLD={ O,0o374,_END};
byte T_STD={ O,0o375,_END};
byte T_PUSHAD={ O,0o140,_END};
byte T_PUSHA={ OW,0x66,0o140,_END};
byte T_POPAD={ O,0o141,_END};
byte T_POPA={ OW,0x66,0o141,_END};
byte T_INSB={ O,0o154,_END};
byte T_INSW={ OW,0x66,0o155,_END};
byte T_INSD={ O,0o155,_END};
byte T_OUTSB={ O,0o156,_END};
byte T_OUTSW={ OW,0x66,0o157,_END};
byte T_OUTSD={ O,0o157,_END};
byte T_MOVSB={ O,0o244,_END};
byte T_MOVSW={ OW,0x66,0o245,_END};
byte T_MOVSD={ O,0o245,_END};
byte T_CMPSB={ O,0o246,_END};
byte T_CMPSW={ OW,0x66,0o247,_END};
byte T_CMPSD={ O,0o247,_END};
byte T_STOSB={ O,0o252,_END};
byte T_STOSW={ OW,0x66,0o253,_END};
byte T_STOSD={ O,0o253,_END};
byte T_LODSB={ O,0o254,_END};
byte T_LODSW={ OW,0x66,0o255,_END};
byte T_LODSD={ O,0o255,_END};
byte T_SCASB={ O,0o256,_END};
byte T_SCASW={ OW,0x66,0o257,_END};
byte T_SCASD={ O,0o257,_END};
byte T_REP={ O,0o362,_END};
byte T_REPE={ O,0o363,_END};
byte T_RAND={ O,0o146,_END}; //RAND:
byte T_ADDR={ O,0o147,_END}; //ADDR:
byte T_LEAVE={ O,0o311,_END};
byte T_CLTS={ OW,0xF,6,_END};
byte T_INVD={ OW,0xF,0o10,_END};
byte T_WBINVD={ OW,0xF,0o11,_END};
byte T_WRMSR={ OW,0xF,0x30,_END}; //WRMSR WRITE EDXEAX TO MODEL SPECIFIC REG #ECX
byte T_CPUID={ OW,0xF,0xA2,_END}; //CPUID IF EAX=1 SET EDXEAX TO CPU IDENTIFICATION VALUES
byte T_RDMSR={ OW,0xF,0x32,_END}; //RDMSR READ MODEL SPECIFIC REG #ECX TO EDXEAX
byte T_RDTSC={ OW,0xF,0x31,_END}; //RDTSC READ TIME STAMP COUNTER TO EDXEAX
byte T_RSM={ OW,0xF,0xAA,_END}; //RSM RESUME FROM SYSTEM MANAGEMENT MODE
//===== INTEL PENTIUM PRO INSTRUCTIONS
byte T_RDPMC={ OW,0xF,0x33,_END}; //READ PERFORMANCE MONITORING COUNTERS
byte T_UD2={ OW,0xF,0xB,_END}; //UNDEFINED INSTRUCTION EXCEPTION
byte T_EMMX={ OW,0xF,0x77,_END}; //EMPTY MMX STATE
byte T_SALC={ O,0xD6,_END};
byte T_ICEBP={ O,0xF1,_END};
byte T_PSHIMW={ OW,0xF,0x71,_END};
byte T_PSHIMD={ OW,0xF,0x72,_END};
byte T_PSHIMQ={ OW,0xF,0x73,_END};
byte T_NOT={ _B+OL1+SOE,O,0xF6,X2M,_END};
byte T_NEG={ _B+OL1+SOE,O,0xF6,X3M,_END};
byte T_INC={ _W+OL1+SOR,S,"10R",
_B+OL1+SOE,O,0xFE,X0M,_END};
byte T_DEC={ _W+OL1+SOR,S,"11R",
_B+OL1+SOE,O,0xFE,X1M,_END};
byte T_TEST={ _B+OL2+ERO,O,0o204,XRM,0, //ALPHA:WAS 204O
_B+OL2+REO,O,0o204,XRM,0, //"
_B+OL2+EAO,AR,CO,O,0o250,0,
_B+OL2+ECO,O,0xF6,X0M,_END};
// EXTENDED 386 INTEGER MULTIPLICATION
byte T_IMUL={ _B+OL1+SOE,O,0xF6,X5M,0, //IMUL EB
_B+OL2+ECO,O,0xC0,X1M,0,
_B+OL2+EAO,-1,_1,O,0xD0,X1M,0,
_B+OL2+EAO,-1,rCL,O,0xD2,X1M,0,
_W+OL1+REO,OW,0xF,0o257,XRM,0, //IMUL RW, EW
OL3+REO+CC3,O,0o153,XRM,0, //IMUL RW, EW, DC
OL3+REO+CW3,O,0o151,XRM,_END}; //IMUL RW, EW, DW
byte T_SHLD={ OL3+ERO+CB3,OW,0xF,0o244,XRM,0,
OL3+ERO+CL3,OW,0xF,0o245,XRM,_END};
byte T_SHRD={ OL3+ERO+CB3,OW,0xF,0o254,XRM,0,
OL3+ERO+CL3,OW,0xF,0o255,XRM,_END};
byte T_MOVSX={ WB+OL2+REO,OW,0xF,0o276,XRM,0,
_DW+OL2+REO,OW,0xF,0o277,XRM,_END};
byte T_MOVZX={ WB+OL2+REO,OW,0xF,0o266,XRM,0,
_DW+OL2+REO,OW,0xF,0o267,XRM,_END};
byte T_BSWAP={ _D+OL1+SOR,OS,0xF,"31R",_END};
byte T_BSF={ _W+OL2+REO,OW,0xF,0o274,XRM,_END};
byte T_BSR={ _W+OL2+REO,OW,0xF,0o275,XRM,_END};
byte T_CMPXCHG={_B+OL2+ERO,OW,0xF,0xB0,XRM,_END};
byte T_CMPXCHG486={_B+OL2+ERO,OW,0xF,0xA7,XRM,_END};
byte T_CMPXCHG8B={_B+OL2+ERO,OW,0xF,0xC7,XRM,_END};
byte T_XADD={ _B+OL2+ERO,OW,0xF,0xC0,XRM,_END};
byte T_XCHG={ _W+OL2+EAO,-1,AR,S,"22M", //ALPHA:WAS "22R" BUT GENERATED NOP
_W+OL2+EAO,AR,-1,S,"22R",
_B+OL2+REO,O,0o206,XRM,0,
_B+OL2+ERO,O,0o206,XRM,_END};
byte T_MOV=0; //DUMMY BYTE
byte T_LEA={ _D+OL2+REO,O,0o215,XRM,_END}; //LEA RW, EN (X != 3)
byte T_LSS={ _D+OL2+REO,OW,0xF,0o262,XRM,_END};//LSS RW, EF (X != 3)
byte T_LFS={ _D+OL2+REO,OW,0xF,0o264,XRM,_END};//LFS RW, EF (X != 3)
byte T_LGS={ _D+OL2+REO,OW,0xF,0o265,XRM,_END};//LGS RW, EF (X != 3)
byte T_LES={ _D+OL2+REO,O,0o304,XRM,_END}; //LES RW, EF (X != 3)
byte T_LDS={ _D+OL2+REO,O,0o305,XRM,_END}; //LDS RW, EF (X != 3)
byte T_SET0={ NB+OL1+SOE,OW,0xF,0o220,X0M,_END};
byte T_SET1={ NB+OL1+SOE,OW,0xF,0o221,X0M,_END};
byte T_SET2={ NB+OL1+SOE,OW,0xF,0o222,X0M,_END};
byte T_SET3={ NB+OL1+SOE,OW,0xF,0o223,X0M,_END};
byte T_SET4={ NB+OL1+SOE,OW,0xF,0o224,X0M,_END};
byte T_SET5={ NB+OL1+SOE,OW,0xF,0o225,X0M,_END};
byte T_SET6={ NB+OL1+SOE,OW,0xF,0o226,X0M,_END};
byte T_SET7={ NB+OL1+SOE,OW,0xF,0o227,X0M,_END};
byte T_SET8={ NB+OL1+SOE,OW,0xF,0o230,X0M,_END};
byte T_SET9={ NB+OL1+SOE,OW,0xF,0o231,X0M,_END};
byte T_SETA={ NB+OL1+SOE,OW,0xF,0o232,X0M,_END};
byte T_SETB={ NB+OL1+SOE,OW,0xF,0o233,X0M,_END};
byte T_SETC={ NB+OL1+SOE,OW,0xF,0o234,X0M,_END};
byte T_SETD={ NB+OL1+SOE,OW,0xF,0o235,X0M,_END};
byte T_SETE={ NB+OL1+SOE,OW,0xF,0o236,X0M,_END};
byte T_SETF={ NB+OL1+SOE,OW,0xF,0o237,X0M,_END};
//
byte T_JCXZ={ OL1,_JB,O,0o343,_END};
byte T_LOOPNZ={ OL1,_JB,O,0o340,_END};
byte T_LOOPZ={ OL1,_JB,O,0o341,_END};
byte T_LOOP={ OL1,_JB,O,0o342,_END};
byte T_J0={ OL1,_JB,O,0o160,0,
OL1,_JW,6,OW,0o17,0o200,_END};
byte T_J1={ OL1,_JB,O,0o161,0,
OL1,_JW,6,OW,0o17,0o201,_END};
byte T_J2={ OL1,_JB,O,0o162,0,
OL1,_JW,6,OW,0o17,0o202,_END};
byte T_J3={ OL1,_JB,O,0o163,0,
OL1,_JW,6,OW,0o17,0o203,_END};
byte T_J4={ OL1,_JB,O,0o164,0,
OL1,_JW,6,OW,0o17,0o204,_END};
byte T_J5={ OL1,_JB,O,0o165,0,
OL1,_JW,6,OW,0o17,0o205,_END};
byte T_J6={ OL1,_JB,O,0o166,0,
OL1,_JW,6,OW,0o17,0o206,_END};
byte T_J7={ OL1,_JB,O,0o167,0,
OL1,_JW,6,OW,0o17,0o207,_END};
byte T_J8={ OL1,_JB,O,0o170,0,
OL1,_JW,6,OW,0o17,0o210,_END};
byte T_J9={ OL1,_JB,O,0o171,0,
OL1,_JW,6,OW,0o17,0o211,_END};
byte T_JA={ OL1,_JB,O,0o172,0,
OL1,_JW,6,OW,0o17,0o212,_END};
byte T_JB={ OL1,_JB,O,0o173,0,
OL1,_JW,6,OW,0o17,0o213,_END};
byte T_JC={ OL1,_JB,O,0o174,0,
OL1,_JW,6,OW,0o17,0o214,_END};
byte T_JD={ OL1,_JB,O,0o175,0,
OL1,_JW,6,OW,0o17,0o215,_END};
byte T_JE={ OL1,_JB,O,0o176,0,
OL1,_JW,6,OW,0o17,0o216,_END};
byte T_JF={ OL1,_JB,O,0o177,0,
OL1,_JW,6,OW,0o17,0o217,_END};
byte T_JMP={ OL1,_JB,O,0o353,0, //JMP SHORT CB
OL1,_JW,5,O,0o351,0, //JMP NEAR CW
_OW+OL1+SOE,O,0o377,X4M,0}; // JMP NEAR EN
byte T_JMPFAR={ _D+OL1+SOE,O,0o377,X5M,0, // JMP FAR EF
OL1+SOO_AF,O,0o352,_END}; //JMP FAR AF
byte T_JMPSHORT={
OL1,_JB,O,0o353,_END}; //JMP SHORT CB
byte T_JMPNEAR={OL1,_JW,5,O,0o351,0, //JMP NEAR CW
_OW+OL1+SOE,O,0o377,X4M,_END}; // JMP NEAR EN
byte T_CALL={ OL1,_JW,5,O,0o350,0, //CALL CW
_OW+OL1+SOE,O,0o377,X2M,0}; //CALL EN
byte T_CALLFAR={
OL1+SOO_AF,O,0o232,0, //CALL AF
_D+OL1+SOE,O,0o377,X3M,_END}; //CALL FAR EF
byte T_RETF={ 0,O,0o313,0, //RETF/RET FAR
_OW+OL1+SOC,O,0o312,_END}; //RETF DW/RET FAR DW
byte T_ENTER={ WB+OL2+EAO,CO,CO,O,0o310,_END};
byte T_BOUND={ _W+OL2+REO,O,0o142,XRM,_END}; //BOUND RW, ED
/*byte T_INT={ NB+OL1+SO3,O,0o314,0, // !!! No interrupts in Win32
NB+OL1+SOC,O,0o315,_END};*/
byte T_IN={ NB+OL2+EAO,AR,CO,O,0o344,0, //IN AL, DB
WB+OL2+EAO,AR,CO,O,0o345,0, //IN AX,CO
_B+OL2+EAO,AR,rDX,O,0o354,0, //IN AL,DX
_OW+OL2+EAO,AR,rDX,O,0o355,_END}; //IN AX, DX
byte T_OUT={ NB+OL2+EAO,CO,AR,O,0o346,0, //OUT DB, AL
BW+OL2+EAO,CO,AR,O,0o347,0, //OUT DB, AX
WB+OL2+EAO,rDX,AR,O,0o356,0, //OUT DX, AL
_OW+OL2+EAO,rDX,AR,O,0o357,_END}; //OUT DX, AX
byte T_PUSH={ OL1+SOO_CC,O,0o152,0,
_D+OL1+SOR,S,"12R",
_D+OL1+SOE,O,0o377,X6M,0,
_D+OL1+SOC,O,0o150,0,
OL1+SOO_FS,OW,0xF,0o240,0,
OL1+SOO_GS,OW,0xF,0o250,0,
_OW+OL1+SOS,S,"0S6", //WIEDER ANS ENDE PACKEN
_END};
byte T_RET={ _OW+OL1+SOC,O,0o302,0, //RET DW
O,0o303,0,_END}; //RET
byte T_POP={ _D+OL1+SOR,S,"13R",
_D+OL1+SOE,O,0o217,X0M,0,
OL1+SOO_FS,OW,0xF,0o241,0,
OL1+SOO_GS,OW,0xF,0o251,0,
_OW+OL1+SOS,S,"0S7",_END};
byte T_ARPL={ _W+OL2+ERO,O,0o143,XRM,_END}; //ARPL ES, RW
byte T_SLDT={ _OW+OL1+SOE,OW,0xF,0,X0M,_END}; //SLDT EW
byte T_STR={ _OW+OL1+SOE,OW,0xF,0,X1M,_END}; //STR EW
byte T_LLDT={ _OW+OL1+SOE,OW,0xF,0,X2M,_END}; //LLDT EW
byte T_LTR={ _OW+OL1+SOE,OW,0xF,0,X3M,_END}; //LTR EW
byte T_VERR={ _OW+OL1+SOE,OW,0xF,0,X4M,_END}; //VERR EW
byte T_VERW={ _OW+OL1+SOE,OW,0xF,0,X5M,_END}; //VERW EW
byte T_LAR={ _OW+OL1+REO,OW,0xF,2,XRM,_END}; //LAR RW, EW
byte T_LSL={ _OW+OL1+REO,OW,0xF,3,XRM,_END}; //LSL RW, EW
byte T_SGDT={ _OW+OL1+SOM,OW,0xF,1,X0M,_END}; //SGDT EP
byte T_SIDT={ _OW+OL1+SOM,OW,0xF,1,X1M,_END}; //SIDT EP
byte T_LGDT={ _OW+OL1+SOM,OW,0xF,1,X2M,_END}; //LGDT EP
byte T_LIDT={ _OW+OL1+SOM,OW,0xF,1,X3M,_END}; //LIDT EP
byte T_SMSW={ _OW+OL1+SOE,OW,0xF,1,X4M,_END}; //SMSW EW
byte T_LMSW={ _OW+OL1+SOE,OW,0xF,1,X6M,_END}; //LMSW EW
//===== X486 INSTRUCTIONS
byte T_INVLPD={ _OW+OL1+SOM,OW,0xF,0o20,X7M,_END}; //INVLPG EA
//===== INTEL PENTIUM INSTRUCTIONS
byte T_CMPX8={ _OW+OL1+SOE,OW,0xF,0xC7,X1M,_END}; //CMPX8 EW 5 IF EDXEAX=MQ THEN MQ:=ECXEBX, ELSE EAXEDX:=MQ
byte T_CMOV={ _W+OL2,REO,OW,0xF,0x40,XRM,_END};
//===== MMX INSTRUCTIONS
byte T_EMMS={ _END};
byte T_UMOV={ _B+OL2,DER,OW,0xF,0x10,XRM,_END};
#define _Q 1
#define MMXE 1
#define MMXP 1
#define MMXPI 1
#define MMXPE 1
#define MMXEP 1
byte T_PUNPCKLBW={ _D+OL2,MMXE,OW,0xF,0x60,_END};
byte T_PUNPCKLWD={ _D+OL2,MMXE,OW,0xF,0x61,_END};
byte T_PUNPCKLDQ={ _D+OL2,MMXE,OW,0xF,0x62,_END};
byte T_PACKSSWB={ _Q+OL2,MMXE,OW,0xF,0x63,_END};
byte T_PCMPGTB={ _Q+OL2,MMXE,OW,0xF,0x64,_END};
byte T_PCMPGTW={ _Q+OL2,MMXE,OW,0xF,0x65,_END};
byte T_PCMPGTD={ _Q+OL2,MMXE,OW,0xF,0x66,_END};
byte T_PACKUSWB={ _Q+OL2,MMXE,OW,0xF,0x67,_END};
byte T_PCMPEQB={ _Q+OL2,MMXE,OW,0xF,0x74,_END};
byte T_PCMPEQW={ _Q+OL2,MMXE,OW,0xF,0x75,_END};
byte T_PCMPEQD={ _Q+OL2,MMXE,OW,0xF,0x76,_END};
byte T_PSRLW={ _Q+OL2,MMXE,OW,0xF,0xD1,_END};
byte T_PSRLD={ _Q+OL2,MMXE,OW,0xF,0xD2,_END};
byte T_PSRLQ={ _Q+OL2,MMXE,OW,0xF,0xD3,_END};
byte T_PMULLW={ _Q+OL2,MMXE,OW,0xF,0xD5,_END};
byte T_PSRAW={ _Q+OL2,MMXE,OW,0xF,0xE1,_END};
byte T_PSRAD={ _Q+OL2,MMXE,OW,0xF,0xE2,_END};
byte T_PMULHW={ _Q+OL2,MMXE,OW,0xF,0xE5,_END};
byte T_PSLLW={ _Q+OL2,MMXE,OW,0xF,0xF1,_END};
byte T_PSLLD={ _Q+OL2,MMXE,OW,0xF,0xF2,_END};
byte T_PSLLQ={ _Q+OL2,MMXE,OW,0xF,0xF3,_END};
byte T_PMADDWD={ _Q+OL2,MMXE,OW,0xF,0xF5,_END};
byte T_PUNPCKHBW={ _Q+OL2,MMXE,OW,0xF,0x68,_END};
byte T_PUNPCKHWD={ _Q+OL2,MMXE,OW,0xF,0x69,_END};
byte T_PUNPCKHDQ={ _Q+OL2,MMXE,OW,0xF,0x6A,_END};
byte T_PACKSSDW={ _Q+OL2,MMXE,OW,0xF, 0x6B,_END};
byte T_MOVD={ _D+OL2,MMXPE,OW,0xF,0x6E,0,
_Q+OL2,MMXEP,OW,0xF,0x7E,_END};
byte T_MOVQ={ _Q+OL2,MMXE,OW,0xF,0x6F,0,
_Q+OL2,MMXE,OW,0xF,0x7F,_END};
byte T_PSUBUSB={ _Q+OL2,MMXE,OW,0xF,0xD8,_END};
byte T_PSUBUSW={ _Q+OL2,MMXE,OW,0xF,0xD9,_END};
byte T_PAND={ _Q+OL2,MMXE,OW,0xF,0xDB,_END};
byte T_PADDUSB={ _Q+OL2,MMXE,OW,0xF,0xDC,_END};
byte T_PADDUSW={ _Q+OL2,MMXE,OW,0xF,0xDD,_END};
byte T_PANDN={ _Q+OL2,MMXE,OW,0xF,0xDF,_END};
byte T_PSUBSB={ _Q+OL2,MMXE,OW,0xF,0xE8,_END};
byte T_PSUBSW={ _D+OL2,MMXE,OW,0xF,0xE9,_END};
byte T_POR={ _Q+OL2,MMXE,OW,0xF,0xEB,_END};
byte T_PADDSB={ _Q+OL2,MMXE,OW,0xF,0xEC,_END};
byte T_PADDSW={ _Q+OL2,MMXE,OW,0xF,0xED,_END};
byte T_PXOR={ _Q+OL2,MMXE,OW,0xF,0xEF,_END};
byte T_PSUBB={ _Q+OL2,MMXE,OW,0xF,0xF8,_END};
byte T_PSUBW={ _Q+OL2,MMXE,OW,0xF,0xF9,_END};
byte T_PSUBD={ _Q+OL2,MMXE,OW,0xF,0xFA,_END};
byte T_PADDB={ _Q+OL2,MMXE,OW,0xF,0xFC,_END};
byte T_PADDW={ _Q+OL2,MMXE,OW,0xF,0xFD,_END};
byte T_PADDD={ _Q+OL2,MMXE,OW,0xF,0xFE,_END};
byte T_PSRL={ _Q+OL2,MMXPI,OW,0xF,_END};
byte T_PSRA={ _Q+OL2,MMXPI,OW,0xF,_END};
byte T_PSLL={ _Q+OL2,MMXE,OW,0xF,_END};
byte Mnemonics={
// FIRST OF ALL THE COMMANDS WITH A P-FLAG. THIS"LL MAKE THINGS EASIER FOR
// COMPARISON IN THE PARSE ENGINE
//P1=0-7
"ADD","OR","ADC","SBB/BC","AND","SUB","XOR","CMP",
//P2=4-7
"MUL","-","DIV","IDIV",
// IMUL ENTFERNT
//P3=0-5/7
"ROL","ROR","RCL","RCR","SHL/AL","SHR","-","SAR",
//P4=4-7
"BT","BTS","BTR","BTC",
// USUAL COMMANDS
"NOT","NEG","INC","DEC","TEST", "IMUL","SHLD","SHRD",
"DAA","DAS","AAA","AAS","AAM","AAD",
"MOVSX","MOVZX","CBW","CWDE","CWD","CDQ",
"BSWAP","XLAT/LATB","BSF","BSR",
"CMPXCHG","CMPXCHG486","CMPXCHG8B","XADD",
"NOP","WAIT","LOCK","HLT", //"INT",
"INTO","IRET",
"POPF","POPFD","PUSHF","PUSHFD","SAHF","LAHF",
"CMC","CLC","STC","CLI","STI","CLD","STD",
"PUSH","PUSHA","PUSHAD","POP","POPA","POPAD",
"XCHG","MOV","LEA","LSS","LFS","LGS","LES","LDS",
"ADDR","RAND",
"IN","OUT","INSB","INSW","INSD","OUTSB","OUTSW","OUTSD",
"MOVSB","MOVSW","MOVSD","CMPSB","CMPSW","CMPSD",
"STOSB","STOSW","STOSD","LODSB","LODSW","LODSD",
"SCASB","SCASW","SCASD","REP/EPNE/EPNZ","REPE/EPZ",
"JCXZ/ECXZ","LOOP","LOOPZ/OOPE","LOOPNZ/OOPNE",
"JO","JNO","JC/B/NAE","JNC/AE/NB",
"JE/Z","JNE/NZ","JBE/NA","JA/NBE",
"JS","JNS","JP/PE","JNP/PO","JL/NGE","JGE/NL",
"JLE/NG","JG/NLE",
"SETO","SETNO","SETC/ETB/ETNAE","SETNC/ETAE/ETNB",
"SETE/ETZ","SETNE/ETNZ","SETBE/ETNA","SETA/ETNBE",
"SETS","SETNS","SETP/ETPE","SETNP/ETPO","SETL/ETNGE","SETGE/ETNL",
"SETLE/ETNG","SETG/ETNLE",
"JMPS","JMPN","JMPF","JMP",
"CALL","CALLF","RET","RETF",
"ENTER","LEAVE","BOUND","ARPL",
"SLDT","STR","LLDT","LTR","VERR","VERW","LAR","LSL",
"SGDT","SIDT","LGDT","LIDT","SMSW","LMSW","CLTS",
"INVD","WBINVD","INVLPD",
//INTEL PENTIUM COMMANDS
"WRMSR","CMPX8/MPXCHG8B","CPUID","RDMSR","RDTSC","RSM",
//INTEL PENTIUM PRO INSTRUCTIONS
"RDPMC","UD2","EMMX","SETALC",
//MMX INSTRUCTIONS
"MOVD","MOVQ", //MOVE MMX REG
"PACKUS/PACKUSWB", //PACK MMX REG WITH UNSIGNED SATURATION
"PACKSSWB","PACKSSDW", //PACK MMX REG WITH SIGNED SATURATION
"PUNPCKHBW","PUNPCKHWD",
"PUNPCKHDQ", //UNPACK HIGH ORDER
"PUNPCKLBW","PUNPCKLWD",
"PUNPCKLDQ", //UNPACK LOW ORDER
"PADDB","PADDW","PADDD", //ADD MMX REG WITH WRAP-AROUND
"PADDSB","PADDSW", //" WITH SIGNED SATURATION
"PADDUSB","PADDUSW", //" WITH UNSIGNED SATURATION
"PSUBB","PSUBW","PSUBD", //SUBTRACT MMX REG
"PSUBSB","PSUBSW","PSUBUSB","PSUBUSW",
"PMULH/PMULHW","PMULL/PMULLW","PMADD/PMADDWD",
"PSLLW","PSLLD","PSLLQ","PSRLW","PSRLD","PSRLQ",
"PSRAW","PSRAD","PCMPEQB","PCMPEQW","PCMPEQD",
"PCMPGTB","PCMPGTW","PCMPGTD","PAND","PANDN","POR","PXOR","EMMS",_END};
dword TAB_MNEMONICS={
#T_NOT,#T_NEG,#T_INC,#T_DEC,#T_TEST,
#T_IMUL,#T_SHLD,#T_SHRD,
#T_DAA,#T_DAS,#T_AAA,#T_AAS,#T_AAM,#T_AAD,
#T_MOVSX,#T_MOVZX,#T_CBW,#T_CWDE,#T_CWD,#T_CDQ,
#T_BSWAP,#T_XLATB,
#T_BSF,#T_BSR,#T_CMPXCHG,#T_CMPXCHG486,#T_CMPXCHG8B,#T_XADD,
#T_NOP,#T_WAIT,#T_LOCK,#T_HLT,
// #T_INT,
#T_INTO,#T_IRET,
#T_POPF,#T_POPFD,#T_PUSHF,#T_PUSHFD,
#T_SAHF,#T_LAHF,
#T_CMC,#T_CLC,#T_STC,#T_CLI,#T_STI,#T_CLD,#T_STD,
#T_PUSH,#T_PUSHA,#T_PUSHAD,
#T_POP,#T_POPA,#T_POPAD,
#T_XCHG,#T_MOV,
#T_LEA,#T_LSS,#T_LFS,#T_LGS,#T_LES,#T_LDS,
#T_ADDR,#T_RAND,
#T_IN,#T_OUT,
#T_INSB,#T_INSW,#T_INSD,
#T_OUTSB,#T_OUTSW,#T_OUTSD,
#T_MOVSB,#T_MOVSW,#T_MOVSD,
#T_CMPSB,#T_CMPSW,#T_CMPSD,
#T_STOSB,#T_STOSW,#T_STOSD,
#T_LODSB,#T_LODSW,#T_LODSD,
#T_SCASB,#T_SCASW,#T_SCASD,
#T_REP,
#T_REPE,
#T_JCXZ,#T_LOOP,#T_LOOPZ,#T_LOOPNZ,
#T_J0,#T_J1,#T_J2,#T_J3,
#T_J4,#T_J5,#T_J6,#T_J7,
#T_J8,#T_J9,#T_JA,#T_JB,
#T_JC,#T_JD,#T_JE,#T_JF,
#T_SET0,#T_SET1,#T_SET2,#T_SET3,
#T_SET4,#T_SET5,#T_SET6,#T_SET7,
#T_SET8,#T_SET9,#T_SETA,#T_SETB,
#T_SETC,#T_SETD,#T_SETE,#T_SETF,
#T_JMPSHORT,#T_JMPNEAR,#T_JMPFAR,#T_JMP,
#T_CALL,#T_CALLFAR,
#T_RET,#T_RETF,
#T_ENTER,#T_LEAVE,
#T_BOUND,#T_ARPL,
#T_SLDT,#T_STR,#T_LLDT,#T_LTR,#T_VERR,#T_VERW,
#T_LAR,#T_LSL,
#T_SGDT,#T_SIDT,#T_LGDT,#T_LIDT,
#T_SMSW,#T_LMSW,#T_CLTS,
#T_INVD,#T_WBINVD,#T_INVLPD,
//INTEL PENTIUM INSTRUCTIONS
#T_WRMSR,#T_CMPX8,#T_CPUID,#T_RDMSR,#T_RDTSC,#T_RSM,
//INTEL PENTIUM PRO INSTRUCTIONS
#T_RDPMC,#T_UD2,#T_EMMX,#T_SALC,
//MMX INSTRUCTIONS
#T_MOVD,#T_MOVQ, //MOVE MMX REG
#T_PACKUSWB, //PACK MMX REG WITH UNSIGNED SATURATION
#T_PACKSSWB,#T_PACKSSDW, //PACK MMX REG WITH SIGNED SATURATION
#T_PUNPCKHBW,#T_PUNPCKHWD,#T_PUNPCKHDQ, //UNPACK HIGH ORDER
#T_PUNPCKLBW,#T_PUNPCKLWD,#T_PUNPCKLDQ, //UNPACK LOW ORDER
#T_PADDB,#T_PADDW,#T_PADDD, //ADD MMX REG WITH WRAP-AROUND
#T_PADDSB,#T_PADDSW, //" WITH SIGNED SATURATION
#T_PADDUSB,#T_PADDUSW, //" WITH UNSIGNED SATURATION
#T_PSUBB,#T_PSUBW,#T_PSUBD, //SUBTRACT MMX REG
#T_PSUBSB,#T_PSUBSW,
#T_PSUBUSB,#T_PSUBUSW,
#T_PMULHW,
#T_PMULLW,
#T_PMADDWD,
#T_PSLLW,#T_PSLLD,#T_PSLLQ,
#T_PSRLW,#T_PSRLD,#T_PSRLQ,
#T_PSRAW,#T_PSRAD,
#T_PCMPEQB,#T_PCMPEQW,#T_PCMPEQD,
#T_PCMPGTB,#T_PCMPGTW,#T_PCMPGTD,
#T_PAND,
#T_PANDN,
#T_POR,
#T_PXOR,
#T_EMMS};