Obscure question on Glulx/Glk

If one calls glk_gestalt_ext(x,y,-1,zlen) with the Glulx @glk opcode (for which the -1 means write to the stack rather than a main memory address), and x is a selector unknown to the interpreter, how many values will be pushed on the stack? Is any number between zero and zlen possible, or is there a point in the spec that I’m not seeing?

This doesn’t sound right: glk_gestalt_ext() won’t ever push values onto the stack in that way. If the array argument is to be anything other than 0, it must be the address of an array at least as big as the arraylength argument, whether that array is on the stack or not. The point is that the call may write to the array, but the array must be set up by whatever makes the call: there’s no sense in which glk_gestalt_ext() will create the array for you on the stack. What leads you to believe that using -1 in this way will have this effect?

Iin the glkop.c layer (the Glulx-to-Glk dispatch code), there’s a thing which says that reading/writing to address $FFFFFFFF is a stack read/write rather than a memory read/write. I’m not sure where I documented that, or whether anything uses it.

The answer to the original question is… um… I think the answer is “you can’t use the -1 trick for array arguments.”

Okay, that answer works for me. You did document it in the Glulx spec, and the standard templates use that trick, Glulx_PrintAnyToArray for instance. Just not with array arguments.