Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site tesla.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!houxz!vax135!cornell!tesla!mac
From: mac@tesla.UUCP (Michael Mc Namara)
Newsgroups: net.games.rogue
Subject: Re: On posted fix for "saved game bug"
Message-ID: <415@tesla.UUCP>
Date: Fri, 3-Aug-84 01:17:49 EDT
Article-I.D.: tesla.415
Posted: Fri Aug  3 01:17:49 1984
Date-Received: Sat, 4-Aug-84 23:56:07 EDT
References: <274@tymix.UUCP>, <3931@fortune.UUCP>
Organization: Cornell Electrical Eng.
Lines: 116

[Your purse feels lighter--More--]
*********
Ok, this is a rather long (119 lines) discussion of what is *perhaps* going
on with the saved game bug (SGB)  If this malady no longer plagues you,
hit 'q' !!   ..!cornell!tesla!mac














> Regarding the "saved game bug"  the following has been posted:

>> ....
>> Guys, under 4.2BSD, ^Y is a delayed suspend signal.  ^Y  also  means
>>UP LEFT to rogue.  If you get a ^Y through the game to the shell...

>Probably the reason people keep complaining is that they don't understand
>your "fix" or why it applies to the problem. 

)        In simple terms:  In UNIX, a part of the kernel called the
)    "tty driver" interprets the characters you type.  Usually, these
)    are just ASCII characters that the tty driver sends on to the
)    program waiting for input, however, a couple of characters are
)    special, for instance the interrupt character.  If the tty
)    driver sees this character come in, rather than sending it along,
)    it will send an interrupt signal to the program.  Through the
)    UNIX program stty, you can set your all these special characters
)    to whatever ASCII values you want.  ^Y is one of these special
)    characters.  It means 'suspend this process as soon as it wants
)    some input', but that's not important right now.  The purpose
)    of the shell script which was suggested in the original article
)    is to change that character from ^Y to something else  (I suggest
)*   setting it to  (^@), which is something you are unlikely
)*   to type accidentally).
)	I'm also not convinced that that's all there is to the
)    "save game" bug.
)
)						-Glenn.
)

     Thanks, Glenn; and Michael, I hope the above has shown some light for 
you and others what is (perhaps) going on. I am afraid that trying to deal 
with as many different operating systems as we do here sometimes causes 
me to get slack with my terminalogy (sic).  [ It was sick, wasn't it! ]
      While I am not the most expert UNIX (tm) hacker,  what I discovered 
about rogue by basically trying what I could think of, with the experience
of writing curses-based [^1] programs and editors is a system fix to a bug in
the program.  I was cavalier in my description "..lets a ^Y through to the
shell..".  I will try to clear up what I meant, and continue Glenn's
explanation, and discuss further what I *think* is going on.  
      Since rogue uses ^Y as a command character, they must be run-
ning the game in RAW mode, which is a mode the tty driver can be set to.
There are basically three modes of operation; COOKED, which is what the
standard system is in -- In this mode you can type ^U to erase a line,
^W to erase a word, i.e., control characters take their normal effect, 
and also characters do not become available to a program until you hit 
return; CBREAK, -- The same control character processing is available as 
above (in COOKED), but characters are not buffered: they are available to
the program as you hit the keys (used in programs like more where you just
have to hit the space bar to continue); and RAW, where no processing of 
the input is done; characters pass through to the program, parity bits 
and all.  Evidently, as far as experience in playing the game can take
me, rogue goes into RAW mode for movements; otherwise ^Y's effect would
be much more immediate. [ ^Y is a delayed suspend character, which will
cause the current program to become suspended as soon as it reads for
more input. ]  Apparently, at some point, perhaps when asking the user
to name a particular potion or scroll, the game goes into CBREAK mode,
to allow the user ^U and delete keys.  Perhaps it does not come out of 
CBREAK mode correctly? Perhaps during this time (due to excited game playing,
the bug only occurs during the *best* games) the user types a ^Y?
    Anyway, if you alter the function of the tty driver, by use of the
stty(1) command, so that it no longer recognizes ^Y in particular, and
*any* character in general, as a suspend character, you will have neatly
side-stepped the issue of where in rogue 5.3 the bug is and how to fix it
in the source by removing that capability of the tty driver for the 
duration of the game.
    This can be done by 'stty dsusp u', which sets DelayedSUSPend character
in the terminal driver to be Unset.  To make yourself even more
save, you can Unset the suspend character via 'stty susp u'.  Then
*nothing* can get between you and the , (except a few D's,G's and J's).
    Since this removes some of the features of the new tty driver from
your use, you might want to reset these features after the exhausting
battle.
    The best way to do this is with a shell script that sets up a
rogue stty environment; invokes rogue; then resets the standard
stty environment for your terminal.
    I included a simple such script in the earlier posting the above
discussed.


-------------------------------
1 curses : a high level subroutine package that uses termcap descriptions
of terminal capabilities to ease programmers interface with the jungle
of terminals out there.  Basically, if a programmer wants to add a char-
acter at location X on the screen, he calls a subroutine from curses
which looks in the termcap data base for what the magic words are for 
the terminal currently in use, and then utters them to the terminal.

          
************
Ok, I hope this has cleared up the problem somewhat, and again I want
to disclaim that the save game bug fix (SGBF) is based on *my* conjecture
about what is going on;  I am just a lowly @ fighting the same battles 
you are,  OK?

    ..!cornell!tesla!mac