[net.games.rogue] problem with rogue7 strings

keith@motel6.UUCP (Keith Packard) (06/29/85)

I have a set of rogue7 sources (the one with multiple character classes)
that do run fine on the vax.  But, when I ported them to a
Sequent Balance-8000 machine (32016), I got strange
errors in the messages printed at the top of the screen.  For example,
I am fighting a bat:

You miss the bat --More--

        -------
        |..b..|       #
        |.@...+########
        |.....|
        -------

When I hit space, the message changes to:

Tou miss the bat --More--

Yes, this is correct.  I check the sources and find that it
*really* wanted to print:

The bat misses you.

but only the first character was printed correctly.
When I hit ^R the correct message is displayed.

This is exactly the same problem I had in porting rogue7
to my pdp11/73 at home, at the time I was sure it was a
space limitation problem or a problem caused by the
massively horrible things I did to get rid of the strings.
(they sit in a file and are read into buffers at the bottom
of the stack segment - it worked for the other rogue (5.0))
But, now I get the same problem on a big machine with no
modifications to the source! 

In the course of debugging on the 11/73, I modified the
wputs call that was responsible for printing this message
to a series of wputc(*s++); refresh(); call sequences and,
lo and behold, it worked!  It was amazingly slow but
correct.

Does this strike a familiar note to those of you who have ported
rogue7 to other machines?  I just tested *exactly* the same
sources on the Balance and on an 11/780, runs on the vax,
breaks on the Balance.  I must assume that some weird machine
dependency exists.  Oh, the same problem occured on another
32016 machine, a tektronix 6130 running Utek - curses is
probably compiled directly from the 4.2 sources so I think
I have ruled that out as most probably cause.

keith packard
...!tektronix!reed!motel6!keith

keith@motel6.UUCP (Keith Packard) (07/01/85)

> I have a set of rogue7 sources (the one with multiple character classes)
> that do run fine on the vax.  But, when I ported them to a
> Sequent Balance-8000 machine (32016), I got strange
> errors in the messages printed at the top of the screen.  For example,
> I am fighting a bat:
> 
> You miss the bat --More--
> 
> When I hit space, the message changes to:
> 
> Tou miss the bat --More--
> 
> Yes, this is correct.  I check the sources and find that it
> *really* wanted to print:
> 
> The bat misses you.
> 
> but only the first character was printed correctly.
> 
> keith packard
> ...!tektronix!reed!motel6!keith

Well, I found the problem, when I unset the "flush typeahead" flag
everything worked correctly!  It turns out that, on my 11/73 and
obviously on the Balance calling ioctl:
ioctl (foo, TIOCFLUSH, 0)
causes *both* input and *output* to be flushed, and of course I
was only seeing this problem when I was in battle - flush was
being called all the time.  So, looking at my kernel sources
(Praise Unix for Sourced Systems) I found out that if you call
ioctl:

# include	<sys/file.h>
int	flags = FREAD;
ioctl (foo, TIOCFLUSH, &flags)

then only the input queue is flushed!
I wish things like this made it into the documentation. (grr)
Oh, you can use FWRITE in the ioctl call as well.

So, I made an enormous hack and did:

# define flushout()	ioctl (_tty_ch, TCFLSH, "\001\000\000\000")

in rogue.h

(well actually "\001\000" as I was fixing the 11/73 version...)

I know, ugly but it was quick.  I'll fix it later... (sure)

Keith Packard
...!tektronix!motel6!keith