summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-04-11 20:56:54 -0700
committerMichael Pavone <pavone@retrodev.com>2016-04-11 20:56:54 -0700
commitd62ce280764beb725bf03b6e4508c73f3c23d224 (patch)
treeef5b3af1c08e07a88198acaf5a495d4aa20b3fad
parent2ca987e9d2ff6c012bda54ba47b3f7a57d576284 (diff)
parent31f5791bd9d205a0f28e3e734c5328e743939ad7 (diff)
Merge
-rw-r--r--blastem.c14
-rw-r--r--default.cfg1
-rw-r--r--dis.c32
3 files changed, 41 insertions, 6 deletions
diff --git a/blastem.c b/blastem.c
index 1ec1319..f04f953 100644
--- a/blastem.c
+++ b/blastem.c
@@ -27,8 +27,8 @@
#define MCLKS_NTSC 53693175
#define MCLKS_PAL 53203395
-#define MCLKS_PER_68K 7
-#define MCLKS_PER_YM MCLKS_PER_68K
+uint32_t MCLKS_PER_68K;
+#define MCLKS_PER_YM 7
#define MCLKS_PER_Z80 15
#define MCLKS_PER_PSG (MCLKS_PER_Z80*16)
#define DEFAULT_SYNC_INTERVAL MCLKS_LINE
@@ -1086,7 +1086,7 @@ int main(int argc, char ** argv)
uint8_t menu = !loaded;
if (!loaded) {
//load menu
- romfname = tern_find_path(config, "ui\rom\0").ptrval;
+ romfname = tern_find_path(config, "ui\0rom\0").ptrval;
if (!romfname) {
romfname = "menu.bin";
}
@@ -1109,6 +1109,14 @@ int main(int argc, char ** argv)
loaded = 1;
}
+ char *m68k_divider = tern_find_path(config, "clocks\0m68k_divider\0").ptrval;
+ if (!m68k_divider) {
+ m68k_divider = "7";
+ }
+ MCLKS_PER_68K = atoi(m68k_divider);
+ if (!MCLKS_PER_68K) {
+ MCLKS_PER_68K = 7;
+ }
ram = malloc(RAM_WORDS * sizeof(uint16_t));
memmap_chunk base_map[] = {
{0xE00000, 0x1000000, 0xFFFF, 0, MMAP_READ | MMAP_WRITE | MMAP_CODE, ram,
diff --git a/default.cfg b/default.cfg
index 2216a8c..ab02353 100644
--- a/default.cfg
+++ b/default.cfg
@@ -116,6 +116,7 @@ audio {
}
clocks {
+ m68k_divider 7
max_cycles 3420
speeds {
1 150
diff --git a/dis.c b/dis.c
index 0c3207a..dc3c98a 100644
--- a/dis.c
+++ b/dis.c
@@ -8,8 +8,10 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
+#include <ctype.h>
#include "vos_program_module.h"
#include "tern.h"
+#include "util.h"
uint8_t visited[(16*1024*1024)/16];
uint16_t label[(16*1024*1024)/8];
@@ -123,6 +125,22 @@ int label_fun(char *dst, uint32_t address, void * data)
}
}
+char * strip_ws(char * text)
+{
+ while (*text && (!isprint(*text) || isblank(*text)))
+ {
+ text++;
+ }
+ char * ret = text;
+ text = ret + strlen(ret) - 1;
+ while (text > ret && (!isprint(*text) || isblank(*text)))
+ {
+ *text = 0;
+ text--;
+ }
+ return ret;
+}
+
int main(int argc, char ** argv)
{
long filesize;
@@ -133,6 +151,7 @@ int main(int argc, char ** argv)
deferred *def = NULL, *tmpd;
uint8_t labels = 0, addr = 0, only = 0, vos = 0, reset = 0;
+ tern_node * named_labels = NULL;
for(uint8_t opt = 2; opt < argc; ++opt) {
if (argv[opt][0] == '-') {
@@ -167,18 +186,26 @@ int main(int argc, char ** argv)
}
while (fgets(disbuf, sizeof(disbuf), address_log)) {
if (disbuf[0]) {
- uint32_t address = strtol(disbuf, NULL, 16);
+ char *end;
+ uint32_t address = strtol(disbuf, &end, 16);
if (address) {
def = defer(address, def);
reference(address);
+ if (*end == '=') {
+ named_labels = add_label(named_labels, strip_ws(end+1), address);
+ }
}
}
}
}
} else {
- uint32_t address = strtol(argv[opt], NULL, 16);
+ char *end;
+ uint32_t address = strtol(argv[opt], &end, 16);
def = defer(address, def);
reference(address);
+ if (*end == '=') {
+ named_labels = add_label(named_labels, end+1, address);
+ }
}
}
@@ -187,7 +214,6 @@ int main(int argc, char ** argv)
filesize = ftell(f);
fseek(f, 0, SEEK_SET);
- tern_node * named_labels = NULL;
char int_key[MAX_INT_KEY_SIZE];
uint32_t address_off, address_end;
if (vos)