[z-machine] output stream 2, input stream 1
Amir Karger
amirkargerweb@yahoo.com
Thu, 20 Nov 2003 07:04:07 -0800 (PST)
--- David Kinder <d.kinder@btinternet.com> wrote:
> From: "Amir Karger"
>
> > First, the spec says output stream 2 is buffered. Frotz seems to
> > word-wrap it to 80 characters, but the spec doesn't say how many
> > columns to use. Is 80 the standard, or do we get to pick how many
> > characters to use (in which case, what's really the point of
> > buffering?)
>
> Something around 80 characters is common. But note that the spec
> says it *may* be buffered (to allow word wrapping), not that it has
> to be.
Hm. So in that case buffer_mode becomes a nop?
> > Second, what's the story with input stream and read_char? The spec
> says
> > read_char only reads from the keyboard, which Frotz does also. In
> that
> > case, what's the point of storing read_char keypresses in output
> stream
> > 4, if you can't read them back in in stream one?
>
> I don't see anywhere in the spec that says that.
I was apparently on drugs when I said this. No, I take it back. In
Section 15, the read_char opcode description says "Reads a single
character from input stream 0 (the keyboard). The first operand must be
1 (presumably it was provided to support multiple input devices, but
only the keyboard was ever used)." This pretty strongly implies that
file input is NOT allowed.
OTOH, 10.6 says "In Versions 4 and later, individual characters can be
read from the current input stream, using read_char", which clearly
means it's allowed to be an input from stream 1.
Any Spec1.1 folks listening? read_char's description should be changed
to say it reads from the input stream, not the keyboard. (I don't know
what to do with the parenthetical statement in there about multiple
input devices.)
>Frotz can definitely
> take @read_char input from a file, I've used it in scripts.
Aha! This wasn't working for me because I didn't put the characters on
their own line. And I see that Dzip instead uses "<oct of ZSCII>\n" and
nitfol says "[ZSCII VALUE]\n". I don't suppose anyone has worked up a
standard for this since these games were released? Well, a Perl
one-liner could always convert command scripts from the different
languages (assuming [123] wasn't entered to a 'read' opcode!)
I think I'll go with the "[ZSCII VALUE]\n" mentioned in the Spec's
remarks, which makes it at least quasi-standard.
-Amir
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/