STTY(II)                     12/15/74                    STTY(II)

     stty - set mode of typewriter

     (stty = 31.)
     (file descriptor in r0)
     sys stty; arg
     arg:  .byte ispeed, ospeed; .byte erase, kill; mode

     stty(fildes, arg)
     struct {
          char ispeed, ospeed;
          char erase, kill;
          int  mode;
     } *arg;

     Stty  sets mode bits and character speeds for the typewriter
     whose file descriptor is passed in r0 (resp.  is  the  first
     argument  to  the call).  First, the system delays until the
     typewriter is quiescent.  The input and  output  speeds  are
     set  from  the  first two bytes of the argument structure as
     indicated by the following table, which corresponds  to  the
     speeds supported by the DH-11 interface.  If DC-11, DL-11 or
     KL-11 interfaces are used, impossible speed changes are  ig-

         0   (hang up dataphone)
         1   50 baud
         2   75 baud
         3   110 baud
         4   134.5 baud
         5   150 baud
         6   200 baud
         7   300 baud
         8   600 baud
         9   1200 baud
         10  1800 baud
         11  2400 baud
         12  4800 baud
         13  9600 baud
         14  External A
         15  External B

     In the current configuration, only 110, 150 and 300 baud are
     really supported on dial-up lines, in that the code  conver-
     sion  and  line control required for IBM 2741's (134.5 baud)
     must be implemented by the user's program, and the  half-du-
     plex  line  discipline  required  for  the 202 dataset (1200
     baud) is not supplied.

     The next two characters of the  argument  structure  specify
     the erase and kill characters respectively.  (Defaults are #

                              - 1 -

STTY(II)                     12/15/74                    STTY(II)

     and @.)

     The mode contains several bits which determine the  system's
     treatment of the typewriter:

          100000 Select  one  of two algorithms for backspace de-
          040000 Select one of two algorithms for  form-feed  and
                 vertical-tab delays
          030000 Select  one  of four algorithms for carriage-re-
                 turn delays
          006000 Select one of four algorithms for tab delays
          001400 Select one of four algorithms for  new-line  de-
          000200 even parity allowed on input (e. g. for M37s)
          000100 odd parity allowed on input
          000040 raw mode: wake up on all characters
          000020 map CR into LF; echo LF or CR as CR-LF
          000010 echo (full duplex)
          000004 map upper case to lower on input (e. g. M33)
          000002 echo and print tabs as spaces
          000001 hang  up (remove `data terminal ready,' lead CD)
                 after last close

     The delay bits specify how long transmission stops to  allow
     for mechanical or other movement when certain characters are
     sent to the terminal.  In all cases a value of  0  indicates
     no delay.

     Backspace  delays are currently ignored but will be used for
     Terminet 300's.

     If a form-feed/vertical tab delay is specified, it lasts for
     about 2 seconds.

     Carriage-return  delay type 1 lasts about .08 seconds and is
     suitable for the Terminet 300.  Delay type 2 lasts about .16
     seconds  and is suitable for the VT05 and the TI 700.  Delay
     type 3 is unimplemented and is 0.

     New-line delay type 1 is dependent on the current column and
     is  tuned for Teletype model 37's.  Type 2 is useful for the
     VT05 and is about .10 seconds.  Type 3 is unimplemented  and
     is 0.

     Tab  delay type 1 is dependent on the amount of movement and
     is tuned to the Teletype model 37.  Other types are unimple-
     mented and are 0.

     Characters  with the wrong parity, as determined by bits 200
     and 100, are ignored.

     In raw mode, every character is passed  immediately  to  the
     program  without  waiting  until a full line has been typed.
     No erase or kill processing is done; the end-of-file charac-
     ter  (EOT), the interrupt character (DEL) and the quit char-

                              - 2 -

STTY(II)                     12/15/74                    STTY(II)

     acter (FS) are not treated specially.

     Mode 020 causes input carriage returns  to  be  turned  into
     new-lines;  input of either CR or LF causes LF-CR both to be
     echoed (used for GE TermiNet 300's and other terminals with-
     out the newline function).

     The  hangup  mode 01 causes the line to be disconnected when
     the last process with the line open closes it or terminates.
     It is useful when a port is to be used for some special pur-
     pose; for example, if it is associated with an ACU  used  to
     place outgoing calls.

     This  system  call  is  also used with certain special files
     other than typewriters, but since none of them are  part  of
     the standard system the specifications will not be given.

     stty(I), gtty(II)

     The error bit (c-bit) is set if the file descriptor does not
     refer to a typewriter.  From C, a negative  value  indicates
     an error.

                              - 3 -