Beispiel #1
0
// disassemble from address 1 to address 2
unsigned int disassemble(uint16 addr1, uint16 addr2)
{
	uint8 instr;
	int count, line;
    char string1[128];
    char string2[128];

	addr = addr1;

	count = (addr2 == 0) ? 24 : 0;
    line = 0;
    memory = memory5200;

    clrEmuScreen(0x00);
	while ((addr < addr2 || count > 0) && (addr < 0xFFFC)) {
		sprintf(msg, "%x: ", addr);
		printXY(msg, 0, line * 8, 11);

		instr = memory[addr];
		addr++;

        sprintf(string2, "  ");
		show_opcode(string1, instr);
		show_operand(string2, instr);
		sprintf(msg, "%s    %s", string1, string2);
		printXY(msg, 48, line * 8, 12);
		line++;
		if (count > 0)
			count--;
	}
	BlitBuffer(0, 240);

	return addr;
}
Beispiel #2
0
std::string show(const DexInstruction* insn) {
  if (!insn) return "";
  std::ostringstream ss;
  ss << show_opcode(insn);
  bool first = true;
  if (insn->dests_size()) {
    ss << " v" << insn->dest();
    first = false;
  }
  for (unsigned i = 0; i < insn->srcs_size(); ++i) {
    if (!first) ss << ",";
    ss << " v" << insn->src(i);
    first = false;
  }
  if (dex_opcode::has_literal(insn->opcode())) {
    if (!first) ss << ",";
    ss << " " << insn->get_literal();
    first = false;
  }
  return ss.str();
}