Prevent MIDAS from splitting two-word directives across blocks.
authorAdam Sampson <ats@offog.org>
Sat, 21 Apr 2018 10:59:08 +0000 (11:59 +0100)
committerAdam Sampson <ats@offog.org>
Sat, 21 Apr 2018 10:59:08 +0000 (11:59 +0100)
commit9acab4bb48c8dc8ad66e214576db5fca12e58716
tree34ec10ba74172c2cc506c54dd72da7d437162c75
parentf4293ffc4beaff1efd094baab3c0f33d74f75887
Prevent MIDAS from splitting two-word directives across blocks.

When:

- MIDAS is writing a "standard data" block to a REL file;
- it wants to write a 76 (local-to-global/rename/expunge) directive,
  which needs two words of data;
- and there's only one word of space left in the block;

it wrote the first one to the current block, and the second word to the
start of the next block. The REL documentation doesn't say that you
*can't* do this, but it seems dubious because there's no guarantee that
the next block is of the same type... and STINK 1/201 definitely doesn't
expect it, because it reads the "spilled" second word as the first set
of codebits for the next block.

Fix by checking, before writing a 76 directive, whether there's only one
space left in the buffer; if so, start a new block immediately.

There is a flag (IRCONT) that MIDAS sometimes sets to indicate that it
shouldn't end a block yet for other two-word directives; I tried using
it in this case, but the effect was that it never managed to actually
write the block at all. I'm not entirely convinced that it's right in
the other places where it's used.

This is MIDAS 323. I've not checked other versions of MIDAS for this
problem yet.
<mdl.int>/midas.323