summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--68kinst.c2
-rw-r--r--blastem.c5
-rw-r--r--dis.c21
-rw-r--r--m68k_to_x86.c3
-rw-r--r--m68k_to_x86.h2
5 files changed, 32 insertions, 1 deletions
diff --git a/68kinst.c b/68kinst.c
index 580d8a5..8ce25ba 100644
--- a/68kinst.c
+++ b/68kinst.c
@@ -448,7 +448,7 @@ uint16_t * m68k_decode(uint16_t * istream, m68kinst * decoded, uint32_t address)
return start+1;
}
istream = m68k_decode_op_ex(istream, opmode, reg, decoded->extra.size, &(decoded->dst));
- if (!istream) {
+ if (!istream || decoded->dst.addr_mode == MODE_IMMEDIATE) {
decoded->op = M68K_INVALID;
return start+1;
}
diff --git a/blastem.c b/blastem.c
index 3e6e235..33bf145 100644
--- a/blastem.c
+++ b/blastem.c
@@ -803,12 +803,16 @@ int main(int argc, char ** argv)
int width = -1;
int height = -1;
int debug = 0;
+ FILE *address_log = NULL;
for (int i = 2; i < argc; i++) {
if (argv[i][0] == '-') {
switch(argv[i][1]) {
case 'd':
debug = 1;
break;
+ case 'l':
+ address_log = fopen("address.log", "w");
+ break;
default:
fprintf(stderr, "Unrecognized switch %s\n", argv[i]);
return 1;
@@ -828,6 +832,7 @@ int main(int argc, char ** argv)
vdp_context v_context;
init_x86_68k_opts(&opts);
+ opts.address_log = address_log;
init_68k_context(&context, opts.native_code_map, &opts);
init_vdp_context(&v_context);
context.next_context = &v_context;
diff --git a/dis.c b/dis.c
index 109d24d..99355eb 100644
--- a/dis.c
+++ b/dis.c
@@ -82,6 +82,7 @@ int main(int argc, char ** argv)
deferred *def = NULL, *tmpd;
for(uint8_t opt = 2; opt < argc; ++opt) {
if (argv[opt][0] == '-') {
+ FILE * address_log;
switch (argv[opt][1])
{
case 'l':
@@ -93,6 +94,26 @@ int main(int argc, char ** argv)
case 'o':
only = 1;
break;
+ case 'f':
+ opt++;
+ if (opt >= argc) {
+ fputs("-f must be followed by a filename\n", stderr);
+ exit(1);
+ }
+ address_log = fopen(argv[opt], "r");
+ if (!address_log) {
+ fprintf(stderr, "Failed to open %s for reading\n", argv[opt]);
+ exit(1);
+ }
+ while (fgets(disbuf, sizeof(disbuf), address_log)) {
+ if (disbuf[0]) {
+ uint32_t address = strtol(disbuf, NULL, 16);
+ if (address) {
+ def = defer(address, def);
+ reference(address);
+ }
+ }
+ }
}
} else {
uint32_t address = strtol(argv[opt], NULL, 16);
diff --git a/m68k_to_x86.c b/m68k_to_x86.c
index 007c3f3..377c0da 100644
--- a/m68k_to_x86.c
+++ b/m68k_to_x86.c
@@ -3782,6 +3782,9 @@ uint8_t * translate_m68k_stream(uint32_t address, m68k_context * context)
exit(1);
}
do {
+ if (opts->address_log) {
+ fprintf(opts->address_log, "%X\n", address);
+ }
do {
if (dst_end-dst < MAX_NATIVE_SIZE) {
if (dst_end-dst < 5) {
diff --git a/m68k_to_x86.h b/m68k_to_x86.h
index 7b216c9..fdfaa4b 100644
--- a/m68k_to_x86.h
+++ b/m68k_to_x86.h
@@ -1,4 +1,5 @@
#include <stdint.h>
+#include <stdio.h>
#include "68kinst.h"
#define NUM_MEM_AREAS 4
@@ -30,6 +31,7 @@ typedef struct {
uint8_t *cur_code;
uint8_t *code_end;
uint8_t **ram_inst_sizes;
+ FILE *address_log;
} x86_68k_options;
typedef struct {