From a4b73b992202fb0d0b3da08cee05e0da16be7e59 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sat, 11 Oct 2014 21:42:33 -0700 Subject: Fix translation of 68K address to buffer location when address_off != 0 --- dis.c | 12 ++++++------ vos_program_module.o | Bin 5360 -> 17752 bytes 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dis.c b/dis.c index c6216c9..b7a11fc 100644 --- a/dis.c +++ b/dis.c @@ -235,7 +235,7 @@ int main(int argc, char ** argv) encoded = NULL; address = def->address; if (!is_visited(address)) { - encoded = filebuf + address/2; + encoded = filebuf + (address - address_off)/2; } tmpd = def; def = def->next; @@ -245,7 +245,7 @@ int main(int argc, char ** argv) break; } for(;;) { - if (address > filesize) { + if (address > address_end || address < address_off) { break; } visit(address); @@ -262,7 +262,7 @@ int main(int argc, char ** argv) if (instbuf.op == M68K_BCC || instbuf.op == M68K_DBCC || instbuf.op == M68K_BSR) { if (instbuf.op == M68K_BCC && instbuf.extra.cond == COND_TRUE) { address = instbuf.address + 2 + instbuf.src.params.immed; - encoded = filebuf + address/2; + encoded = filebuf + (address - address_off)/2; reference(address); if (is_visited(address)) { break; @@ -275,13 +275,13 @@ int main(int argc, char ** argv) } else if(instbuf.op == M68K_JMP) { if (instbuf.src.addr_mode == MODE_ABSOLUTE || instbuf.src.addr_mode == MODE_ABSOLUTE_SHORT) { address = instbuf.src.params.immed; - encoded = filebuf + address/2; + encoded = filebuf + (address - address_off)/2; if (is_visited(address)) { break; } } else if (instbuf.src.addr_mode = MODE_PC_DISPLACE) { address = instbuf.src.params.regs.displacement + instbuf.address + 2; - encoded = filebuf + address/2; + encoded = filebuf + (address - address_off)/2; if (is_visited(address)) { break; } @@ -305,7 +305,7 @@ int main(int argc, char ** argv) } puts(""); } - for (address = address_off; address < filesize; address+=2) { + for (address = address_off; address < address_end; address+=2) { if (is_visited(address)) { encoded = filebuf + (address-address_off)/2; m68k_decode(encoded, &instbuf, address); diff --git a/vos_program_module.o b/vos_program_module.o index 3066b9d..5208bcf 100644 Binary files a/vos_program_module.o and b/vos_program_module.o differ -- cgit v1.2.3