Line 25... |
Line 25... |
private:
|
private:
|
Type _type;
|
Type _type;
|
int _value;
|
int _value;
|
public:
|
public:
|
Operand(Type t,int value);
|
Operand(Type t,int value);
|
|
|
Type type() const;
|
Type type() const;
|
int value() const;
|
int value() const;
|
std::string str() const;
|
|
};
|
};
|
|
|
std::istream &_is;
|
std::istream &_is;
|
std::ostream &_os;
|
std::ostream &_os;
|
Format _fmt;
|
Format _fmt;
|
|
bool _preferAliases;
|
int _lineNumber;
|
int _lineNumber;
|
Word _pos;
|
Word _pos;
|
public:
|
public:
|
Disassembler(std::istream &is,std::ostream &os);
|
Disassembler(std::istream &is,std::ostream &os);
|
void setFormat(Format fmt);
|
void setFormat(Format fmt);
|
void setBase(Word base);
|
void setBase(Word base);
|
|
void setPreferAliases(bool b);
|
void dump();
|
void dump();
|
|
|
template <typename T> static std::string hex(const T &w) {
|
template <typename T> static std::string hex(const T &w) {
|
static_assert(std::is_integral<T>::value,"Argument must be of integral type");
|
static_assert(std::is_integral<T>::value,"Argument must be of integral type");
|
const char *hexstr="0123456789ABCDEF";
|
const char *hexstr="0123456789ABCDEF";
|
Line 56... |
Line 56... |
}
|
}
|
return res;
|
return res;
|
}
|
}
|
private:
|
private:
|
bool getWord(Word &w);
|
bool getWord(Word &w);
|
|
std::string str(const Operand &op);
|
static Operand decodeRd1Operand(Word w);
|
static Operand decodeRd1Operand(Word w);
|
static Operand decodeRd2Operand(Word w);
|
static Operand decodeRd2Operand(Word w);
|
static Operand decodeDstOperand(Word w);
|
static Operand decodeDstOperand(Word w);
|
static std::string decodeSimpleInstruction(const std::string &op,Word w);
|
|
|
|
|
std::string decodeSimpleInstruction(const std::string &op,Word w);
|
std::string decodeAdd(Word w);
|
std::string decodeAdd(Word w);
|
std::string decodeAnd(Word w);
|
std::string decodeAnd(Word w);
|
std::string decodeCall(Word w);
|
std::string decodeCall(Word w);
|
std::string decodeCjmpxx(Word w);
|
std::string decodeCjmpxx(Word w);
|
std::string decodeDivs(Word w);
|
std::string decodeDivs(Word w);
|
std::string decodeDivu(Word w);
|
std::string decodeDivu(Word w);
|
std::string decodeHlt(Word w);
|
std::string decodeHlt(Word w);
|
std::string decodeJmp(Word w);
|
std::string decodeJmp(Word w);
|
std::string decodeLc(Word w,bool &valid,Word &operand);
|
std::string decodeLc(Word w,bool &valid,Word &operand);
|
|
std::string decodeLcs(Word w);
|
std::string decodeLsb(Word w);
|
std::string decodeLsb(Word w);
|
std::string decodeLub(Word w);
|
std::string decodeLub(Word w);
|
std::string decodeLw(Word w);
|
std::string decodeLw(Word w);
|
std::string decodeMods(Word w);
|
std::string decodeMods(Word w);
|
std::string decodeModu(Word w);
|
std::string decodeModu(Word w);
|