I was thinking of what Infocom’s terps would do when a string straddles the dynamic/static boundary. When I went over Beyond Zork passing invalid values to @get_prop_addr for insight on that rotating mirror bug and came to the conclusion that Frotz inherited a technically-wrong solution from Zip.
Per the Z-machine Standard, the maximum number of objects is 65,535. The mirror bug is triggered when the interpreter accesses object number 41,920 or thereabout. Beyond Zork’s static memory starts at offset 32,130. The address for that object is calculated to be at 588,158, which is somewhere far past the end of the zcode file itself. If I understand the thread on the mirror bug correctly, the source code incorrectly treats W?CIRCLET
as an object and by accident this works correctly on an interpreter that doesn’t care. So the more correct way to address this is to check to make sure that the object’s location in memory is valid and THEN complain. But if the game is Beyond Zork, just return zero.
Zip (and Frotz) address the problem by returning zero from @get_prop_addr
if the game is Beyond Zork AND if the object is higher than the arbitrarily-chosen number of 2000. It seems that the advantage to being so specific is that there is very little computation involved.
It looks like if someone actually tried to make a game that legitimately uses 41,920 objects, the memory required would be in excess of what’s supported by any of the Z-machine versions. Does anyone know more about this aspect of the Z-machine?
So back to ambiguities of whether or not a string straddling the border between static and dynamic memory should be allowed. The reason we make an exception for Beyond Zork’s mirror bug is that the improper behavior is in the wild for a long time and the official terp accidentally worked. The solution is also doesn’t require the terp to look for the end of the mistake; it’s all there. For this string-straddling issue to arise in the wild, someone would have to manually do it on purpose. Older releases of Inform might have allowed for this. When games were written with those older releases, incidents of Zip or Frotz crashing when a string straddles the dynamic/static boundary weren’t reported. So I’m inclined to conclude that no releases of Inform actually did this at any time. Nor am aware of any new zcode games doing this using some non-Inform language. Therefore the correct response would be for the interpreter to throw a fatal error and exit.