[net.emacs] terminal driver innards

Mark%upenn.csnet@csnet-relay.arpa (08/09/84)

From:  Mark B. Reinhold <Mark%upenn.csnet@csnet-relay.arpa>

While tuning the padding in a couple of our locally-written terminal drivers,
I tried to figure out exactly what was going on in terms of padding and motion
cost figures.  Previously, I had just twiddled them until they worked.  Can
anyone answer the following questions?

1. I had thought that the BaudFactor was the number of characters to send to
delay 1 millisecond.  This would allow all padding computations to be done in
terms of milliseconds.  In trmc100.c, and in many other drivers distributed
with #264, the BaudFactor is computed by the following formula:

    BaudFactor = BaudRate / ( (1 - (.45 + .3 * (BaudRate / 9600.))) * 10000.)

(Actually, the above formula was used in trmc100.c in #85 as well).  Why is it
done this way?  How is this formula obtained?

2. How does one compute the various cost factors (t_ILmf, t_ILov, etc.) in the
TrmControl struct?  trm.h claims the following:

  costs are expressed as number_affected*mf + ov
	cost to insert/delete 1 line: (number of lines left)*ILmf+ILov
	cost to insert one character: (number of chars left on line)*ICmf+ICov
	cost to delete n characters:  n*DCmf+DCov

Where I assume that the "cost" of an operation is the number of transmitted
characters it would require (correct me if I'm wrong).  Contrary to the
comment, when the UpdateLine procedure in display.c uses ICmf, it doesn't
multiply by the number of characters left on the line; it multiplies by the
number of characters to be inserted.  Is this a known problem?

Any advice would be appreciated.

Mark B. Reinhold
Computer & Information Science Dept., University of Pennsylvania
CSNet:   mark@upenn
ARPANet: mark%upenn@csnet-relay

chris@umcp-cs (08/12/84)

The fancy BaudFactor calculation was just one that happened to work
well for C100s.  In fact it does not work well for other terminals
as it produces a negative result for 19200 baud!  BaudFactor should
really be set to BaudRate/10000.0.

As far as the fancy IL and DL parameters go, ignore the comments in
Trm.h; they are at best misleading.  ILmf is the *padding* requirement
of a terminal and ILov is the overhead for doing an N line insert.  Of
course, that may not be a constant.  You just have to put in a ``best
guess''.

I have a document I wrote on writing terminal drivers for Emacs that I
could e-mail.  It's in TeX so you can't print nice copies with n/troff,
but you can still read it.  There's a catch, however:  it describes the
display.c code that I am using, and as far as I know there are three
or four people that have that code.  It's a rewrite of the #264 code,
with only the basic structure kept the same.  In particular, the cost
factors are represented differently, so I'm not sure it would be much
use in that respect.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci (301) 454-7690
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland