[comp.os.minix] 1.3c more notes

mullen@sdsu.UUCP (deborah mullen) (10/07/88)

Unless I lost a character when downloading (never happened before),
line 204 of console.c (1.3c update) is missing a closing comment. I
assume this would cause the next line of code to be skipped.

The PUBLIC and PRIVATE directives do not mean much.  There are many
routines declared PRIVATE that are called from other source files.
Examples include flush, set_leds, tty_init, ..... I know the MINIX
compiler does not care, but for the sake of documentation.

How much was this version tested after all the new stuff was added?
I'm not that keen on all the ega stuff.  It makes the code large and
messy. I believe the author was expressing some doubts in one of his
postings also.

-- Deborah Mullen

ast@cs.vu.nl (Andy Tanenbaum) (10/10/88)

In article <3193@sdsu.UUCP> mullen@sdsu.UUCP (deborah mullen) writes:
>line 204 of console.c (1.3c update) is missing a closing comment. 
Yes, you are definitely right.

>The PUBLIC and PRIVATE directives do not mean much.  
Right again.


>How much was this version tested after all the new stuff was added?
>I'm not that keen on all the ega stuff.  It makes the code large and
>messy. I believe the author was expressing some doubts in one of his
>postings also.
It has been moderately well tested.  How the missing comment symbol slipped by
is a mystery.  I guess it only affects large transfers.  I completely agree
about the EGA stuff.  I don't have an EGA board, so I didn't do that stuff
myself.  
The author (Charles Hedrick) and I have been negotiating about that stuff.  What
I would like is to have two scrolling methods available, toggled by the F3
key:
  1) plain vanilla 6845 hardware scrolling, like in 1.1
  2) video RAM crawl software scrolling.  The idea here is when the system
     comes up, the lowest 25 x 80 x 2 bytes are used to hold the screen image.
     When a new line is added, it goes at video RAM address 25 x 80 x 2 and
     the base register is shifted up by 160 (80 characters + 80 attribute bytes)
     Each new line uses a higher piece of video RAM until some limit is hit.
     I think all known video cards have >= 16K except the standard mono card,
     for which 6845 hardware scrolling works.  When the video image has
     crawled up to the limit, the whole thing is copied back to the beginning
     of the video RAM and we start all over.  With 16K RAM and a 4K image,
     the copying operation will be needed about every 77 lines.  Assuming it
     can be done with interrupts enabled (for the RS232 line), the performance
     should be pretty good and the code pretty simple.

In return for his doing this, I am willing to tolerate linewrapping (as an
#ifdef), very much against my taste and better judgment.

If anyone has other suggestions for simplifying the video business, please
post them so we can have a discussion.  These changes will apply to 1.4, not
1.3.  

Below is a shar file containing the fixes I made in response to Deborah
Mullen's comments, as well as a crc * listing of the current kernel dir.
These fixes apply to 1.3.  I had to unseal the box anyway to fix the bootblok.s
problem discussed in an earlier posting, so I did this too.

Andy Tanenbaum (ast@cs.vu.nl)



: This is a shar archive.  Extract with sh, not csh.
: This archive ends with exit, so do not worry about trailing junk.
: --------------------------- cut here --------------------------
PATH=/bin:/usr/bin:/usr/ucb
echo Extracting 'console.cdif'
sed 's/^X//' > 'console.cdif' << '+ END-OF-FILE ''console.cdif'
X*** console.old	Mon Oct 10 11:59:02 1988
X--- console.c	Mon Oct 10 11:56:50 1988
X***************
X*** 1,4 ****
X- 
X  /* Code and data for the IBM console driver. */
X  
X  #include "../h/const.h"
X--- 1,3 ----
X***************
X*** 201,207 ****
X    flush(tp);			/* clear out the pending characters */
X  
X    /* Update terminal data structure. */
X!   count = offset - offset1;	/* # characters printed *
X    tp->tty_phys += count;	/* advance physical data pointer */
X    tp->tty_cum += count;		/* number of characters printed */
X  
X--- 200,206 ----
X    flush(tp);			/* clear out the pending characters */
X  
X    /* Update terminal data structure. */
X!   count = offset - offset1;	/* # characters printed */
X    tp->tty_phys += count;	/* advance physical data pointer */
X    tp->tty_cum += count;		/* number of characters printed */
X  
X***************
X*** 213,219 ****
X  /*===========================================================================*
X   *				out_char				     *
X   *===========================================================================*/
X! PRIVATE out_char(tp, c)
X  register struct tty_struct *tp;	/* pointer to tty struct */
X  char c;				/* character to be output */
X  {
X--- 212,218 ----
X  /*===========================================================================*
X   *				out_char				     *
X   *===========================================================================*/
X! PUBLIC out_char(tp, c)
X  register struct tty_struct *tp;	/* pointer to tty struct */
X  char c;				/* character to be output */
X  {
X***************
X*** 449,455 ****
X  /*===========================================================================*
X   *				flush					     *
X   *===========================================================================*/
X! PRIVATE flush(tp)
X  register struct tty_struct *tp;	/* pointer to tty struct */
X  {
X  /* Have the characters in 'ramqueue' transferred to the screen. */
X--- 448,454 ----
X  /*===========================================================================*
X   *				flush					     *
X   *===========================================================================*/
X! PUBLIC flush(tp)
X  register struct tty_struct *tp;	/* pointer to tty struct */
X  {
X  /* Have the characters in 'ramqueue' transferred to the screen. */
X***************
X*** 1024,1030 ****
X  /*===========================================================================*
X   *				set_leds				     *
X   *===========================================================================*/
X! PRIVATE set_leds()
X  {
X  /* Set the LEDs on the caps lock and num lock keys */
X  
X--- 1023,1029 ----
X  /*===========================================================================*
X   *				set_leds				     *
X   *===========================================================================*/
X! PUBLIC set_leds()
X  {
X  /* Set the LEDs on the caps lock and num lock keys */
X  
X***************
X*** 1051,1057 ****
X  /*===========================================================================*
X   *				tty_init				     *
X   *===========================================================================*/
X! PRIVATE tty_init()
X  {
X  /* Initialize the tty tables. */
X  
X--- 1050,1056 ----
X  /*===========================================================================*
X   *				tty_init				     *
X   *===========================================================================*/
X! PUBLIC tty_init()
X  {
X  /* Initialize the tty tables. */
X  
X***************
X*** 1194,1200 ****
X  /*===========================================================================*
X   *				func_key				     *
X   *===========================================================================*/
X! PRIVATE func_key(ch)
X  char ch;			/* scan code for a function key */
X  {
X  /* This procedure traps function keys for debugging purposes.  When MINIX is
X--- 1193,1199 ----
X  /*===========================================================================*
X   *				func_key				     *
X   *===========================================================================*/
X! PUBLIC func_key(ch)
X  char ch;			/* scan code for a function key */
X  {
X  /* This procedure traps function keys for debugging purposes.  When MINIX is
+ END-OF-FILE console.cdif
chmod 'u=rw,g=r,o=r' 'console.cdif'
set `wc -c 'console.cdif'`
count=$1
case $count in
4158)	:;;
*)	echo 'Bad character count in ''console.cdif' >&2
		echo 'Count should be 4158' >&2
esac
echo Extracting 'rs232.cdif'
sed 's/^X//' > 'rs232.cdif' << '+ END-OF-FILE ''rs232.cdif'
X*** rs232.old	Mon Oct 10 11:59:17 1988
X--- rs232.c	Mon Oct 10 12:00:20 1988
X***************
X*** 405,411 ****
X  /*===========================================================================*
X   *				tty_o_done				     *
X   *===========================================================================*/
X! PRIVATE int tty_o_done()
X  {
X  /* A write request on an RS232 line has completed.  Send FS a message. */
X  
X--- 405,411 ----
X  /*===========================================================================*
X   *				tty_o_done				     *
X   *===========================================================================*/
X! PUBLIC int tty_o_done()
X  {
X  /* A write request on an RS232 line has completed.  Send FS a message. */
X  
X***************
X*** 432,438 ****
X  /*===========================================================================*
X   *				rs_sig					     * 
X   *===========================================================================*/
X! PRIVATE rs_sig(tp)
X  struct tty_struct *tp;
X  {
X  /* Called when a DEL character is typed.  It resets the output. */
X--- 432,438 ----
X  /*===========================================================================*
X   *				rs_sig					     * 
X   *===========================================================================*/
X! PUBLIC rs_sig(tp)
X  struct tty_struct *tp;
X  {
X  /* Called when a DEL character is typed.  It resets the output. */
+ END-OF-FILE rs232.cdif
chmod 'u=rw,g=r,o=r' 'rs232.cdif'
set `wc -c 'rs232.cdif'`
count=$1
case $count in
1396)	:;;
*)	echo 'Bad character count in ''rs232.cdif' >&2
		echo 'Count should be 1396' >&2
esac
echo Extracting 'log'
sed 's/^X//' > 'log' << '+ END-OF-FILE ''log'
X33568   3218 at_makefile
X64098  16075 at_wini.c
X61767   9461 clock.c
X29239  40519 console.c
X46559   2880 const.h
X09961   3543 dmp.c
X37030  26551 floppy.c
X57617    941 glo.h
X24617  27165 klib88.s
X01335  11156 main.c
X36060   5296 memory.c
X09331  13834 mpx88.s
X65108   3375 pc_makefile
X56408   9952 printer.c
X10507  13753 proc.c
X21644   2324 proc.h
X12176  18813 ps_wini.c
X20815  18995 rs232.c
X61988  19960 system.c
X38305   3634 table.c
X61842  28048 tty.c
X61705   7512 tty.h
X44806   4708 ttymaps.h
X27554    742 type.h
X14198  26433 xt_wini.c
+ END-OF-FILE log
chmod 'u=rw,g=r,o=r' 'log'
set `wc -c 'log'`
count=$1
case $count in
537)	:;;
*)	echo 'Bad character count in ''log' >&2
		echo 'Count should be 537' >&2
esac
exit 0

dtynan@sultra.UUCP (Der Tynan) (10/11/88)

In article <1499@ast.cs.vu.nl>, ast@cs.vu.nl (Andy Tanenbaum) writes:
> 
> In return for his doing this, I am willing to tolerate linewrapping (as an
> #ifdef), very much against my taste and better judgment.
> 
> If anyone has other suggestions for simplifying the video business, please
> post them so we can have a discussion.  These changes will apply to 1.4, not
> 1.3.  
> 
> Andy Tanenbaum (ast@cs.vu.nl)

Sorry to disagree with you, but personally, I favor line-wrap.  Unfortunately,
this is *not* a perfect world, and there are many programs which disappear
off the side of the screen.  I think it is the responsibility of the tty
driver to cure this.  For example, if you use term, and call a remote system,
which answers at a different speed, it takes a few lines of garbage before
you get any real data.  Unfortunately, at this stage, everything has
disappeared out of view.  I can cite numerous examples of programs that
behave this way, and unfortunately, it would take a lot to fix them all.

On the other point, I think the console driver should be split.  There should
be one for EGA, and one for the rest of us.  I know this is difficult to do,
because the distribution disks must work with both, so maybe a hybrid is in
order.  In other words, a quick-and-dirty tty driver, which works with both
types.  Once the system is running, the end-user can select the appropriate
code, and re-compile the kernel.  Somewhat similar to the xx_wini.c deal.
						- Der
-- 
Reply:	dtynan@sultra.UUCP		(Der Tynan @ Tynan Computers)
	{mips,pyramid}!sultra!dtynan
	Cast a cold eye on life, on death.  Horseman, pass by...    [WBY]

hedrick@athos.rutgers.edu (Charles Hedrick) (10/12/88)

In article <2571@sultra.UUCP>, dtynan@sultra.UUCP (Der Tynan) writes:
> On the other point, I think the console driver should be split.  There should
> be one for EGA, and one for the rest of us.  I know this is difficult to do,

It's no longer worth doing in my opinion.  I'm now using a kernel with
the odd EGA register stuff removed.  There are a few conditionals here
and there, e.g. not waiting for retrace to change the screen, but
that's also appropriate for the old monochrome adapter.  The only
remnant of the old EGA code is one small piece of code in the scroll
routine.  But it's much smaller than my first attempt.  It is now
modified so that it works just like the original Minix hardware
scroll, except that at the end of the screen memory, the whole screen
image is copied back to the start of the screen memory.  Since it only
has to be done once every N lines, the overhead is not noticable.  The
EGA-specific code for processing insert-delete line and various other
places is gone.  At this point there's not enough code to be worth
worrying about.  (I've sent diffs to ast, but he wants me to put in
some more recent fixes and do the diffs again.  I don't see that it
will matter much, since patch shouldn't care about small differences
in line numbers for context diffs, but I'll do that over the weekend
and post the results.  

srw%pws1@Sun.COM (Scott Wiesner) (10/13/88)

From article <Oct.12.01.06.28.1988.3257@athos.rutgers.edu>, by hedrick@athos.rutgers.edu (Charles Hedrick):
> modified so that it works just like the original Minix hardware
> scroll, except that at the end of the screen memory, the whole screen
> image is copied back to the start of the screen memory.  Since it only
> has to be done once every N lines, the overhead is not noticable.  

I know very little about minix, but I am familiar with PC's, and I'd
like to warn everyone that some of the 'clone' monochrome display 
adapters don't have multiple pages of screen memory so the trick of
moving the beginning of the visible portion of the screen doesn't 
work.  One that comes to mind is the adapter that came with one of the
Wyse 286 AT's.

Scott

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

> On the other point, I think the console driver should be split.  There should
> be one for EGA, and one for the rest of us.  I know this is difficult to do,
> because the distribution disks must work with both, so maybe a hybrid is in
> order.  In other words, a quick-and-dirty tty driver, which works with both
> types.  Once the system is running, the end-user can select the appropriate
> code, and re-compile the kernel.  Somewhat similar to the xx_wini.c deal.
> 						- Der

I don't see why it should be split. The EGA driver should not be difficult
to do. The problem with the existing code is that it hasn't been thought
out properly (i.e. remove software scrolling and fix the problem properly).
Conceptually the EGA should be upwardly compatable with the CGA (although
it isn't when it comes to memory wrap around).
	I have already produced a new tty driver (which has been posted
to the net) which handles this problem properly without having umpteen
million lines of specialized code for handling the EGA.

As for line-wrap, I'll state again - Please put it in but make it a
run-time option (i.e. ioctl or ANSI sequence support) rather than
compile time. Whether you have line-wrap or not is dependant on the
users preferences not on system policy. Again, this is already in my
posted driver. (notice I'm really pushing for people to try it ?)

I wish AST would take a good look at my new tty driver as it contains
significant improvments to algorithms, methods etc. Some of this code
may (!!) be useful to him.

I HATE SOFTWARE SCROLLING !!

hedrick@geneva.rutgers.edu (Charles Hedrick) (10/26/88)

> On the other point, I think the console driver should be split.  There should
> be one for EGA, and one for the rest of us.  I know this is difficult to do,
> because the distribution disks must work with both, so maybe a hybrid is in

This might have been true of 1.3c, but not of the final version.  The
amount of EGA-specific code is now very small.

julian@acp.OZ (Julian Elischer) (10/27/88)

First, an appology about how late this is..
we had a big blockage here in Western AUS.

ast mentions in his articel of the 10th of Oct
the method of scrolling that has the screen creep
one line higher in memory for each scroll, and then does a bulk
copy when the 'creep limit' is reached, to move to the base of video
ram again..  An alternative that might be worth considering is to
just keep 2 screen-fulls of ram for the screen. Characters are written
to 2 locations for each write, one on screen, and one off. When the
'creep limit' has been reached, the screen is reset to the bottom of
the video ram, which should ALREADY contain identical information
to the top of the  video ram, hence no bulk copy is needed.
If it is coded correctly, the extra copy might (no promises)
not prove too much of an extra load ( though the 8086 architecture
may defeat you). Theoretically, this incremental copy MUST
have more overhead, however the elimination of the BULK copies
might be worth the trouble in some situations. ( and anyhow you are
doing the copy anyhow, just at a different time)

I unfortunatly do not have minix  OR a machine to try it on
however I would be curious to hear if anybody can think 
of any advantages or disadvantages to this scheme.

Julian Elischer

julian@acp.oz

UUCP: {check your map,uunet}!munnari!acp.oz!julian