[Z-MACHINE] How should print_table work?

print_table can be used to print several lines of text like a rectangle of a given height and width on screen. If the height is > 1, this involves moving the cursor to the same column and one line below where it started to print line 2 etc. This is typically used in the upper window.

Now I discover that Sherlock uses print_table to print a word which the user has typed, and this is in the lower window, with buffered output turned on. (This is done for the message: [This game doesn’t recognize the word “xyzzy”.])

Moving the cursor around doesn’t really work so well during buffered output.

Should print_table use a special implementation for when the height is 1 and just send characters to buffered output if buffering is enabled?

And what if a multi-line table is printed so close to the right-hand border in the lower window that there isn’t room for the entire width - should the overflow be skipped or printed on the next line?

3 Likes

The xzip spec says:

PRINTT with a height greater than one may only be used in screen 1.

Therefore there is no question of cursor movement in the lower window, at least for the use in Sherlock. A more problematic case is praxix.z5, that prints a two line table in the lower window.

My current approach is to write normally to screen, and in the lower window just change line instead of moving the cursor.

1 Like

That part of Praxix could be wrong, and I’d be happy to remove it.

I think it would be good to make a new unit test for this, once we come to consensus about what the opcode should actually do.