Additional documentation for @print_table opcode?

I’m not sure it’s illegal… More like poorly specified.

It’s illegal according to Infocom’s specification. That’s a fact.

It’s poorly specified in the Z-machine standard v1.1. I think it should become illegal in v1.2, since it’s a can of worms, and it’d be crazy hard to get some kind of predictable results from this across platforms.

Praxix is doing something which is illegal according to Infocom’s specification, and which is a bad idea regardless which specification you’re working from.

I think the way Ozmoo handles it is the way that makes the most sense, but then again that’s to be expected since I wrote that code.

If you consider the alternative - it’s pretty easy to see how it will work in the simplest case, where there’s room for the full printout, but as soon as you look at other cases, you get into all sorts of tricky questions. Should each line spill over to the next line if needed? Should word wrapping be considered? If line 1 spills onto line 2, should line 2 then print on line 2 as well or on line 3? Or should text be clipped at the right border? Since the game author can’t read or write the cursor position or even know how wide the lower window is, how can the game author make sure the printout will look okay?

Infocom made it illegal for a reason.

Note that there are other points where the modern-day standard deviates from Infocom’s standard, and that’s to be expected. E.g. according to Infocom’s standard it’s illegal to call a routine with more parameters than the routine has local variables, whereas it’s perfectly legal according to the modern-day specification.

The fact that the lower window has no cursor positioning makes these questions very simple, really. The only sensible behavior is to print out the characters one at a time with a newline between table lines.

Whether this is useful behavior is arguable. It produces the “obvious” result if you start on a fresh line, the fixed-width font is set, and the table fits in the window (given the fixed-width font). If those conditions aren’t true, you can reasonably say “Well, what else did you expect?”

I can also see reasonable uses of this behavior even without the fixed-width font set. (You could print haiku with it, why not.)

I’m not arguing that the Z-spec should extend the Infocom spec in this way, but if we wanted to, that’s the only way to do it.

3 Likes

(I attest that when I wrote Praxix I wasn’t thinking about this question at all.)

1 Like