So, it's _mostly_ a 64K problem. All z-machine games have, in the file header, a "high memory" address above which it's safe to page data in and out as needed, because it's all read-only. Trinity's header claims what smells like an implausibly high value for a z4 game to me: 0xf771. There's no way it needs _that_ close to the 64K limit for writable store. Its "restart address" is 0x9310, though, which is also quite large, so maybe it does do a lot more with RAM than most z-machine games?
The pure/impure and caching system is actually quite simple. Everything below the "high memory" mark stays in RAM, everything above is divided into 512-byte pages which are paged in and out of the disk file as necessary...so you need enough to cover dynamic memory, plus at least one page, plus whatever your program requires. Cache replacement is simple LRU. This works quite well in practice. I'm already running with split I/D, which did help quite a lot, but not enough to let me run something that claims to need all but 2K of the potentially-writeable memory map. ZEMU is much, MUCH tighter than ZIP, but of course it's in MACRO-11 assembly, not C-compiled-with-the-2.11BSD-C-Compiler, which isn't all that tight a compiler by modern standards, and ZIP wasn't written to be optimized for memory consumption anyway. I tried compiling ZEMU with m11 on 2.11BSD, but there are zillions of errors, and I certainly won't have time to figure it out (and write an OS-dependent piece) by next Saturday. However, I may put ZEMU and a bunch of games on the RSX-11 system on the PiDP-11 instead. But first I gotta replace the spinner in my MAME cabinet. Adam On Sat, Jan 4, 2020 at 10:54 AM Ethan Dicks <[email protected]> wrote: > On Sat, Jan 4, 2020 at 12:12 AM Adam Thornton via cctech > <[email protected]> wrote: > > I'm having a party on Saturday January 11 (and if any of you are in > Tucson... > > I'm a bit far off but it sounds cool. > > > So I kind of wanted to put a general-purpose Z-machine interpreter on my > > PiDP-11, so that people could play Infocom (and community) games on a > real > > terminal. > > Fun! > > > Turns out there wasn't really one, so I ported the venerable ZIP > > https://github.com/athornton/pdp11-zterp > > https://github.com/athornton/pdp11-tmenu/ > > Thanks for this. > > > My biggest disappointment is that the memory map of Trinity, my favorite > > Infocom game, is weird and even though it's only a V5 game, I can't > > allocate enough memory to start it. > > Is this just a 64K segment problem? Perhaps there needs to be some > examination and optimization of the impure and pure storage and > caching design? > > One can play larger games with 128K of total RAM on microcomputers, > but most of those engines are written in assembler not C so the engine > is tightly coupled to the processor architecture. > > -ethan >
