#include "StdAfx.h"
#include "stdio.h"
#include "string.h"
#include "inteldef.h"
#include "inteldis.h"
#include "windows.h"
LOCKREPXX LockRepxx[]=
{
{"LOCK " ,0xf0},
{"REP " ,0xf3},
{"REPZ " ,0xf3},
{"REPE " ,0xf3},
{"REPNE " ,0xf2},
{"REPNZ " ,0xf2}
};
OPDATAWIDE OpDataWide[]=
{
{1, "SHORT PTR" },
{2, "NEAR PTR" },
{4, "FAR PTR" },
{1, "BYTE PTR" },
{2, "WORD PTR" },
{4, "DWORD PTR" },
{6, "FWORD PTR" },
{8, "QWORD PTR" }
};
char *RegAddr16[]=
{
"[BX+SI]" , "[SI+BX]" , "[BX][SI]" , "[SI][BX]",
"[BX+DI]" , "[DI+BX]" , "[BX][DI]" , "[DI][BX]",
"[BP+SI]" , "[SI+BP]" , "[BP][SI]" , "[SI][BP]",
"[BP+DI]" , "[DI+BP]" , "[BP][DI]" , "[DI][BP]",
"[SI]" , "[SI]" , "[SI]" , "[SI]",
"[DI]" , "[DI]" , "[DI]" , "[DI]",
"[BP]" , "[BP]" , "[BP]" , "[BP]",
"[BX]" , "[BX]" , "[BX]" , "[BX]"
};
char *xxxxptr[] =
{
NULL,
"BYTE",
"WORD",
NULL,
"DWORD",
NULL,
"FWORD",
NULL,
"QWORD",
NULL,
"TWORD"
};
BYTE SegmentValue[8] =
{
0x26,0x2e,0x36,0x3e,0x64,0x65,0x00,0x00
};
char *SegReg[8] =
{
"ES","CS","SS","DS","FS","GS","??","??"
};
char *RegByte[8] =
{
"AL","CL","DL","BL","AH","CH","DH","BH"
};
char *RegWord[8] =
{
"AX","CX","DX","BX","SP","BP","SI","DI"
};
char *RegDWord[8] =
{
"EAX","ECX","EDX","EBX","ESP","EBP","ESI","EDI"
};
char *FlagS[2][8]=
{
{"NV","UP","DI","PL","NZ","NA","PO","NC"},
{"OV","DN","EI","NG","ZR","AC","PE","CY"}
};
char *FlagICE[2][8]=
{
{"o","d","i","s","z","a","p","c"},
{"O","D","I","S","Z","A","P","C"}
};
BYTE Segment[8] =
{
0x26,0x2e,0x36,0x3e,0x64,0x65,0x00,0x00
};
char *CtrReg[8] =
{
"IP","EIP","FLAGS","FLAG","FL","EFLAGS","EFLAG","EFL"
};
char *RegName[][8] =
{
{"ES","CS","SS","DS","FS","GS","??","??"},
{"AL","CL","DL","BL","AH","CH","DH","BH"},
{"AX","CX","DX","BX","SP","BP","SI","DI"},
{"EAX","ECX","EDX","EBX","ESP","EBP","ESI","EDI"}
};
char *Emblem[0x200] =
{
"ES","CS","SS","DS","FS","GS",
"AL","CL","DL","BL","AH","CH","DH","BH",
"AX","CX","DX","BX","SP","BP","SI","DI",
"EAX","ECX","EDX","EBX","ESP","EBP","ESI","EDI",
//----------------------------------
"IP","EIP","FLAGS","EFLAGS",
//----------------------------------
"BYTE","WORD","DWORD","FWORD","QWORD","TWORD",
//----------------------------------
"SHORT","NEAR","FAR","PTR",
//----------------------------------
"ADD","ADC","SUB","SBB","MUL","IDIV",
"XOR","AND","OR" ,"NOT","NEG","TEST"
};
//---------------------------------------------------------------
//intel 指令表格
//----------------------------------------------------------------
DIS_OPCODE_T Group0x80[] = //immediate group
{
{R_M |Immediate_Ib, C_ADD, D__Eb, D__Ib, D__NONE, "ADD", }, //0x0
{R_M |Immediate_Ib, C_OR, D__Eb, D__Ib, D__NONE, "OR", }, //0x1
{R_M |Immediate_Ib, C_ADC, D__Eb, D__Ib, D__NONE, "ADC", }, //0x2
{R_M |Immediate_Ib, C_SBB, D__Eb, D__Ib, D__NONE, "SBB", }, //0x3
{R_M |Immediate_Ib, C_AND, D__Eb, D__Ib, D__NONE, "AND", }, //0x4
{R_M |Immediate_Ib, C_SUB, D__Eb, D__Ib, D__NONE, "SUB", }, //0x5
{R_M |Immediate_Ib, C_XOR, D__Eb, D__Ib, D__NONE, "XOR", }, //0x6
{R_M |Immediate_Ib, C_CMP, D_rEb, D__Ib, D__NONE, "CMP", } //0x7
};
DIS_OPCODE_T Group0x81[] = //immediate group
{
{R_M |Immediate_Iv, C_ADD, D__Ev, D__Iv, D__NONE, "ADD", }, //0x0
{R_M |Immediate_Iv, C_OR, D__Ev, D__Iv, D__NONE, "OR", }, //0x1
{R_M |Immediate_Iv, C_ADC, D__Ev, D__Iv, D__NONE, "ADC", }, //0x2
{R_M |Immediate_Iv, C_SBB, D__Ev, D__Iv, D__NONE, "SBB", }, //0x3
{R_M |Immediate_Iv, C_AND, D__Ev, D__Iv, D__NONE, "AND", }, //0x4
{R_M |Immediate_Iv, C_SUB, D__Ev, D__Iv, D__NONE, "SUB", }, //0x5
{R_M |Immediate_Iv, C_XOR, D__Ev, D__Iv, D__NONE, "XOR", }, //0x6
{R_M |Immediate_Iv, C_CMP, D_rEv, D__Iv, D__NONE, "CMP", } //0x7
};
DIS_OPCODE_T Group0x82[] = //immediate group
{
{R_M |Immediate_Ib, C_ADD, D__Eb, D__Ib, D__NONE, "ADD", }, //0x0
{R_M |Immediate_Ib, C_OR, D__Eb, D__Ib, D__NONE, "OR", }, //0x1
{R_M |Immediate_Ib, C_ADC, D__Eb, D__Ib, D__NONE, "ADC", }, //0x2
{R_M |Immediate_Ib, C_SBB, D__Eb, D__Ib, D__NONE, "SBB", }, //0x3
{R_M |Immediate_Ib, C_AND, D__Eb, D__Ib, D__NONE, "AND", }, //0x4
{R_M |Immediate_Ib, C_SUB, D__Eb, D__Ib, D__NONE, "SUB", }, //0x5
{R_M |Immediate_Ib, C_XOR, D__Eb, D__Ib, D__NONE, "XOR", }, //0x6
{R_M |Immediate_Ib, C_CMP, D_rEb, D__Ib, D__NONE, "CMP", } //0x7
};
DIS_OPCODE_T Group0x83[] = //immediate group
{
{R_M |Immediate_sIb, C_ADD, D__Ev, D_sIb, D__NONE, "ADD", }, //0x0
{R_M |Immediate_sIb, C_OR, D__Ev, D_sIb, D__NONE, "OR", }, //0x1
{R_M |Immediate_sIb, C_ADC, D__Ev, D_sIb, D__NONE, "ADC", }, //0x2
{R_M |Immediate_sIb, C_SBB, D__Ev, D_sIb, D__NONE, "SBB", }, //0x3
{R_M |Immediate_sIb, C_AND, D__Ev, D_sIb, D__NONE, "AND", }, //0x4
{R_M |Immediate_sIb, C_SUB, D__Ev, D_sIb, D__NONE, "SUB", }, //0x5
{R_M |Immediate_sIb, C_XOR, D__Ev, D_sIb, D__NONE, "XOR", }, //0x6
{R_M |Immediate_sIb, C_CMP, D_rEv, D_sIb, D__NONE, "CMP", } //0x7
};
DIS_OPCODE_T Group0xc0[] = //shift group
{
{R_M |Immediate_Ib, C_ROL, D__Eb, D__Ib, D__NONE, "ROL", }, //0x0
{R_M |Immediate_Ib, C_ROR, D__Eb, D__Ib, D__NONE, "ROR", }, //0x1
{R_M |Immediate_Ib, C_RCL, D__Eb, D__Ib, D__NONE, "RCL", }, //0x2
{R_M |Immediate_Ib, C_RCR, D__Eb, D__Ib, D__NONE, "RCR", }, //0x3
{R_M |Immediate_Ib, C_SHL, D__Eb, D__Ib, D__NONE, "SHL", }, //0x4
{R_M |Immediate_Ib, C_SHR, D__Eb, D__Ib, D__NONE, "SHR", }, //0x5
{R_M |Immediate_Ib, C_SAL, D__Eb, D__Ib, D__NONE, "SAL", }, //0x6
{R_M |Immediate_Ib, C_SAR, D__Eb, D__Ib, D__NONE, "SAR", } //0x7
};
DIS_OPCODE_T Group0xc1[] = //shift group
{
{R_M |Immediate_Ib, C_ROL, D__Ev, D__Ib, D__NONE, "ROL", }, //0x0
{R_M |Immediate_Ib, C_ROR, D__Ev, D__Ib, D__NONE, "ROR", }, //0x1
{R_M |Immediate_Ib, C_RCL, D__Ev, D__Ib, D__NONE, "RCL", }, //0x2
{R_M |Immediate_Ib, C_RCR, D__Ev, D__Ib, D__NONE, "RCR", }, //0x3
{R_M |Immediate_Ib, C_SHL, D__Ev, D__Ib, D__NONE, "SHL", }, //0x4
{R_M |Immediate_Ib, C_SHR, D__Ev, D__Ib, D__NONE, "SHR", }, //0x5
{R_M |Immediate_Ib, C_SAL, D__Ev, D__Ib, D__NONE, "SAL", }, //0x6
{R_M |Immediate_Ib, C_SAR, D__Ev, D__Ib, D__NONE, "SAR", } //0x7
};
DIS_OPCODE_T Group0xc6[] = //mov group
{
{R_M |Immediate_Ib, C_MOV, D_wEb, D__Ib, D__NONE, "MOV", }, //0x0
{R_M, C_NULL }, //0x1
{R_M, C_NULL }, //0x2
{R_M, C_NULL }, //0x3
{R_M, C_NULL }, //0x4
{R_M, C_NULL }, //0x5
{R_M, C_NULL }, //0x6
{R_M, C_NULL }, //0x7
};
DIS_OPCODE_T Group0xc7[] = //mov group
{
{R_M |Immediate_Iv, C_MOV, D_wEv, D__Iv, D__NONE, "MOV", }, //0x0
{R_M, C_NULL }, //0x1
{R_M, C_NULL }, //0x2
{R_M, C_NULL }, //0x3
{R_M, C_NULL }, //0x4
{R_M, C_NULL }, //0x5
{R_M, C_NULL }, //0x6
{R_M, C_NULL }, //0x7
};
DIS_OPCODE_T Group0xd0[] = //shift group
{
{R_M |Immediate_1, C_ROL, D__Eb, D__1, D__NONE, "ROL", }, //0x0
{R_M |Immediate_1, C_ROR, D__Eb, D__1, D__NONE, "ROR", }, //0x1
{R_M |Immediate_1, C_RCL, D__Eb, D__1, D__NONE, "RCL", }, //0x2
{R_M |Immediate_1, C_RCR, D__Eb, D__1, D__NONE, "RCR", }, //0x3
{R_M |Immediate_1, C_SHL, D__Eb, D__1, D__NONE, "SHL", }, //0x4
{R_M |Immediate_1, C_SHR, D__Eb, D__1, D__NONE, "SHR", }, //0x5
{R_M |Immediate_1, C_SAL, D__Eb, D__1, D__NONE, "SAL", }, //0x6
{R_M |Immediate_1, C_SAR, D__Eb, D__1, D__NONE, "SAR", } //0x7
};
DIS_OPCODE_T Group0xd1[] = //shift group
{
{R_M |Immediate_1, C_ROL, D__Ev, D__1, D__NONE, "ROL", }, //0x0
{R_M |Immediate_1, C_ROR, D__Ev, D__1