Login
You're viewing the functional.cafe public feed.
  • Nov 16, 2026, 2:05 AM

    Anyway, we optimized the parser for the 99% case and we were not terribly well-prepared for "by the way, reading keyboard input might SUDDENLY CALL A Z-MACHINE ROUTINE which can call other Z-machine routines which return and you have to catch the return of the last one (not the nested ones!) and go back to reading keyboard input" but we made it work.

    💬 1🔄 0⭐ 0

Replies

  • Nov 16, 2026, 2:09 AM

    We may have put a tiny bit of Z-machine bytecode in an unused field in the story header and pointed the Z-program counter there and made up a new opcode(*) that calls a routine that gets the return value that we told the callback Z-routine to push to the Z-stack then cleans up the whole mess and decides whether to keep reading keyboard input or just give up.

    (*) Technically all opcodes are made up

    💬 1🔄 0⭐ 0
  • 💬 1🔄 0⭐ 0
  • Nov 16, 2026, 3:01 AM

    @zarfeblong I was inspired by @a2_qkumba's solution to a problem we had in Wizard Replay. He used an unused opcode in the Apple Pascal bytecode to simulate swapping virtual floppies while loading Wizardry.

    Infocom handled it by setting the Z-program counter to 0 before initiating the callback routine, then checking for that special return address on every single call return. Is that better or worse?

    💬 1🔄 2⭐ 0
  • Nov 16, 2026, 3:04 AM

    @a2_4am @a2_qkumba Worse, because it costs more time. Better, in the sense that messing with the header will probably bite you two years from now when Stu or Marc or somebody updates the ZIL spec again.

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0