static char dos_drive_root[260] = ".";
+static char dos_initial_host_path[520];
+static char dos_initial_guest_path[260];
+
+const char *dos_register_initial_program (const char *path) {
+
+ const char *base = path;
+ const char *p;
+
+ for (p = path; *p; p++) {
+
+ if (*p == '/' || *p == '\\') {
+ base = p + 1;
+ }
+
+ }
+
+ snprintf (dos_initial_host_path, sizeof (dos_initial_host_path), "%s", path);
+ snprintf (dos_initial_guest_path, sizeof (dos_initial_guest_path), "C:\\%s", base);
+
+ return dos_initial_guest_path;
+
+}
+
static int dos_is_drive_root_path (const char *path) {
size_t len = strlen (path);
return;
}
+ if (in && dos_initial_guest_path[0] && strcasecmp (in, dos_initial_guest_path) == 0) {
+
+ snprintf (out, out_sz, "%s", dos_initial_host_path);
+ return;
+
+ }
+
tmp[0] = '\0';
dos_append_bounded (tmp, sizeof (tmp), in ? in : "");
void handle_interrupt (CPU8086 *cpu, uint8_t interrupt_number);
void native_interrupt (CPU8086 *cpu, uint8_t interrupt_number);
+const char *dos_register_initial_program (const char *path);
+
#endif /* _INTERRUPTS_H */
CPU8086 cpu;
const char *path = NULL;
+ const char *dos_path;
+
char cmd_tail[128] = {0};
int trace = 0, rc;
}
cpu_reset (&cpu, mem, MEM_SIZE);
+ dos_path = dos_register_initial_program (path);
if (load_mz_file (path, &cpu, EXE_LOAD_SEG << 4, (uint16_t) ((MEM_SIZE - ((uint32_t) (EXE_LOAD_SEG << 4) << 4)) / 16))) {
- init_psp (path, &cpu, cmd_tail, EXE_LOAD_SEG);
+ init_psp (dos_path, &cpu, cmd_tail, EXE_LOAD_SEG);
} else if (load_com_file (path, &cpu, mem, MEM_SIZE, EXE_LOAD_SEG, &loaded)) {
- init_psp (path, &cpu, cmd_tail, EXE_LOAD_SEG);
+ init_psp (dos_path, &cpu, cmd_tail, EXE_LOAD_SEG);
} else {
fprintf (stderr, "Failed to load %s\n", path);