added hex back in

This commit is contained in:
Sean 2020-02-23 17:19:47 -07:00
parent 97380c589b
commit b48d9185f7
2 changed files with 15 additions and 3 deletions

View File

@ -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";

View File

@ -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 += " ";