There were two problems here:
- The FOPEN code in 56 uses new C.DISK/C.TTY flags to keep track of the
channel type, so it knew what to do when closing the channel. The
TOPS-20 open code had been modified to set these, but the ITS code
hadn't, so CLOSE was assuming all channels were network channels.
Fix: set those flags in ODSK and OTTY, as TOPS-20 does.
- The BFCDSK flush routine had been modified to use byte pointer writes
to write the last incomplete word for both TOPS-20 (SOUT) and ITS
(SIOT). But on ITS, SIOT only works in unit mode, and Muddle opens
files in block mode.
Fix: restore the working code from Muddle 54 for writing the last
word. The only difference is that BFCDSK can now be invoked with the
leftover byte count (C) being zero, so it needs to check at the
start to avoid duplicating the last word in that case.
These two databases contain pure code routines that Muddle images can
refer to. We don't currently have whatever tool was used to maintain
them, so this is a MIDAS program that creates and populates them.
SAV FILE includes some stubs for functions in the LSRTNS and MUDDLE
libraries -- these are the functions that the existing Muddle 54 Zork
images need.
For the FIELD function in LSRTNS, returning FALSE is equivalent to the
user not being found. I have no idea what C-FCN in MUDDLE is for, but
very early Zork calls it after a command is entered, and seems happy
enough with it doing nothing.
Previously the first XFILE printed out some commands to run after STINK
had completed, which is awkward if you're building Muddle repeatedly.
This automates the second half of the build process.
Lars has found a couple of examples of TS MUD54 files, and they're the
initialised version (with references to internal functions filled in,
etc.). TAA's ZORK launcher also expects TS MUDxx to be the initialised
version. So it appears that the ITS version didn't generate TS MDLxx.
(Why does the initialisation process write out TS MUD56, then, if you're
only going to pdump the result over it? Because the last step in
initialisation is to invoke the GC, and getting back from the GC to the
interpreter requires mapping pages back in from the executable.)
Found from comparison with a TS MUD54 binary. The Muddle 56/106 source
came from TOPS-20 originally, and it had been extracted with newline
conversion but not ITS encoding.
Most of these are cosmetic, but there are a couple of VALRET strings
with embedded \rs -- including the one used to exit initialisation.
So successful initialisation now finishes with a *, rather than opening
a random location.
This replaces the existing MUDSYS;STINK 2 that was installed as TS
STINKM. The bad-EXPUNGE patch in there is no longer needed now Muddle is
built with MIDAS 73.
Most of these are the same as before. For UUOH, I've taken the fixed ITS
conditionals from uuoh.mid.181 (16th March 1981). For MAPPUR, I've put
the Tenex conditional around the whole of the segment-switching code
since none of it is needed on ITS.
Note in particular that the BOT patch is no longer needed -- this
version of Muddle works happily with the pure region at 700000.
Looking at the backup dates for files in <mdl.int>, mdl106.exe is from
20th January 1981, whereas some of the source files are from a couple of
years later. Revert to the last version prior to 20th January 1981 -- in
every case, this was the earliest revision that was kept in <mdl.int>.
This undoes the changes that we'd previously made to these files, many
of which are no longer necessary now that we're using MIDAS 73.
This matches a TS MUD from 1977, and is the same as TS MUD54 with the
addition of SGC. It's nearly the same as the Tenex order we had already.
There are a few differences between 54 and 56:
- CONST is new in 56;
- Three source files in 54 were merged into others in 56: TENTAB into
READER, FLOATB into PRINT, and CHAN into FOPEN;
- DISPLA, which went between CREATE and SAVE in 54, is missing in 56.
The PURIMP routine splits the page map into three parts: writable data
at the bottom, a large gap in the middle (which the GC will manage
later), and read-only code/data at the top. There's one CORBLK call for
each of these.
The final call, which gave pages BOT/2000 to 400 as the range, failed
with %EROPG when it hit the first unmapped page after the end of the
pure data. Experimentation shows that, at least with current ITS, this
is how CORBLK normally behaves.
Fix by calculating the final page from RHITOP rather than assuming 400.
The MDL 54/104 and 55/105 manuals give the name SYS:TS MDL for the
interpreter, and a comment in MAIN says it was TS MUDDLE, so install
links for both.
On ITS, ILOOP in INITM fails because it runs out of address space;
it overruns by about 2000 words. There's a comment in MUDDLE suggesting
that BOT was originally 600000, so move it back to there (although we
could get away with a higher value if necessary in the future).
On TENEX, TXPURE would be used instead.
This is checking whether the transfer vector has overflowed the
compile-time space allocated for it -- but the test is backwards, so the
.LOP .VALUE always fires.
These are analogous to TENEX's ASSEM ALL and MUD105 STINK.
This is version 56 for ITS, because the TENEX binary claimed to be
version 106, and the 54/104 and 55/105 manuals suggest that the ITS
version number tracked the TENEX one. Zork tests whether ,MUDDLE is less
than 100 to see if it's on ITS.
Most versions of MIDAS emit a 76 directive for each EXPUNGE, even if the
symbol being EXPUNGEd didn't exist. However, STINK treated a 76
directive for a symbol it didn't know about as an error.
Make it ignore the directive instead, skipping the next word to stay in
sync.
Linking Muddle showed various unresolved symbols of the form
"$ 42". These are used by MIDAS when it wants to refer to something in
a CONSTANTS area, but doesn't know the location at assembly time (for
example, because it's the other side of a LOC X where X is a global).
At the start of a CONSTANTS area, MIDAS defines this symbol as .;
however, it was defining it with the wrong name.
There's a special case in RPWRD1 to output references to these symbols
as squoze rather than symbol table numbers, but the code in CNST2 that
defines the symbol was using PDEFPT, which always outputs the number.
Make it output the squoze instead.
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. STINK 1/201 doesn't understand this, and treats
the second word as codebits for the next block, misinterpreting the
directives for that block; this results in missing symbols or junk being
loaded into memory.
For other two-word directives, MIDAS sets the IRCONT flag for all words
except the last one, to prevent the block from being flushed until the
directive is complete. Do the same for 76 directives.
Also fix CNSTA, which unset IRCONT *after* its last word; this was
probably harmless because it will be the first directive in a block so
can't be split.
It looks like Muddle was historically built with an early MIDAS: the
1973 Muddle source included a copy of MIDAS 73, and the MDL 106
source included a TENEX MIDAS binary of similar vintage.
Later versions of MIDAS have differences in their REL output which break
Muddle's low/high-segment linking. We don't have source for MIDAS 73.
MIDAS 323 is the latest version we have that supports this scheme
correctly, at least with Muddle's version of STINK.
Two things to note: the compiled Muddle was called MDL106.EXE, and the
MIDAS binary was earlier than MIDAS 76.
I've left the TENEX build scripts and TENEX-specific files in place;
the TENEX/ITS code is conditional, so it should be possible to build the
code on TENEX/TOPS-20 in the future.