cpu.apu.lastCycle = UNKNOWN_CYCLE;
#endif
- memset (& cpu.PPR, 0, sizeof (struct ppr_s));
-
+ memset (& cpu.PPR, 0, sizeof (struct ppr_s));
// setup_scbank_map ();
tidy_cu ();
return SCPE_OK;
}
-#ifndef NO_EV_POLL
-static uv_loop_t * ev_poll_loop;
-static uv_timer_t ev_poll_handle;
-#endif
+//#ifndef NO_EV_POLL
+//static uv_loop_t * ev_poll_loop;
+//static uv_timer_t ev_poll_handle;
+//#endif
static MTAB cpu_mod[] =
{
}
#endif
-#ifndef NO_EV_POLL
-// The 100Hz timer as expired; poll I/O
-
-static void ev_poll_cb (uv_timer_t * UNUSED handle)
- {
- // Call the one hertz stuff every 100 loops
- static uint oneHz = 0;
- if (oneHz ++ >= sys_opts.sys_slow_poll_interval) // ~ 1Hz
- {
- oneHz = 0;
- rdrProcessEvent ();
-#ifdef STATS
- do_stats ();
-#endif
- cpu.instrCntT0 = cpu.instrCntT1;
- cpu.instrCntT1 = cpu.instrCnt;
-
- }
+//#ifndef NO_EV_POLL
+//// The 100Hz timer as expired; poll I/O
+//
+//static void ev_poll_cb (uv_timer_t * UNUSED handle)
+// {
+// // Call the one hertz stuff every 100 loops
+// static uint oneHz = 0;
+// if (oneHz ++ >= sys_opts.sys_slow_poll_interval) // ~ 1Hz
+// {
+// oneHz = 0;
+// rdrProcessEvent ();
+//#ifdef STATS
+// do_stats ();
+//#endif
+// cpu.instrCntT0 = cpu.instrCntT1;
+// cpu.instrCntT1 = cpu.instrCnt;
+//
+// }
// fnpProcessEvent ();
//#ifndef __MINGW64__
// sk_process_event ();
// absi_process_event ();
//#endif
// PNL (panel_process_event ());
- }
-#endif
+// }
+//#endif
// called once initialization
get_serial_number ();
-#ifndef NO_EV_POLL
- ev_poll_loop = uv_default_loop ();
- uv_timer_init (ev_poll_loop, & ev_poll_handle);
- // 10 ms == 100Hz
- uv_timer_start (& ev_poll_handle, ev_poll_cb, sys_opts.sys_poll_interval, sys_opts.sys_poll_interval);
-#endif
+//#ifndef NO_EV_POLL
+// ev_poll_loop = uv_default_loop ();
+// uv_timer_init (ev_poll_loop, & ev_poll_handle);
+// // 10 ms == 100Hz
+// uv_timer_start (& ev_poll_handle, ev_poll_cb, sys_opts.sys_poll_interval, sys_opts.sys_poll_interval);
+//#endif
// TODO: reset *all* other structures to zero
#include <sys/stat.h>
#include <unistd.h>
#include "definition_dcls.h"
+#include "dps8/dps8.h"
+#include "dps8/dps8_cpu.h"
#include "object_map.h"
#include "rassert.h"
}
int main(int argc, char **argv) {
- if (argc < 2) {
- printf("usage: %s executable [arguments]\n", argv[0]);
+ if (argc < 3) {
+ printf(
+ "usage: %s object_segment_name entry_segment$entry_name [arguments]\n",
+ argv[0]
+ );
exit(EXIT_FAILURE);
}
+ char *object_segment_name = argv[1];
+ char *entry_segment, *entry_name;
+ {
+ char *p = strchr(argv[2], '$');
+ if (p) {
+ *p++ = 0;
+ entry_segment = argv[2];
+ entry_name = p;
+ }
+ else {
+ entry_segment = object_segment_name;
+ entry_name = argv[2];
+ }
+ }
int fd;
int path_index;
for (path_index = 0; path_index < N_PATHS; ++path_index) {
char name[0x1000];
- rassert(strlen(paths[path_index]) + strlen(argv[1]) < sizeof(name));
+ rassert(strlen(paths[path_index]) + strlen(object_segment_name) < sizeof(name));
strcpy(name, paths[path_index]);
- strcat(name, argv[1]);
+ strcat(name, object_segment_name);
fd = open(name, O_RDONLY);
if (fd != -1)
- goto found_path;
+ goto found_object_segment;
}
- fprintf(stderr, "can't find %s in paths list\n", argv[1]);
+ fprintf(
+ stderr,
+ "can't find object segment %s in paths list\n",
+ object_segment_name
+ );
exit(EXIT_FAILURE);
-found_path:
+found_object_segment:
;
uint64_t *object_segment = mmap(
NULL,
uint64_t bitcount;
{
- char name[0x1000];
- rassert(strlen(paths[path_index]) + 4 < sizeof(name));
- strcpy(name, paths[path_index]);
- strcat(name, ".dir");
+ char index_name[0x1000];
+ rassert(strlen(paths[path_index]) + 4 < sizeof(index_name));
+ strcpy(index_name, paths[path_index]);
+ strcat(index_name, ".dir");
- FILE *fp = fopen(name, "r");
+ FILE *fp = fopen(index_name, "r");
char line[0x100];
while (fgets(line, 0x100, fp)) {
char *p = strchr(line, ' ');
if (p) {
*p++ = 0;
- if (strcmp(line, argv[1]) == 0) {
+ if (strcmp(line, object_segment_name) == 0) {
bitcount = strtol(p, NULL, 0);
goto found_bitcount;
}
}
}
- fprintf(stderr, "can't find %s in %s\n", argv[1], name);
+ fprintf(
+ stderr,
+ "can't find object %s in index %s\n",
+ object_segment_name,
+ index_name
+ );
exit(EXIT_FAILURE);
}
(uint64_t *)definition_header + definition_relp
);
+#if 1
+ if (
+ definition->class == CLASS_TEXT &&
+ !definition->flags_ignore &&
+ definition->flags_entry
+ ) {
+ struct segname_definition *segname_definition =
+ (struct segname_definition *)(
+ (uint64_t *)definition_header + definition->segname_relp
+ );
+ rassert(segname_definition->class == CLASS_SEGNAME);
+
+ char definition_segment[0x20];
+ get_acc_string(
+ (uint64_t *)definition_header + segname_definition->name_relp,
+ definition_segment,
+ sizeof(definition_segment)
+ );
+
+ if (strcmp(definition_segment, entry_segment) == 0) {
+ char definition_name[0x20];
+ get_acc_string(
+ (uint64_t *)definition_header + definition->name_relp,
+ definition_name,
+ sizeof(definition_name)
+ );
+
+ if (strcmp(definition_name, entry_name) == 0)
+ goto found_entry;
+ }
+ }
+#else
char name[0x20];
get_acc_string(
(uint64_t *)definition_header + definition->name_relp,
name,
sizeof(name)
);
-
- if (definition->class == CLASS_SEGNAME)
- printf(
- "%06o segname \"%s\" first_relp %06o\n",
- definition_relp,
- name,
- ((struct segname_definition *)definition)->first_relp
- );
- else
- printf(
- "%06o %s \"%s\" segname_relp %06o\n",
- definition_relp,
- class_names[definition->class],
- name,
- definition->segname_relp
- );
+ printf(
+ "%06o %s \"%s\" ignore %d entry %d indirect %d thing_relp %06o %s_relp %06o\n",
+ definition_relp,
+ class_names[definition->class],
+ name,
+ definition->flags_ignore,
+ definition->flags_entry,
+ definition->flags_indirect,
+ definition->thing_relp,
+ definition->class == CLASS_SEGNAME ? "first" : "segname",
+ definition->segname_relp
+ );
+#endif
}
+ printf(
+ "can't find entry %s$%s in object %s\n",
+ entry_segment,
+ entry_name,
+ object_segment_name
+ );
+ exit(EXIT_FAILURE);
+
+found_entry:
+ ;
+ cpu_reset_unit_idx(0, false);
+ cpu.PPR.IC =
+ (object_map->text_offset + definition->thing_relp) & 0777777;
+
+ printf(
+ "entry %s$%s at %06o -> %012lo\n",
+ entry_segment,
+ entry_name,
+ cpu.PPR.IC,
+ object_segment[cpu.PPR.IC]
+ );
+
return 0;
}