diff --git a/src/main.cc b/src/main.cc index 09d88e9..c57cbd1 100644 --- a/src/main.cc +++ b/src/main.cc @@ -7,7 +7,7 @@ #include "api.h" #include "iigs.h" -const char *argp_program_version = "regs 0.2"; +const char *argp_program_version = "regs 1.1"; const char *argp_program_bug_address = "sean@seancode.com"; static char doc[] = "Disassemble Apple IIgs software"; static char args_doc[] = "FILE"; diff --git a/src/scanner.cc b/src/scanner.cc index 247835d..9953bf0 100644 --- a/src/scanner.cc +++ b/src/scanner.cc @@ -188,7 +188,19 @@ bool Scanner::disassemble(std::ostream &f, uint32_t from, uint32_t to, if (!sym.empty()) { f << sym << std::endl; } - f << hex(address, 6) << ": " << printInst(map[address]) << std::endl; + f << hex(address, 6) << ": "; + auto ptr = getAddress(address); + if (map[address]->length > 4) { + f << ".. .. .. .. "; + } else { + for (int i = 0; i < map[address]->length; i++) { + f << hex(ptr->r8(), 2) << " "; + } + for (int i = map[address]->length; i < 4; i++) { + f << " "; + } + } + f << printInst(map[address]) << std::endl; address += map[address]->length; } if (address < b->address + b->length) { @@ -218,7 +230,7 @@ void Scanner::dumpHex(std::ostream &f, uint32_t from, uint32_t to) { f << " "; ascii += " "; } - for (; j < 16 && !ptr->eof(); j++) { + for (; j < 16 && !ptr->eof() && i + j - skip < len; j++) { if (j == 8) { f << " "; ascii += " ";