PDP8: Binary loader can now read multiple section tapes. Fix from Dave Gesswein to issue #74.
This commit is contained in:
parent
2934112a70
commit
d7690ce060
1 changed files with 37 additions and 26 deletions
|
@ -191,13 +191,19 @@ t_stat sim_load_bin (FILE *fi)
|
|||
{
|
||||
int32 hi, lo, wd, csum, t;
|
||||
uint32 field, newf, origin;
|
||||
int32 sections_read = 0;
|
||||
|
||||
csum = origin = field = newf = 0; /* init */
|
||||
do { /* skip leader */
|
||||
for (;;) {
|
||||
csum = origin = field = newf = 0; /* init */
|
||||
do { /* skip leader */
|
||||
if ((hi = sim_bin_getc (fi, &newf)) == EOF)
|
||||
if (sections_read != 0) {
|
||||
printf ("%d sections sucessfully read\n\r", sections_read);
|
||||
return SCPE_OK;
|
||||
} else
|
||||
return SCPE_FMT;
|
||||
} while ((hi == 0) || (hi >= 0200));
|
||||
for (;;) { /* data blocks */
|
||||
for (;;) { /* data blocks */
|
||||
if ((lo = sim_bin_getc (fi, &newf)) == EOF) /* low char */
|
||||
return SCPE_FMT;
|
||||
wd = (hi << 6) | lo; /* form word */
|
||||
|
@ -205,9 +211,13 @@ for (;;) { /* data blocks */
|
|||
if ((hi = sim_bin_getc (fi, &newf)) == EOF) /* next char */
|
||||
return SCPE_FMT;
|
||||
if (hi == 0200) { /* end of tape? */
|
||||
if ((csum - wd) & 07777) /* valid csum? */
|
||||
if ((csum - wd) & 07777) { /* valid csum? */
|
||||
if (sections_read != 0)
|
||||
printf ("%d sections sucessfully read\n\r", sections_read);
|
||||
return SCPE_CSUM;
|
||||
return SCPE_OK;
|
||||
}
|
||||
sections_read++;
|
||||
break;
|
||||
}
|
||||
csum = csum + t + lo; /* add to csum */
|
||||
if (wd > 07777) /* chan 7 set? */
|
||||
|
@ -220,6 +230,7 @@ for (;;) { /* data blocks */
|
|||
}
|
||||
field = newf; /* update field */
|
||||
}
|
||||
}
|
||||
return SCPE_IERR;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue