I7000: Fixed tape handling errors and coverity errors.

This commit is contained in:
Richard Cornwell 2019-06-09 15:22:11 -04:00
parent 9ab8d0e91e
commit 97ea1cf463
3 changed files with 33 additions and 41 deletions

View file

@ -184,7 +184,7 @@ MTAB ht_mod[] = {
"no Write ring in place"}, "no Write ring in place"},
{MTAB_XTD | MTAB_VUN, 0, "FORMAT", "FORMAT", {MTAB_XTD | MTAB_VUN, 0, "FORMAT", "FORMAT",
&sim_tape_set_fmt, &sim_tape_show_fmt, NULL, &sim_tape_set_fmt, &sim_tape_show_fmt, NULL,
"Set/Display tape format (SIMH, E11, TPC, P7B, AWS, TAR)" }, "Set/Display tape format (SIMH, E11, TPC, P7B)" },
{MTAB_XTD | MTAB_VUN, 0, "LENGTH", "LENGTH", {MTAB_XTD | MTAB_VUN, 0, "LENGTH", "LENGTH",
NULL, &sim_tape_show_capac, NULL, NULL, &sim_tape_show_capac, NULL,
"Set unit n capacity to arg MB (0 = unlimited)" }, "Set unit n capacity to arg MB (0 = unlimited)" },

View file

@ -254,7 +254,7 @@ MTAB mt_mod[] = {
#endif #endif
{MTAB_XTD | MTAB_VUN, 0, "FORMAT", "FORMAT", {MTAB_XTD | MTAB_VUN, 0, "FORMAT", "FORMAT",
&sim_tape_set_fmt, &sim_tape_show_fmt, NULL, &sim_tape_set_fmt, &sim_tape_show_fmt, NULL,
"Set/Display tape format (SIMH, E11, TPC, P7B, AWS, TAR)" }, "Set/Display tape format (SIMH, E11, TPC, P7B)"},
{MTAB_XTD | MTAB_VUN, 0, "LENGTH", "LENGTH", {MTAB_XTD | MTAB_VUN, 0, "LENGTH", "LENGTH",
&sim_tape_set_capac, &sim_tape_show_capac, NULL, &sim_tape_set_capac, &sim_tape_show_capac, NULL,
"Set unit n capacity to arg MB (0 = unlimited)" }, "Set unit n capacity to arg MB (0 = unlimited)" },
@ -604,12 +604,14 @@ uint32 mt_cmd(UNIT * uptr, uint16 cmd, uint16 dev)
case IO_SDL: case IO_SDL:
uptr->u5 |= MT_RDY; /* Command is quick */ uptr->u5 |= MT_RDY; /* Command is quick */
uptr->flags |= MTUF_LDN; uptr->flags |= MTUF_LDN;
sim_tape_set_dens (uptr, MT_DENS_200, NULL, NULL);
sim_debug(DEBUG_CMD, dptr, "SDN unit=%d low\n", unit); sim_debug(DEBUG_CMD, dptr, "SDN unit=%d low\n", unit);
return SCPE_OK; return SCPE_OK;
case IO_SDH: case IO_SDH:
uptr->u5 |= MT_RDY; /* Command is quick */ uptr->u5 |= MT_RDY; /* Command is quick */
uptr->flags &= ~MTUF_LDN; uptr->flags &= ~MTUF_LDN;
sim_tape_set_dens (uptr, MT_DENS_556, NULL, NULL);
sim_debug(DEBUG_CMD, dptr, "SDN unit=%d high\n", unit); sim_debug(DEBUG_CMD, dptr, "SDN unit=%d high\n", unit);
return SCPE_OK; return SCPE_OK;
@ -1334,21 +1336,13 @@ mt_ini(UNIT * uptr, t_bool f)
t_stat t_stat
mt_reset(DEVICE * dptr) mt_reset(DEVICE * dptr)
{ {
UNIT *uptr = dptr->units;
uint32 i;
for (i = 0; i < dptr->numunits; i++) {
sim_tape_set_dens (uptr,
((uptr->flags & MTUF_LDN) ? MT_DENS_200 : MT_DENS_556),
NULL, NULL);
uptr++;
}
return SCPE_OK; return SCPE_OK;
} }
t_stat t_stat
mt_tape_density(UNIT * uptr, int32 val, CONST char *cptr, void *desc) mt_tape_density(UNIT * uptr, int32 val, CONST char *cptr, void *desc)
{ {
return SCPE_OK; return sim_tape_set_dens(uptr, (val == MTUF_LDN) ? MT_DENS_200 : MT_DENS_556, NULL, NULL);
} }
t_stat t_stat
@ -1361,8 +1355,6 @@ mt_attach(UNIT * uptr, CONST char *file)
uptr->u3 = 0; uptr->u3 = 0;
uptr->u5 |= MT_RDY; uptr->u5 |= MT_RDY;
uptr->flags |= MTUF_ONLINE; uptr->flags |= MTUF_ONLINE;
uptr->dynflags = MT_200_VALID | MT_556_VALID |
(((uptr->flags & MTUF_LDN) ? MT_556_VALID : MT_200_VALID) < UNIT_V_DF_TAPE);
return SCPE_OK; return SCPE_OK;
} }

View file

@ -170,8 +170,8 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag)
} }
} }
} else if (match_ext(fnam, "oct")) { } else if (match_ext(fnam, "oct")) {
while (fgets(&buf[0], 160, fileref) != 0) { while (fgets((char *)buf, 80, fileref) != 0) {
for(p = &buf[0]; *p == ' ' || *p == '\t'; p++); for(p = (char *)buf; *p == ' ' || *p == '\t'; p++);
/* Grab address */ /* Grab address */
for(addr = 0; *p >= '0' && *p <= '7'; p++) for(addr = 0; *p >= '0' && *p <= '7'; p++)
addr = (addr << 3) + *p - '0'; addr = (addr << 3) + *p - '0';
@ -184,8 +184,8 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag)
} }
} }
} else if (match_ext(fnam, "txt")) { } else if (match_ext(fnam, "txt")) {
while (fgets(&buf[0], 160, fileref) != 0) { while (fgets((char *)buf, 80, fileref) != 0) {
for(p = &buf[0]; *p == ' ' || *p == '\t'; p++); for(p = (char *)buf; *p == ' ' || *p == '\t'; p++);
/* Grab address */ /* Grab address */
for(addr = 0; *p >= '0' && *p <= '7'; p++) for(addr = 0; *p >= '0' && *p <= '7'; p++)
addr = (addr << 3) + *p - '0'; addr = (addr << 3) + *p - '0';
@ -413,31 +413,31 @@ parse_sym(CONST char *cptr, t_addr addr, UNIT * uptr, t_value * val, int32 sw)
if (sw & SWMASK('M')) { if (sw & SWMASK('M')) {
t_opcode *op; t_opcode *op;
do { i = 0;
i = 0; sign = 0;
sign = 0; f = 0;
f = 0; next:
if (*cptr == ',') { /* Skip blanks */
d <<= 18; while (isspace(*cptr))
cptr++; cptr++;
} /* Grab opcode */
/* Skip blanks */ cptr = get_glyph(cptr, opcode, ',');
while (isspace(*cptr))
cptr++;
/* Grab opcode */
cptr = get_glyph(cptr, opcode, ',');
if ((op = find_opcode(opcode, base_ops)) != 0) { if ((op = find_opcode(opcode, base_ops)) != 0) {
d |= (t_uint64) op->opbase << 12; d |= (t_uint64) op->opbase << 12;
} else { } else {
return STOP_UUO; return STOP_UUO;
} }
cptr = get_glyph(cptr, opcode, ','); cptr = get_glyph(cptr, opcode, ',');
tag = parse_addr(&cpu_dev, opcode, &arg); tag = parse_addr(&cpu_dev, opcode, &arg);
if (*arg != opcode[0]) if (*arg != opcode[0])
d += (t_value)tag; d += (t_value)tag;
} while (*cptr == ','); if (*cptr == ',') {
d <<= 18;
cptr++;
goto next;
}
if (*cptr != '\0') if (*cptr != '\0')
return STOP_UUO; return STOP_UUO;
*val = d; *val = d;