diff --git a/display/type340.c b/display/type340.c index 2e65617..32fc8cf 100644 --- a/display/type340.c +++ b/display/type340.c @@ -115,9 +115,7 @@ enum jump_type { DJP=2, DJS=3, DDS=1 }; /* type 347 */ /* put all the state in a struct "just in case" */ static struct type340 { -#ifdef NOTYET ty340word DAC; /* Display Address Counter */ -#endif ty340word status; /* see ST340_XXX in type340.h */ signed short xpos, ypos; /* 10 bits, signed (for OOB checks) */ char initialized; /* 0 before display_init */ @@ -143,7 +141,6 @@ static struct type340 { #define UNIT(N) (u340+(N)) #endif -#if 0 /* NOT USED WITH PDP-6 Type 344 Interface!! */ void ty340_set_dac(ty340word addr) @@ -157,7 +154,50 @@ ty340_set_dac(ty340word addr) u->status = 0; /* XXX just clear stopped? */ ty340_rfd(); /* ready for data */ } + +void +ty340_cycle(void) +{ + struct type340 *u = UNIT(0); + + if (u->status == 0) { + ty340word insn = ty340_fetch(u->DAC); + u->status = ty340_instruction (insn); + u->DAC = (u->DAC + 1) & 07777; + } +} + +ty340word +ty340_get_dac(void) +{ + struct type340 *u = UNIT(0); + return u->DAC; +} + +ty340word +ty340_get_asr(void) +{ +#if TYPE347 + struct type340 *u = UNIT(0); + return u->ASR; +#else + return 0; #endif +} + +ty340word +ty340_sense(ty340word flags) +{ + struct type340 *u = UNIT(0); + return u->status & flags; +} + +void +ty340_clear(ty340word flags) +{ + struct type340 *u = UNIT(0); + u->status &= ~flags; +} ty340word ty340_reset(void *dptr) diff --git a/display/type340.h b/display/type340.h index 1c39dc1..5caf06d 100644 --- a/display/type340.h +++ b/display/type340.h @@ -49,7 +49,13 @@ typedef unsigned int ty340word; ty340word ty340_reset(void *); ty340word ty340_status(void); ty340word ty340_instruction(ty340word inst); +ty340word ty340_get_dac(void); +ty340word ty340_get_asr(void); +ty340word ty340_sense(ty340word); void ty340_set_dac(ty340word addr); +void ty340_clear(ty340word addr); +void ty340_cycle(void); +void ty340_set_status(ty340word); void ty342_set_grid(int, int); /* diff --git a/sim_fio.c b/sim_fio.c index 9bfecde..6fef8ea 100644 --- a/sim_fio.c +++ b/sim_fio.c @@ -782,7 +782,9 @@ else { return NULL; } strlcpy (fullpath, dir, tot_len); - strlcat (fullpath, "/", tot_len); + if ((dir[strlen (dir) - 1] != '/') && /* if missing a trailing directory separator? */ + (dir[strlen (dir) - 1] != '\\')) + strlcat (fullpath, "/", tot_len); /* then add one */ strlcat (fullpath, filepath, tot_len); } while ((c = strchr (fullpath, '\\'))) /* standardize on / directory separator */ diff --git a/sim_tape.c b/sim_tape.c index 89cd09e..4a24d1b 100644 --- a/sim_tape.c +++ b/sim_tape.c @@ -816,7 +816,16 @@ switch (MT_GET_FMT (uptr)) { break; } if (r != SCPE_OK) { /* error? */ - r = sim_messagef (r, "Can't open %s format tape image: %s\n", _sim_tape_format_name (uptr), cptr); + switch (MT_GET_FMT (uptr)) { + case MTUF_F_ANSI: + case MTUF_F_TAR: + case MTUF_F_FIXED: + r = sim_messagef (r, "Error opening %s format internal tape image generated from: %s\n", _sim_tape_format_name (uptr), cptr); + break; + default: + r = sim_messagef (r, "Error opening %s format tape image: %s - %s\n", _sim_tape_format_name (uptr), cptr, strerror(errno)); + break; + } if (auto_format) /* format was specified at attach time? */ sim_tape_set_fmt (uptr, 0, "SIMH", NULL); /* restore default format */ uptr->recsize = 0; @@ -4416,24 +4425,27 @@ HDR2 hdr2; HDR3 hdr3; HDR4 hdr4; -memset (&statb, 0, sizeof (statb)); -if (stat (filename, &statb)) { - sim_printf ("Can't stat: %s\n", filename); - return -1; - } -if (S_IFDIR & statb.st_mode) { - sim_printf ("Can't put a directory on tape: %s\n", filename); - return -1; - } -if (!(S_IFREG & statb.st_mode)) { - sim_printf ("Can't put a non regular file on tape: %s\n", filename); - return -1; - } f = fopen (filename, "rb"); if (f == NULL) { sim_printf ("Can't open: %s - %s\n", filename, strerror(errno)); return errno; } +memset (&statb, 0, sizeof (statb)); +if (fstat (fileno (f), &statb)) { + sim_printf ("Can't stat: %s\n", filename); + fclose (f); + return -1; + } +if (S_IFDIR & statb.st_mode) { + sim_printf ("Can't put a directory on tape: %s\n", filename); + fclose (f); + return -1; + } +if (!(S_IFREG & statb.st_mode)) { + sim_printf ("Can't put a non regular file on tape: %s\n", filename); + fclose (f); + return -1; + } tape_classify_file_contents (f, &max_record_size, &lf_line_endings, &crlf_line_endings); ansi_make_HDR1 (&hdr1, &tape->vol1, &hdr4, filename, tape->ansi_type); sprintf (file_sequence, "%04d", 1 + tape->file_count);