//					OPCODES.H

#ifndef opcodesh
#define opcodesh

#define REG 1
#define MEM 2
#define IMM 3
#define IMMB 4
#define IMMW 5
#define IMMD 6

// Keep in order
#define DISP8 8
#define DISP8B 9
#define DISP8W 10
#define DISP8D 11
#define DISP8Q 12
#define DISP8T 13           //Tbyte=10bytes
#define DISP32 14
#define DISP32B 15
#define DISP32W 16
#define DISP32D 17
#define DISP32Q 18
#define DISP32T 19
#define INDIRECT 20
#define INDIRECTB 21
#define INDIRECTW 22
#define INDIRECTD 23
#define INDIRECTQ 24
#define INDIRECTT 25
#define MEMLOC 26
#define MEMLOCB 27
#define MEMLOCW 28
#define MEMLOCD 29
#define MEMLOCQ 30
#define MEMLOCT 31
// *****************

#define FREG 32
#define IMPORT 33
#define EXPORT 34
#define STR 35
#define OFFSET 36

// keep in order
#define REG_AX 1
#define REG_CX 2
#define REG_DX 3
#define REG_BX 4
#define REG_SP 5
#define REG_BP 6
#define REG_SI 7
#define REG_DI 8
#define REG_AL 17
#define REG_CL 18
#define REG_DL 19
#define REG_BL 20
#define REG_AH 21
#define REG_CH 22
#define REG_DH 23
#define REG_BH 24
#define REG_ES 25
#define REG_CS 26
#define REG_SS 27
#define REG_DS 28
#define REG_FS 29
#define REG_GS 30
#define REG_BXSI 31
#define REG_BXDI 32
#define REG_BPSI 33
#define REG_BPDI 34
#define REG_CR0 35
#define REG_CR2 37
#define REG_CR3 38
#define REG_CR4 39
#define REG_DR0 43
#define REG_DR1 44
#define REG_DR2 45
#define REG_DR3 46
#define REG_DR4 47
#define REG_DR6 49
#define REG_DR7 50
#define REG_TR3 54
#define REG_TR4 55
#define REG_TR5 56
#define REG_TR6 57
#define REG_TR7 58
#define REG_MM0 59
#define REG_MM1 60
#define REG_MM2 61
#define REG_MM3 62
#define REG_MM4 63
#define REG_MM5 64
#define REG_MM6 65
#define REG_MM7 66
// **************

#define OP_DB 1
#define OP_PUSH 2
#define OP_POP 3
#define OP_INC 4
#define OP_DEC 5
#define OP_POPA 6
#define OP_PUSHA 7

// keep in order
#define OP_JO  8
#define OP_JNO 9
#define OP_JC 10
#define OP_JNC 11
#define OP_JZ 12
#define OP_JNZ 13
#define OP_JBE 14
#define OP_JA 15
#define OP_JS 16
#define OP_JNS 17
#define OP_JPE 18
#define OP_JPO 19
#define OP_JL 20
#define OP_JGE 21
#define OP_JLE 22
#define OP_JG 23
// **************

#define OP_NOP 24
#define OP_CBW 25
#define OP_CWD 26
#define OP_WAIT 27
#define OP_PUSHF 28
#define OP_POPF 29
#define OP_SAHF 30
#define OP_LAHF 31
#define OP_MOVSB 32
#define OP_MOVSD 33
#define OP_CMPSB 34
#define OP_CMPSD 35
#define OP_STOSB 36
#define OP_STOSD 37
#define OP_LODSB 38
#define OP_LODSD 39
#define OP_SCASB 40
#define OP_SCASD 41
#define OP_DAA 42
#define OP_DAS 43
#define OP_AAA 44
#define OP_AAS 45
#define OP_RETN 46
#define OP_LEAVE 47
#define OP_RETF 48
#define OP_INTO 49
#define OP_IRET 50
#define OP_SETALC 51
#define OP_XLAT 52
#define OP_SMI 53
#define OP_HLT 54
#define OP_CMC 55
#define OP_CLC 56
#define OP_STC 57
#define OP_CLI 58
#define OP_STI 59
#define OP_CLD 60
#define OP_STD 61

// keep in order
#define OP_ADD 62
#define OP_OR 63
#define OP_ADC 64
#define OP_SBB 65
#define OP_AND 66
#define OP_SUB 67
#define OP_XOR 68
#define OP_CMP 69
//*****************

#define OP_MOV 70
#define OP_XCHG 71

#define OP_CALL 72
#define OP_JMP 73

#define OP_REP 74
#define OP_REPNZ 75
#define OP_LOCK 76
#define OP_BOUND 77
#define OP_IMUL 78
#define OP_INSB 79
#define OP_INSD 80
#define OP_OUTSB 81
#define OP_OUTSD 82
#define OP_TEST 83
#define OP_LEA 84
#define OP_CALLF 85
#define OP_LES 86
#define OP_LDS 87
#define OP_ENTER 88
#define OP_INT 89
#define OP_AAM 90
#define OP_AAD 91

#define OP_LOOPNZ 92
#define OP_LOOPZ 93
#define OP_LOOP 94
#define OP_JECXZ 95

#define OP_IN 96
#define OP_OUT 97

// keep in order
#define OP_ROL 98
#define OP_ROR 99
#define OP_RCL 100
#define OP_RCR 101
#define OP_SHL 102
#define OP_SHR 103
#define OP_SAL 104
#define OP_SAR 105
//***************

#define OP_MOVZX 106
#define OP_MOVSX 107

// keep in order
#define OP_SETO  108
#define OP_SETNO 109
#define OP_SETC 110
#define OP_SETNC 111
#define OP_SETZ 112
#define OP_SETNZ 113
#define OP_SETBE 114
#define OP_SETA 115
#define OP_SETS 116
#define OP_SETNS 117
#define OP_SETPE 118
#define OP_SETPO 119
#define OP_SETL 120
#define OP_SETGE 121
#define OP_SETLE 122
#define OP_SETG 123
// **************

#define OP_ARPL 124
#define OP_NOT 125
#define OP_NEG 126
#define OP_MUL 127
#define OP_IMUL1 128
#define OP_DIV 129
#define OP_IDIV 130
#define OP_BSWAP 131
#define OP_LAR 132
#define OP_LSL 133
#define OP_INVD 134
#define OP_WBINVD 135
#define OP_BTS 136
#define OP_BTR 137
#define OP_BT 138
#define OP_BTC 139
#define OP_BSR 140
#define OP_BSF 141
#define OP_XADD 142
#define OP_MOVSW 143
#define OP_CMPSW 144
#define OP_STOSW 145
#define OP_LODSW 146
#define OP_SCASW 147
#define OP_CWDE 148
#define OP_CDQ 149
#define OP_INSW 150
#define OP_OUTSW 151
#define OP_DD 152
#define OP_SHLDI 153
#define OP_SHRDI 154
#define OP_SHLDCL 155
#define OP_SHRDCL 156
#define OP_FPU 157
#define OP_CLTS 158
#define OP_CPUID 159
#define OP_RDMSR 160
#define OP_WRMSR 161
#define OP_RDTSC 162
#define OP_RDPMC 163
#define OP_UD2 164
#define OP_RSM 165

// keep in order
#define OP_SLDT 166
#define OP_STR 167
#define OP_LLDT 168
#define OP_LTR 169
#define OP_VERR 170
#define OP_VERW 171
// *****************

// keep in order
#define OP_SGDT 172
#define OP_SIDT 173
#define OP_LGDT 174
#define OP_LIDT 175
#define OP_SMSW 176
#define OP_INVLPG 177
#define OP_LMSW 178
// *****************

// keep in order
#define OP_CMOVO  179
#define OP_CMOVNO 180
#define OP_CMOVC 181
#define OP_CMOVNC 182
#define OP_CMOVZ 183
#define OP_CMOVNZ 184
#define OP_CMOVBE 185
#define OP_CMOVA 186
#define OP_CMOVS 187
#define OP_CMOVNS 188
#define OP_CMOVPE 189
#define OP_CMOVPO 190
#define OP_CMOVL 191
#define OP_CMOVGE 192
#define OP_CMOVLE 193
#define OP_CMOVG 194
// **************

#define OP_MMX 195
#define OP_CMPXCH 196
#define OP_LSS 197
#define OP_LGS 198
#define OP_LFS 199
#define OP_CMPXCH8B 200
#define OP_DW 201
#define OP_DS 202
#define OP_ZEROBLOCK 203

// Floating Point Opcodes
// opcode = OP_FPU.
// thirdarg set to FPU Opcode.
// keep in order
#define FPU_FADD 1
#define FPU_FMUL 2
#define FPU_FCOM 3
#define FPU_FCOMP 4
#define FPU_FSUB 5
#define FPU_FSUBR 6
#define FPU_FDIV 7
#define FPU_FDIVR 8
// *****************

// keep in order
#define FPU_FIADD 9
#define FPU_FIMUL 10
#define FPU_FICOM 11
#define FPU_FICOMP 12
#define FPU_FISUB 13
#define FPU_FISUBR 14
#define FPU_FIDIV 15
#define FPU_FIDIVR 16
// *****************

#define FPU_FCMOVB 17
#define FPU_FCMOVBE 18
#define FPU_FCMOVE 19
#define FPU_FCMOVU 20
#define FPU_FUCOMPP 21

// keep in order
#define FPU_FADDP 22
#define FPU_FMULP 23
#define FPU_FCOMPP 25
#define FPU_FSUBP 26
#define FPU_FSUBRP 27
#define FPU_FDIVP 28
#define FPU_FDIVRP 29
// *****************

// keep in order
#define FPU_FILD 30
#define FPU_FIST 32
#define FPU_FISTP 33
#define FPU_FLD 35
#define FPU_FSTP 37
// *****************

#define FPU_FCLEX 38
#define FPU_FINIT 39
#define FPU_FCMOVNB 40
#define FPU_FCMOVNBE 41
#define FPU_FCOMI 42
#define FPU_FUCOMI 43
#define FPU_FCMOVNE 44
#define FPU_FCMOVNU 45

#define FPU_FST 46
#define FPU_FLDENV 47
#define FPU_FLDCW 48
#define FPU_FSTENV 49
#define FPU_FSTCW 50
#define FPU_FNOP 51
#define FPU_FCHS 52
#define FPU_FABS 53
#define FPU_FTST 54
#define FPU_FXAM 55
#define FPU_FLD1 56
#define FPU_FLDL2T 57
#define FPU_FLDL2E 58
#define FPU_FLDPI 59
#define FPU_FLDLG2 60
#define FPU_FLDLN2 61
#define FPU_FLDZ 62
#define FPU_F2XM1 63
#define FPU_FYL2X 64
#define FPU_FPTAN 65
#define FPU_FPATAN 66
#define FPU_FXTRACT 67
#define FPU_FPREM1 68
#define FPU_FDECSTP 69
#define FPU_FINCSTP 70
#define FPU_FPREM 71
#define FPU_FYL2XP1 72
#define FPU_FSQRT 73
#define FPU_FSINCOS 74
#define FPU_FRNDINT 75
#define FPU_FSCALE 76
#define FPU_FSIN 77
#define FPU_FCOS 78
#define FPU_FXCH 79
#define FPU_FRSTOR 80
#define FPU_FSAVE 81
#define FPU_FSTSW 82
#define FPU_FFREE 83
#define FPU_FUCOM 84
#define FPU_FUCOMP 85
#define FPU_FBLD 86
#define FPU_FBSTP 87
#define FPU_FUCOMIP 88
#define FPU_FCOMIP 89

// Floating Point Registers
// Keep in order
#define REG_ST0 1
#define REG_ST1 2
#define REG_ST2 3
#define REG_ST3 4
#define REG_ST4 5
#define REG_ST5 6
#define REG_ST6 7
#define REG_ST7 8
// ****************

// MMX Opcodes
// opcode = OP_MMX.
// thirdarg set to MMX Opcode.
#define MMX_PUNPCKL 1
#define MMX_PACKSS 2
#define MMX_PACKUS 3
#define MMX_PCMPGT 4
#define MMX_PUNPCKH 5
#define MMX_PSRL 6
#define MMX_MOVD 7
#define MMX_MOVQ 8
#define MMX_PCMPEQ 9
#define MMX_PSRA 10
#define MMX_PSLL 11
#define MMX_EMMS 12
#define MMX_PMULL 13
#define MMX_PMULH 14
#define MMX_PMADD 15
#define MMX_PSUBUS 16
#define MMX_PSUBS 17
#define MMX_PSUB 18
#define MMX_PADDUS 19
#define MMX_PADDS 20
#define MMX_PADD 21
#define MMX_PAND 22
#define MMX_POR 23
#define MMX_PANDN 24
#define MMX_PXOR 25

#endif
