TAPE: Make sure that all tape record lengths are properly typed.

- Add Tape Format help options that include recently added format types to
  MTAB entries.
This commit is contained in:
Mark Pizzolato 2019-04-10 14:26:20 -07:00
parent f12bc70470
commit 9dbc800e58
9 changed files with 23 additions and 25 deletions

View file

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

View file

@ -254,7 +254,7 @@ MTAB mt_mod[] = {
#endif
{MTAB_XTD | MTAB_VUN, 0, "FORMAT", "FORMAT",
&sim_tape_set_fmt, &sim_tape_show_fmt, NULL,
"Set/Display tape format (SIMH, E11, TPC, P7B)"},
"Set/Display tape format (SIMH, E11, TPC, P7B, AWS, TAR)" },
{MTAB_XTD | MTAB_VUN, 0, "LENGTH", "LENGTH",
&sim_tape_set_capac, &sim_tape_show_capac, NULL,
"Set unit n capacity to arg MB (0 = unlimited)" },

View file

@ -186,8 +186,6 @@ MTAB ta_mod[] = {
NULL, NULL, NULL, "Write enable tape drive" },
{ MTUF_WLK, MTUF_WLK, "write locked", "LOCKED",
NULL, NULL, NULL, "Write lock tape drive" },
// { MTAB_XTD|MTAB_VUN, 0, "FORMAT", "FORMAT",
// &sim_tape_set_fmt, &sim_tape_show_fmt, NULL },
{ MTAB_XTD|MTAB_VUN, 0, "CAPACITY", NULL,
NULL, &sim_tape_show_capac, NULL, "Display tape capacity" },
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 020, "ADDRESS", "ADDRESS",

View file

@ -230,8 +230,8 @@ MTAB tm_mod[] = {
&tm_vlock, NULL, NULL, "Write enable tape drive" },
{ MTUF_WLK, MTUF_WLK, "write locked", "LOCKED",
&tm_vlock, NULL, NULL, "Write lock tape drive" },
{ MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "FORMAT", "FORMAT",
&sim_tape_set_fmt, &sim_tape_show_fmt, NULL, "Set/Display tape format (SIMH, E11, TPC, P7B)" },
{ MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "FORMAT", "FORMAT",
&sim_tape_set_fmt, &sim_tape_show_fmt, NULL, "Set/Display tape format (SIMH, E11, TPC, P7B, AWS, TAR)" },
{ MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "CAPACITY", "CAPACITY",
&sim_tape_set_capac, &sim_tape_show_capac, NULL, "Set/Display capacity" },
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 010, "ADDRESS", "ADDRESS",

View file

@ -502,8 +502,8 @@ MTAB tq_mod[] = {
NULL, &tq_show_ctrl, NULL, "Display complete controller state" },
{ MTAB_XTD|MTAB_VUN|MTAB_NMO, 0, "UNITQ", NULL,
NULL, &tq_show_unitq, NULL, "Display unit queue" },
{ MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "FORMAT", "FORMAT",
&sim_tape_set_fmt, &sim_tape_show_fmt, NULL, "Set/Display tape format (SIMH, E11, TPC, P7B)" },
{ MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "FORMAT", "FORMAT",
&sim_tape_set_fmt, &sim_tape_show_fmt, NULL, "Set/Display tape format (SIMH, E11, TPC, P7B, AWS, TAR)" },
{ MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "CAPACITY", "CAPACITY",
&sim_tape_set_capac, &sim_tape_show_capac, NULL, "Set/Display capacity" },
#if defined (VM_PDP11)

View file

@ -350,8 +350,8 @@ MTAB ts_mod[] = {
NULL, NULL, NULL, "Write enable tape drive" },
{ MTUF_WLK, MTUF_WLK, "write locked", "LOCKED",
NULL, NULL, NULL, "Write lock tape drive" },
{ MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "FORMAT", "FORMAT",
&sim_tape_set_fmt, &sim_tape_show_fmt, NULL, "Set/Display tape format (SIMH, E11, TPC, P7B)" },
{ MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "FORMAT", "FORMAT",
&sim_tape_set_fmt, &sim_tape_show_fmt, NULL, "Set/Display tape format (SIMH, E11, TPC, P7B, AWS, TAR)" },
{ MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "CAPACITY", "CAPACITY",
&sim_tape_set_capac, &sim_tape_show_capac, NULL, "Set/Display capacity" },
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 004, "ADDRESS", "ADDRESS",

View file

@ -319,8 +319,8 @@ MTAB tu_mod[] = {
NULL, NULL, NULL, "Set drive type to TU45" },
{ UNIT_TYPE, UNIT_TU77, "TU77", "TU77",
NULL, NULL, NULL, "Set drive type to TU77" },
{ MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "FORMAT", "FORMAT",
&sim_tape_set_fmt, &sim_tape_show_fmt, NULL, "Set/Display tape format (SIMH, E11, TPC, P7B)" },
{ MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "FORMAT", "FORMAT",
&sim_tape_set_fmt, &sim_tape_show_fmt, NULL, "Set/Display tape format (SIMH, E11, TPC, P7B, AWS, TAR)" },
{ MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "CAPACITY", "CAPACITY",
&sim_tape_set_capac, &sim_tape_show_capac, NULL, "Set unit n capacity to arg MB (0 = unlimited)" },
{ MTAB_XTD|MTAB_VUN|MTAB_NMO, 0, "CAPACITY", NULL,

View file

@ -871,7 +871,7 @@ else switch (f) { /* otherwise the read me
bufcntr = bufcap; /* mark the buffer as invalid to force a read */
*bc = MTR_GAP; /* reset the marker */
*bc = (t_mtrlnt)MTR_GAP; /* reset the marker */
runaway_counter -= sizeof_gap / 2; /* and decrement the gap counter */
}
@ -924,7 +924,7 @@ else switch (f) { /* otherwise the read me
case MTUF_F_TPC:
(void)sim_fread (&tpcbc, sizeof (t_tpclnt), 1, uptr->fileref);
*bc = tpcbc; /* save rec lnt */
*bc = (t_mtrlnt)tpcbc; /* save rec lnt */
if (ferror (uptr->fileref)) { /* error? */
MT_SET_PNU (uptr); /* pos not upd */
@ -1007,7 +1007,7 @@ else switch (f) { /* otherwise the read me
else { /* tape data record */
t_addr saved_pos;
*bc = awshdr.nxtlen; /* save rec lnt */
*bc = (t_mtrlnt)awshdr.nxtlen; /* save rec lnt */
uptr->pos += awshdr.nxtlen; /* spc over record */
memset (&awshdr, 0, sizeof (t_awslnt));
saved_pos = (t_addr)sim_ftell (uptr->fileref);
@ -1028,9 +1028,9 @@ else switch (f) { /* otherwise the read me
case MTUF_F_TAR:
if (uptr->pos < uptr->hwmark) {
if ((uptr->hwmark - uptr->pos) >= uptr->recsize)
*bc = uptr->recsize; /* TAR record size */
*bc = (t_mtrlnt)uptr->recsize; /* TAR record size */
else
*bc = uptr->hwmark - uptr->pos; /* TAR remnant last record */
*bc = (t_mtrlnt)(uptr->hwmark - uptr->pos); /* TAR remnant last record */
(void)sim_fseek (uptr->fileref, uptr->pos, SEEK_SET);
uptr->pos += *bc;
MT_CLR_INMRK (uptr);
@ -1197,7 +1197,7 @@ else switch (f) { /* otherwise the read me
uptr->pos = uptr->pos + sizeof (t_mtrlnt) / 2; /* then position forward to resync */
bufcntr = 0; /* mark the buffer as invalid to force a read */
*bc = MTR_GAP; /* reset the marker */
*bc = (t_mtrlnt)MTR_GAP; /* reset the marker */
runaway_counter -= sizeof_gap / 2; /* and decrement the gap counter */
}
@ -1225,7 +1225,7 @@ else switch (f) { /* otherwise the read me
ppos = sim_tape_tpc_fnd (uptr, (t_addr *) uptr->filebuf); /* find prev rec */
(void)sim_fseek (uptr->fileref, ppos, SEEK_SET);/* position */
(void)sim_fread (&tpcbc, sizeof (t_tpclnt), 1, uptr->fileref);
*bc = tpcbc; /* save rec lnt */
*bc = (t_mtrlnt)tpcbc; /* save rec lnt */
if (ferror (uptr->fileref)) /* error? */
status = sim_tape_ioerr (uptr);
@ -1322,7 +1322,7 @@ else switch (f) { /* otherwise the read me
if (MT_TST_INMRK (uptr)) /* already in a tapemark? */
awshdr.rectyp = AWS_REC;
MT_CLR_INMRK (uptr); /* No longer in a tapemark */
*bc = (awshdr.rectyp == AWS_REC) ? awshdr.prelen : 0;/* save rec lnt */
*bc = (t_mtrlnt)((awshdr.rectyp == AWS_REC) ? awshdr.prelen : 0);/* save rec lnt */
sbc = *bc; /* extract the record length */
if ((awshdr.rectyp != AWS_TMK) ||
(awshdr.prelen == 0)) {
@ -1352,13 +1352,13 @@ else switch (f) { /* otherwise the read me
}
else {
if (uptr->hwmark % uptr->recsize)
*bc = uptr->hwmark % uptr->recsize;
*bc = (t_mtrlnt)(uptr->hwmark % uptr->recsize);
else
*bc = uptr->recsize;
*bc = (t_mtrlnt)uptr->recsize;
}
}
else
*bc = uptr->recsize;
*bc = (t_mtrlnt)uptr->recsize;
if (*bc) {
uptr->pos -= *bc;
(void)sim_fseek (uptr->fileref, uptr->pos, SEEK_SET);

View file

@ -57,7 +57,7 @@ typedef uint32 t_mtrlnt; /* magtape rec lnt */
#define MTR_MAXLEN 0x00FFFFFF /* max len is 24b */
#define MTR_ERF 0x80000000 /* error flag */
#define MTR_F(x) ((x) & MTR_ERF) /* record error flg */
#define MTR_L(x) ((x) & ~MTR_ERF) /* record length */
#define MTR_L(x) ((t_mtrlnt)((x) & ~MTR_ERF)) /* record length */
/* TPC tape format */