Updating the Z-Machine Standard Documents

Section 4.5 states

The operands are given next. Operand counts of 0OP, 1OP or 2OP require 0, 1 or 2 operands to be given, respectively. If the count is VAR, there must be as many operands as there were types other than ‘omitted’.

This is not true. An ‘Operand count’ of 2OP compiled in variable form can have more than two operands.

Rather than rewrite the description completely as I did last time I tried to fix this problem, I propose changing this to:

The operands are given next. Operand counts of 0OP or 1OP require 0 or 1 operands to be given, respectively. If the count is VAR, there must be as many operands as there were types other than ‘omitted’.

If the count is 2OP, the number of operands depends on the form. In long form, 2 operands must be given. However in variable form, it is possible to specify more than 2 operands (although only je and set_colour can use more than 2), and there must be as many operands as there were types other than ‘omitted’, as with a count of VAR.

This is significantly longer, and makes a bit of a mess of the term ‘operand count’, but it seems the simplest change to the text that actually explains the issue.

1 Like