I happened upon this line in the Z-Machine specification:
13.1. The dictionary and lexical analysis - Storage
The dictionary table is held in static memory and its byte address is stored in the word at
$08
in the header.
and it got me to thinking: Why does the dictionary table have to be in static memory?
I understand that dynamic memory is read/write while static is read-only, but as addresses to dynamic memory are always lower than ones to static memory, it seems to me that there is no technical reason why I couldn’t just put that table in dynamic memory and change the header address to point to it there instead (or alternatively, changing the static memory start address to some point beyond the location of that table), assuming, of course, whatever compiler I might use would allow that. It wouldn’t require any different logic to dereference the pointer, nor would the parsing logic of the table entries have to change in any way, so the mandate that the dictionary table be in static memory feels strangely arbitrary.
Now, I grant that depending on the compiler and the contents of the game, putting that table in dynamic memory may consume all/most of the dynamic memory available so it would have a massive impact on how big your game could be, rendering all but the smallest proof-of-concepts impossible, but I guess I’m trying to wrap my head around some of the prescribed limitations placed on interpreters since that feels like an issue for the game being developed rather than the interpreter itself.
Some things like the existence of high memory for functions and strings and having to use packed addresses to reach them makes intuitive sense. Even the distinction between static and dynamic memory makes sense in terms of access speed and multi-disc handling potentially (although the remarks of 1. The memory map state:
(The original idea behind the high memory mark was that everything below it should be stored in the interpreter’s RAM, while what was above could reasonably be kept in “virtual memory”, i.e., loaded off disc as needed.)
which suggests high memory was intended to facilitate multi-disc handling as opposed to static vs dynamic memory).
But since the specific boundary between dynamic and static memory is determined by the individual game and the actual logic for interpreting the structures in those sections of memory are the same, it seems to me like dictating which specific structures need to be in which half is an odd thing to fix in stone, especially since they still use a dynamic address (codified in the header) to figure out where that is.
Am I missing something obvious, is this distinction something that was very relevant in machine of the era that isn’t really a concept anymore, or is this limitation actually as arbitrary as it feels?