[comp.os.minix] TTY driver from Down Under, cont.

hannam@elec.uq.oz (Andrew Hannam) (10/20/88)

I have lost news feed for about the last month and so Ive missed a lot
of comments on my new tty driver. From the ones I have caught and read
here is a short (??) answer ... (+ some improvments, fixes & comments)

1/ Yes, it really does work on EGA cards properly !
2/ Yes, it is a lot of recompiling. I have included below a fix that
	allows it to be compatable with the old ioctl definitions
	(and the new). This should save a lot of recompiling.
	The speed and bit count fields are still different however,
	so any program that uses these will still need to be redefined.
	Just compile the 3 tty driver files with OLD_IOCTL defined.
	Note: any new programs can be compiled without OLD_IOCTL
	as the tty driver should recognize both - eventually this define can
	hopefully be removed and only the new ioctl method used.
3/ I am heavily opposed to software scroll - it makes life on XTs unbearable.
	It steals too many CPU cycles. Please remove this altogether even if
	you can't accept my tty driver as simply being a better driver.
	It also removes heaps of code from the tty driver to not support
	software scroll. 
4/ Another area of concern in the V1.3 driver is that it
	is does expansion seperately for the console and the rs232 lines. This
	is unnecessary repetition. The rs232 driver sometimes even does this
	expansion in the Interrupt handler ! Not a good idea at all.
5/ There are still the bugs in V1.3 as listed in my original release. Having
	seen a couple of diffs by Charles Hendrick to the V1.3c driver
	(although Ive not seen the driver itself) it would appear that they
	still exist in V1.3c. Why the V1.3 driver is still being supported
	with all of its problems (mainly due to implementation philosophy)
	is beyond me.
6/ Besides the advantage of being smaller, my tty driver offers many
	advantages:
	a) It support EGA without software scrolling or becoming too
		device dependant,
	b) It supports a large ANSI set - atleast as large as Charles H's.
	c) It has switchable Line Wrap ("ESC [ 4 h" turns it on 
		"ESC [ 4 l" turns it off). This is better than making it
		compile time dependant.
	d) Function Key and Arrow Key Macros (programmable only at
		compile time at present).
	e) It has rs232 flow control (I hope V1.3c has this).
	f) Addition of extra Keyboard formats is much simpler than in the
		original tty drivers.
	g) Both rs232 and console code is faster
	h) It fixes the bugs in the V1.3 driver as listed in my initial
		release.
7/ I prefer the method suggested by Charles Hendrick of doing a softcopy
	of the screen when it exceeds the screen length rather than the
	method I have used here. Think about the case where say vi starts
	half-way accross the screen boundary - every write has to
	be written twice to screen memory as opposed to once for his
	method. As he stated - they both generate the same amount of
	screen writing under normal circumstances. Perhaps a later version
	of this code will fix it - the degradation in performance this way
	is unnoticable so I think I'll leave it at present though.
8/ A Couple of people have mentioned to me that they have had trouble
	with buffer.h and its reliance on non-portable expansion techneques.
	If I recieve enough mail in about the next 2 weeks over it, I will
	rewrite it specifically for this tty driver and repost it. Buffer.h
	was stripped from other code I have written and hence is very
	general purpose (provided your pre-processor handles it). Its
	replacement (if necessary) will not be. In the mean time -
	the non-portable sections are seldom used and hence can be
	expanded by hand.

Anyone who is using this new tty driver or is going to ...
Please mail and tell me (so I can gauge support or otherwise for it)
	and mention any problems you have had with it.

Below is:
	1/ A termcap entry (which may have bugs) for my tty driver,
	2/ A set of diffs to tty2.c to remove some console driver bugs
		in the ANSI emulation code, and
	3/ The diffs to tty1.c and sgtty.h that give compatability with the
		old ioctl format.

**************************** Cut Here ***********************************
echo x - termcap.minix
sed 's/^X//' >termcap.minix <<'*-*-END-of-termcap.minix-*-*'
Xmi|minix|vt100-min| MINIX console (NEW):\
X	:am:bs:bw:mi:ms:xo:km:co#80:li#25:\
X	:is=\E[7h\E[4l\E[m:bl=^G:\
X	:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\
X	:le=^H:ri=^L:up=^K:do=^J:\
X	:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:DO=\E[%dB:\
X	:ho=\E[H:cm=\E[%i%d;%dH:sf=\ED:sr=\EM:\
X	:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\
X	:sc=\E7:rc=\E8:\
X	:md=\E[1m:mb=\E[5m:mh=\E[4m:mr=\E[7m:me=\E[m:\
X	:al=\E[L:AL=\E[%dL:dl=\E[M:DL=\E[%dM:dc=\E[P:DC=\E[%dP:\
X	:im=\E[4h:ei=\E[4l:\
X	:kd=\E[B:kr=\E[C:kl=\E[D:ku=\E[A:\
X	:kF=\E[T:kR=\E[S:kh=\E[H:kN=\E[U:kP=\E[V:kI=\E[Y:kD=\177:\
X	:K1=\E[H:K2=\E[V:K3=\E[G:K4=\E[Y:K5=\E[U:\
X	:k#10:k0=\EOS:k1=\EOT:k2=\EOU:k3=\EOV:k4=\EOW:\
X	:k5=\EOP:k6=\EOQ:k7=\EOR:k8=\EOX:k9=\EOY:\
X	:l0=f1:l1=f2:l2=f3:l3=f4:l4=f5:l5=f6:l6=f7:l7=f8:l8=f9:l9=f10
*-*-END-of-termcap.minix-*-*
echo x - tty2.c.diff
sed 's/^X//' >tty2.c.diff <<'*-*-END-of-tty2.c.diff-*-*'
X763,765c763,766
X<   /* This char is not printable but the column has been incremented */
X< 		/* fix this by decrementing it */
X<   tty_struct[CON1].tty_column--;
X---
X>   /* This char is not printable but the column may have been incremented */
X> 		/* fix this by decrementing it */
X>   if (c >= ' ')
X> 	tty_struct[CON1].tty_column--;
X978c979
X< 		case '@':			/* Insert Chars */
X---
X> 		case '@':			/* Insert Blank Chars */
X1000c1001
X< 			+ tty_struct[CON1].tty_column;
X---
X> 			+ tty_struct[CON1].tty_column*2;
*-*-END-of-tty2.c.diff-*-*
echo x - tty1.c.diff
sed 's/^X//' >tty1.c.diff <<'*-*-END-of-tty1.c.diff-*-*'
X6a7
X>  * 20/10/88 -	Added support for old V1.3 ioctls through define OLD_IOCTL
X740a742
X>  * The define OLD_IOCTL gives compatability with both old & new ioctl formats.
X750c752,757
X<   if (r&IOC_IN) {
X---
X> #ifdef OLD_IOCTL
X>   r &= ~( IOC_IN | IOC_OUT | IOC_VOID );	/* Accept old or new ioctls */
X>   m_ptr->TTY_REQUEST = r;
X> #else
X>   if (r&IOC_IN) {
X> #endif
X793a801
X> #ifndef OLD_IOCTL
X802a811
X> #endif
X833a843
X> #ifndef OLD_IOCTL
X842a853
X> #endif
*-*-END-of-tty1.c.diff-*-*
echo x - sgtty.h.diff
sed 's/^X//' >sgtty.h.diff <<'*-*-END-of-sgtty.h.diff-*-*'
X7a8
X>  * 20/10/88 -	Added Compatability with old V1.3 ioctls by define OLD_IOCTL.
X32,35c33,44
X< #define _IOWR(x,y,t)	(IOC_OUT  | IOC_IN   | ('x'<<8) | y)
X< #define _IOR(x,y,t)	(IOC_OUT  | ('x'<<8) | y)
X< #define _IOW(x,y,t)	(IOC_IN   | ('x'<<8) | y)
X< #define _IO(x,y)	(IOC_VOID | ('x'<<8) | y)
X---
X> 
X> #ifdef OLD_IOCTL
X> #	define _IOWR(x,y,t)	(('x'<<8)|y)
X> #	define _IOR(x,y,t)	(('x'<<8)|y)
X> #	define _IOW(x,y,t)	(('x'<<8)|y)
X> #	define _IO(x,y,t)	(('x'<<8)|y)
X> #else
X> #	define _IOWR(x,y,t)	(IOC_OUT  | IOC_IN   | ('x'<<8) | y)
X> #	define _IOR(x,y,t)	(IOC_OUT  | ('x'<<8) | y)
X> #	define _IOW(x,y,t)	(IOC_IN   | ('x'<<8) | y)
X> #	define _IO(x,y)		(IOC_VOID | ('x'<<8) | y)
X> #endif
*-*-END-of-sgtty.h.diff-*-*
exit