On Thu, May 22, 2014 at 10:02 PM, Chuck Guzis <cclist at sydex.com> wrote:
I've been reading the SIMH TAP file specification
and there's something
that's not clear to me. Perhaps someone can volunteer their knowledge.
I've got a tape where about half the records (blocks) are an odd number of
bytes long. The SIMH document says that a block is padded to an even number
of bytes in this case. However, it doesn't say if the record length
(32-bit) word is adjusted to reflect this--or if the byte count is rounded
up to the nearest even byte.
It seems to me that the former would be the way to go, but I'm not sure. If
the latter course is taken, the information that the block is an odd number
of bytes long is gone.
Does anyone know for certain?
Thanks,
Chuck
If I have this correct, I think the difference between standard SIMH
.TAP format and E11 format is that E11 format does not pad blocks to
an even boundary in the file, while the SIMH format does, however in
both formats the block length in the block header in the file reflects
the original block length.
Some relevant code snippets:
http://simh.trailing-edge.com/sources/simhv39-0.zip
sim_tape.c
/* Read record length forward */
sim_tape_rdlntf()
case MTUF_F_STD: case MTUF_F_E11:
uptr->pos = uptr->pos + sizeof (t_mtrlnt) + /* spc
over record */
((f == MTUF_F_STD)? ((sbc + 1) & ~1): sbc);
/* Write record forward */
sim_tape_wrrecf()
case MTUF_F_STD: /* standard */
sbc = MTR_L ((bc + 1) & ~1); /* pad odd length */
case MTUF_F_E11: /* E11 */
sim_fwrite (&bc, sizeof (t_mtrlnt), 1, uptr->fileref);
sim_fwrite (buf, sizeof (uint8), sbc, uptr->fileref);
sim_fwrite (&bc, sizeof (t_mtrlnt), 1, uptr->fileref);