instinfo.h

来自「Decompilation Dos Program is a technique」· C头文件 代码 · 共 75 行

H
75
字号
/*---------------------------------------------------------------------------*/
// DisC Decompilation Wizard
// written by
// Satish Kumar S
// satish@miel.mot.com
//
// Copyright 1999-2001 Satish Kumar S
//
// Permission is granted to use this software for research purposes as
// long as this notice stays attached to this software.
/*---------------------------------------------------------------------------*/
#ifndef _INSTINFO_H		// InstInfo.h
#define _INSTINFO_H

#include "Global.h"
#include "MyString.h"
#include "Variable.h"
class InstInfo
{
public:
  int Instr;			// Operation.

  int operSize1;
  int Operand1;			// Type of operand.
  Word Data11;			// Operand 1. (Value depends on the Type).
  Sword Data12;			// Used for indexing addr. modes.

  int operSize2;
  int Operand2;
  Word Data21;
  Sword Data22;

  void Clear();
  void SwapOperands();
  String GetOperand(int oper,String *Regs,int getName=1);
  inline String GetOperand1(String *Regs,int getName=1)
  { return GetOperand(1,Regs,getName); }
  inline String GetOperand2(String *Regs,int getName=1)
  { return GetOperand(2,Regs,getName); }
  Variable &GetVariable(Variable &t,int whichVar);
  Variable &SetVariable(Variable &t,int whichVar);
};
// Values for the Registers in the same order they appear in the machine code
enum {
	REG_AL=0, REG_CL, REG_DL, REG_BL, REG_AH, REG_CH, REG_DH, REG_BH,
	REG_AX,   REG_CX, REG_DX, REG_BX, REG_SP, REG_BP, REG_SI, REG_DI,
	REG_ES,   REG_CS, REG_SS, REG_DS
	};

// Values for Instr.
enum {
	UNKNOWN=-1, PUSH, POP, CALL, RET,
	LEA, CBW, CWD, INC, DEC, JMP,
	MOV, ADD, SUB, AND, OR, XOR,		// Order is very important!!
	ADC, SBB, CMP,
	TEST, NOT, NEG, MUL, IMUL, DIV, IDIV,
	ROL, ROR, RCL, RCR, SHL, SHR, SAL, SAR,
	JA, JAE, JB, JBE, JZ, JNZ, JG, JGE, JL, JLE,
	JO, JNO, JS, JNS, JPE, JPO,
	LOOPZ, LOOPNZ, LOOP, JCXZ,
	SEGMENT, LES
	};
// Values for Operands 1&2.
enum {
	OPER_UNKNOWN=-1,
	REG_DIRECT,REG_INDIRECT,INDEXED_BYTE,INDEXED_WORD,
	MEMORY,IMMEDIATE
	};
// Values for Data11/21 if Operand1/2=INDEXED_xxxx mode
enum {
	INDX_BX_SI, INDX_BX_DI, INDX_BP_SI, INDX_BP_DI,
	INDX_SI,    INDX_DI,    INDX_BP,    INDX_BX
	};

#endif				// InstInfo.h

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?