[z-machine] Z-Spec 1.1 issues
Chris Pickett
chris.pickett at mail.mcgill.ca
Sun Nov 19 01:40:12 GMT 2006
Hi Michael,
I'm even less of a Z-machine expert, but I think what Gavin was
suggesting is this: read the dictionary into your own in-memory
interpreter dictionary at runtime. While doing so, you can 1) sort it;
2) terminate all the strings. It's pretty common for interpreters in
general to translate to an internal format. The part of the spec that
you quoted already says that what you found may be considered a bug, but
at the same time it's consistent with known information. ("Arguably, the
first rule could be a bug, but the 3 extant V1 and V2 files are
consistent.")
Hope this helps,
Chris
Michael S. Greger wrote:
> Thanks for the reply.
>
> Yes the dictionary entries are a fixed length, but here's what happens
> when you type 'get storm-' in a location where that object doesn't
> exist: after a successful lookup in the dictionary of the word 'storm-'
> the game uses that address as an operand to the print_addr opcode.
> Print_addr knows nothing about dictionary entries, it only understands
> printing strings. In order for an interpreter to cope with dictionary
> entries like this ALL string printing will have to do something like
> this:
> -----------------------------------------
> What is the start of the dictionary?
> How many entries are there?
> Does the address in the operand fall within the dictionary?
> If so, what is the encoding length? (this is different from the entry
> size)
> Print a string that is only as long as the encoding length.
> Otherwise print the string normally.
> -----------------------------------------
>
> This seems a rather silly requirement for an opcode which has nothing to
> do with the dictionary. Yes I suppose it is possible to do, but it is
> ugly in the extreme. My guess is the original Infocom interpreters
> either a) failed to recognize these words entirely, or b) they printed
> garbage after the word as I discovered below. Considering these issues I
> think it reasonable to assume this was a bug unless someone with access
> to the original V1-2 interpreters can prove otherwise (both that the
> word is recognized and that it can be printed correctly). Note that
> using the word in the presence of the relevant object does not print the
> dictionary entry. It prints the object description instead, which is a
> completely different string. The command must be used in the absence of
> the object to test the printing of the dictionary entry.
>
> Thanks,
> MikeG
>
>
> -----Original Message-----
> From: Gavin Lambert [mailto:uzinf at mirality.co.nz]
> Sent: Saturday, November 18, 2006 3:05 PM
> To: Michael S. Greger; z-machine at feelies.org
> Subject: Re: [z-machine] Z-Spec 1.1 issues
>
>
> I'm no Z-machine expert, but IIRC the dictionary entries are
> supposed to be completely self-contained, and have a fixed
> length. So when you read a dictionary entry, if it's not already
> terminated you need to terminate it yourself before using
> it. What the spec is saying is that the compiler doesn't do this
> for you, it's the interpreter's job. (And yes, the compiler
> probably ought to, but since it historically didn't then the
> interpreters just have to cope.)
>
>
More information about the Z-machine
mailing list