I’ve been trying to make use of the @print_form opcode within Z6. Both DM4 and the Z-Machine Standards document make reference to the fact that this opcode is well-designed for use with the contents of a table prepared via use of @output_stream, with format
@output_stream 3 <target table> <width>;
where target_table
is the memory structure for the form to be printed and width
is a maximum width of a line in characters (or, if negative, in screen units).
It appears that using the above is triggering an error message in Frotz 2.44: “Fatal error: Illegal window” and the same error is generated in WinFrotz 1.21. Compilation is via Inform 6.34. Is this my error, an error in the Z-Machine Standards documentation, or an error in the interpreters?
Here’s the code in use:
Constant Story "print_form test";
Constant Headline "^(the most unpopular Z-machine opcode)^";
Include "Parser";
Include "VerbLib";
Include "Grammar";
Constant FORMSIZE = 500;
Array sample_table buffer FORMSIZE;
Class Room
has light;
Room Start "Starting Point"
with description
"An uninteresting room.";
[ Initialise ;
location = Start;
print "<attempting direct multi-line write>^";
@output_stream 3 sample_table;
print "If stream is 0, nothing happens.";
print "If it is positive, then that stream is selected; if negative, deselected.";
print "(Recall that several different streams can be selected at once.)^";
@output_stream -3; ! creates one entry with cumulative length of all strings
print "<print_form follows, initial entry length = ", sample_table-->0, ">^";
@print_form sample_table;
print "<attempting width-constrained multi-line write>^";
@output_stream 3 sample_table 10; ! GENERATES "ILLEGAL WINDOW" ERROR?
print "If stream is 0, nothing happens.";
print "If it is positive, then that stream is selected; if negative, deselected.";
print "(Recall that several different streams can be selected at once.)^";
@output_stream -3; ! should create multi-entry table?
print "<print_form follows, initial entry length = ", sample_table-->0, ">^";
@print_form sample_table;
];