Tom Hunter wrote:
TAP format tape records look like this:
---
4 byte record length (little endian)
n bytes tape record
4 bytes record length (little endian)
---
In Bob Supnik's SIMH .tap format, if n is odd the record should be
padded with an extra byte. But unfortunately there are unpadded tape
images around. My tools write the padded format, but try to read both
ways.
If the record length has the sign bit set, it has a special meaning.
See this for details:
https://simh.trailing-edge.com/docs/simh_magtape.pdf
while ((ic = read(mt, buf, sizeof(buf))) >= 0)
{
fprintf(stdout, " %d", ic);
fflush(stdout);
if (ic == 0)
{
zero += 1;
if (zero >= 2)
{
break;
}
}
If I read this right, you break out of the loop if two tape marks are
read. Sometimes there is more data after the two tape marks. Sometimes
it's important data.