Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.ruhr-uni-bochum.de!news.rwth-aachen.de!uni-paderborn.de!fu-berlin.de!main.Germany.EU.net!Frankfurt.Germany.EU.net!howland.erols.net!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: [Z-machine] multiple undo
Message-ID: <erkyrathDx63qq.M3n@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <ant3011230b070RF@arnod.demon.co.uk> <erkyrathDwyvw2.7F6@netcom.com> <50hmfb$oes@mars.worldonline.nl>
Date: Tue, 3 Sep 1996 17:40:01 GMT
Lines: 40
Sender: erkyrath@netcom20.netcom.com

Marnix Klooster (marnix@worldonline.nl) wrote:
> > Right. The library sets a flag which prevents you from undoing twice in a 
> > row. If you hack the library *and* run it on a multiple-undo-supporting 
> > interpreter, your game will support multiple undo.

> This is definitely *not true*.  The limitation to single undo is part
> of the design of the Z-machine. [...]

> About Zip 2000: I suspect that Kevin Bracey, the author of this
> interpreter, has silently extended the Z-machine, so that multiple
> RESTORE_UNDO instructions *do* work.

I ain't seeing what you're claiming. (I'm looking at the 0.2 spec 
document.) @save_undo "saves the game into a cache of memory held by the 
interpreter." @restore_undo "restores the state saved to memory by 
@save_undo... The behavior of @restore_undo is unspecified if no 
@save_undo has previously occurred." But it doesn't say that the cache is 
invalidated after the @restore_undo completes. If the cache is reloaded 
with an earlier state, such that a further @restore_undo will restore 
*that* and return a success value, is this contrary to the spec?

If this is an extension to the Z-machine, then I propose it. 
Specifically: It is up to the interpreter whether a @restore_undo should
succeed or fail; the game should just try it and test the return value. 
Exception: the interpreter should always have @restore_undo fail if no
@save_undo has been executed; and the game should never try this, since
some interpreters may explode. 

But honestly I think this is the way interpreters behave *now*. Both Zip 
2000 and the single-undo-supporting interpreters.

(PS: When I say "restore returns a success value", of course I mean that 
control passes back to the "save" statement, which returns 2.)

--Z

-- 

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."
