[comp.os.minix] improvements for 1.3c

XBR4D75G%DDATHD21.BITNET@cunyvm.cuny.edu (10/11/88)

I have installed all 1.3c patches, I received on EARN/BITNET, and generated
a running MINIX system, tested on an XT- and an AT-clone. I created the
system by crosscompilation under MSDOS and under MINIX with the 1.1 C-compiler.

The extension of buffers recommended by Charles Hedrick improved communication
on the rs232-port considerablely. The simple terminal-emulator term.c runs
on the XT-clone (8 MHz) with 2400 baud against a VAX 8350 without loosing
any characters and the AT-clone (10 MHZ) with 9600 baud.

Here are three chages (improvements ?) I would recommend for the official 1.3c:

1.) Depending on the BIOS you are using, it may be possible, that the UART is
    not completely reset after (warm)-booting. My serial line hang several
    times when I tried to login on /dev/tty1. The problem was eliminated
    by clearing the INTERRUPT_ID_REG and the RECEIVER_DATA_REG explicitly
    before enabling interrupts of the UART in init_rs232().

*** RS232.C     Fri Sep 30 19:30:00 1988
--- a:RS232.C   Tue Oct 04 16:12:16 1988
***************
*** 455,461 ****
  {
    register struct tty_struct *tp;
    register struct rs_struct *rs;
!   int line;

    for (tp = &tty_struct[NR_CONS]; tp < &tty_struct[NR_CONS+NR_RS_LINES]; tp++)
{
        tp->tty_inhead = tp->tty_inqueue;
--- 455,461 ----
  {
    register struct tty_struct *tp;
    register struct rs_struct *rs;
!   int line, dummy;

    for (tp = &tty_struct[NR_CONS]; tp < &tty_struct[NR_CONS+NR_RS_LINES]; tp++)
{
        tp->tty_inhead = tp->tty_inqueue;
***************
*** 486,491 ****
--- 486,493 ----
        rs->rs_left = 0;
        rs->rs_busy = FALSE;
        config_rs232(line, DEF_BAUD, DEF_BAUD, NONE, 1, 8);    /* set params */
+       port_in(rs->rs_base + RS232_RECEIVER_DATA_REG, &dummy);
+       port_in(rs->rs_base + RS232_INTERRUPT_ID_REG, &dummy);
        port_out(rs->rs_base + RS232_MODEM_CONTROL, MODEM_CONTROLS);
        port_out(rs->rs_base + RS232_INTERRUPTS, RS232_INTERRUPT_CLASSES);
    }

2.) Using the LINEWRAP-option for console.c in the kernel requires, that in
    mined line-erasing is done by the escape-sequence insteed of "printing"
    80 blanks. The screen scrolls up 2 lines when a status-line is created
    by the old mined. (I can not explain, why mined requires at least one
    blank in the clear-line-sequence.)

*** a:MINED.H   Mon Aug 15 00:02:44 1988
--- MINED.H     Fri Oct 07 09:45:32 1988
***************
*** 151,157 ****
  extern int out_count;                 /* Index in output buffer */
  extern char file_name[LINE_LEN];      /* Name of file in use */
  extern char text_buffer[MAX_CHARS];   /* Buffer for modifying text */
! extern char blank_line[LINE_LEN];     /* Line filled with spaces */

  extern char yank_file[];              /* Temp file for buffer */
  extern FLAG yank_status;              /* Status of yank_file */
--- 151,157 ----
  extern int out_count;                 /* Index in output buffer */
  extern char file_name[LINE_LEN];      /* Name of file in use */
  extern char text_buffer[MAX_CHARS];   /* Buffer for modifying text */
! extern char *blank_line;              /* String to clear rest of line */

  extern char yank_file[];              /* Temp file for buffer */
  extern FLAG yank_status;              /* Status of yank_file */

*** a:MINED1.C  Mon Aug 15 00:10:20 1988
--- MINED1.C    Fri Oct 07 10:46:06 1988
***************
*** 1251,1262 ****
  int out_count;                        /* Index in output buffer */
  char file_name[LINE_LEN];     /* Name of file in use */
  char text_buffer[MAX_CHARS];  /* Buffer for modifying text */
- char blank_line[LINE_LEN];    /* Line filled with spaces */

  /* Escape sequences. */
  #ifdef UNIX
  char *CE, *VS, *SO, *SE, *CL, *AL, *CM;
  #else
  char   *enter_string = "\033[H\033[J";        /* String printed on entering mi
ned */
  char   *pos_string = "\033[%d;%dH";   /* Absolute cursor position */
  char   *rev_scroll = "\033M";         /* String for reverse scrolling */
--- 1251,1262 ----
  int out_count;                        /* Index in output buffer */
  char file_name[LINE_LEN];     /* Name of file in use */
  char text_buffer[MAX_CHARS];  /* Buffer for modifying text */

  /* Escape sequences. */
  #ifdef UNIX
  char *CE, *VS, *SO, *SE, *CL, *AL, *CM;
  #else
+ char   *blank_line = " \033[K";       /* String to clear rest of line */
  char   *enter_string = "\033[H\033[J";        /* String printed on entering mi
ned */
  char   *pos_string = "\033[%d;%dH";   /* Absolute cursor position */
  char   *rev_scroll = "\033M";         /* String for reverse scrolling */
***************
*** 1453,1461 ****
    tputs(CL, 0, _putchar);
  #else
    string_print(enter_string);                 /* Hello world */
-   for (index = 0; index < XMAX; index++)      /* Fill blank_line with spaces*/
-       blank_line[index] = ' ';
-   blank_line[XMAX] = '\0';
  #endif UNIX

    if (!isatty(0)) {           /* Reading from pipe */
--- 1453,1458 ----

3.) The new program readclock.c tests, whether it is running on an AT or not.
    Instead of creating an error message on an XT I incorporated reading
    time and date from a Multi-I/O card. My base address of the clock-chip
    is 0x0240, which may by different for other Multi-I/O cards.

*** READCLOC.c  Fri Oct 07 12:30:00 1988
--- READCLOC.NEW        Tue Oct 11 11:01:44 1988
***************
*** 42,47 ****
--- 42,55 ----
  #define  SECOND               0
  #define  STATUS               0x0b

+ #define XCLOCK_PORT   0x240
+ #define XSECOND               2
+ #define XMINUTE               3
+ #define XHOUR         4
+ #define XDAY          6
+ #define XMONTH                7
+ #define XYEAR         9
+
  #define  BCD_TO_DEC(x)                ( (x>>4) * 10 + (x & 0x0f) )


***************
*** 63,71 ****
    int i;

    if ( peek( CPU_TYPE_SEGMENT, CPU_TYPE_OFFSET ) != PC_AT ) {
!       printf( "-q\n" );
!       exit( 1 );
!   }

    for ( i=0; i<10; i++ ) {
        get_time( &time1 );
--- 71,88 ----
    int i;

    if ( peek( CPU_TYPE_SEGMENT, CPU_TYPE_OFFSET ) != PC_AT ) {
!       port_in(XCLOCK_PORT + XSECOND, &time1.second);
!       port_in(XCLOCK_PORT + XMINUTE, &time1.minute);
!       port_in(XCLOCK_PORT + XHOUR, &time1.hour);
!       port_in(XCLOCK_PORT + XDAY, &time1.day);
!       port_in(XCLOCK_PORT + XMONTH, &time1.month);
!       port_in(XCLOCK_PORT + XYEAR, &time1.year);
!       printf( "%02x%02x%02x%02x%02x%02x\n",
!               time1.month,   time1.day,     time1.year,
!               time1.hour,    time1.minute,  time1.second );
!       exit( 0 ); }
!   else
!   {

    for ( i=0; i<10; i++ ) {
        get_time( &time1 );
***************
*** 84,89 ****
--- 101,107 ----
        exit( 0 );
        }
        }
+   }

    printf( "-q\n" );
    exit( 1 );

Problems with missing or to many TABS and BLANKS have to be taken into account,
because I had to edit many patches by hand.

H.-J. Knobloch    TH Darmstadt  (West-Gemany)