# pragma ident "@(#)bnu:README	1.4 91/11/07 "

===============================================================================
General Information
-------------------------------------------------------------------------------

The Macintosh serial ports are DIN-8 sockets (8 pins) connected to a Zilog
SCC chip.  This ports are based on the RS-422 standard but may be used per
the RS-423 standard to drive RS-232C style devices.  A/UX being UNIX based,
the RS-232C standard is of more interest to us than the RS-422.  The DIN-8
pinouts on the Mac (looking at the end of a DIN-8 cable plug end):

                         _____ 
                       /       \
                      /   2 1   \
                      | 5   4 3 |
                      \  8 7 6  /
                       -=======-
		(flat-bottom part of plug)

 Pin  Signal    Description
 ---  ------    -----------
  1   HSKo	Output Handshake
  2   HSKi	Input Handshake or external clock
  3   TxD-	Transmit Data -
  4   GND	Signal Ground
  5   RxD-	Receive Data -
  6   TxD+	Transmit Data +
  7   GPi	General-Purpose input	(A/UX does not support this pin)
  8   RxD+	Receive Data +

Of the 8 DIN-8 pins on the Mac, three are "control" signals:

  pin 1: HandShake Output (HSKo)	[sent to modem]
	 Used for DTR (Data Terminal Ready)

  pin 2: HandShake Input (HSKi)		[received from modem]
	 Used for CTS (Clear To Send)
	       or DCD (Data Carrier Detect)
	       or DSR (Data Set Ready)

  pin 7: General Purpose Input (GPi) 	[not supported under A/UX]

Notice you have only one input and one output control signal that's supported
by A/UX; two control signals in all.  A/UX doesn't support Data Carrier Detect
(DCD) in any way, shape, or form; pin 7 is ignored by the kernel.

DCD usually, but you only have two.  So decisions have to be made as to which
signals are important and which are not.  So, let's look into this problem.

  DTR is raised by the local computer (DTE) when it is ready to communicate
  with the local modem (DCE).  When the local modem sees this signal has been
  raised, it will do whatever is necessary to get ready to communicate with
  the local computer and a remote modem.  If the local computer lowers the
  DTR, it indicates to the local modem that it is no longer ready or willing
  to communicate with the local modem, so the local modem should hangup any
  connection with a remote modem (assuming it made one).

  DSR is raised by the local modem when it's ready to communicate with the
  local computer.  It doesn't mean the local modem has established contact with
  the remote modem.  It just means it's ready and able to receive the commands
  from the local computer and should be able to establish contact with a 
  remote modem.

  DCD is raised by the local modem when it has establised contact with the
  remote modem and lowered when the contact is lost (or never made).

  CTS (Clear To Send or HSKi) is raised by the local modem when it's ok for the
  local computer to send data to the local modem.  When the signal is lowered
  by the local modem, the local computer will stop sending data until the
  signal is raised again (by the local modem).  This is used to prevent the 
  local modem's buffers from being overrun with data from the local computer. 

That's pretty much the major signals we care about.  We'll look at sample of
modems and see how they use these signals.

  Apple Personal Modem
  --------------------
    DIN-8 pin 2 (HSKi) is used for DTR.
    DIN-8 pin 1 (HSKo) is used for DSR.
    DIN-8 pin 7 (GPi) is used for DCD. (not supported under A/UX)
    No support for CTS.

  Apple Data Modem 2400
  ---------------------
    DIN-8 pin 2 (HSKi) is used for DTR.
      AT&D0: DTR is ignored.
      AT&D1: doesn't hang up, but assumes command state when DTR is lowered.
      AT&D2: hangs up, and assumes command state when DTR is lowered.
      AT&D3: resets when DTR is lowered.

    DIN-8 pin 1 (HSKo) is used for CTS or DSR.
      AT&K0: DSR is raised when modem is ready to talk.
      AT&K1: DSR is raised when modem is ready to talk.
      AT&K2: DSR is raised when modem is ready to talk.
      AT&K3: CTS is raised when it's ok for the computer to send data.
      AT&K4: DSR is raised when modem is ready to talk.
      AT&K5: DSR is raised when modem is ready to talk.

    DIN-8 pin 7 (GPi) is used for DCD. (not supported under A/UX)
      AT&C0: DCD is always raised.
      AT&C1: DCD is raised when local and remote modems are connected.

  Hayes SmartModem 1200
  ---------------------
    RS-232C(25-pin) pin 20 is used for DTR.
      Switch 1 Up:   hangs up if DTR is lowered.
      Switch 1 Down: DTR is ignored.

    RS-232C(25-pin) pin 6 is used for DSR.
      Raised when modem is on.

    RS-232C(25-pin) pin 8 is used for DCD.
      Switch 6 Up:   DCD is raised when local and remote modems are connected.
      Switch 6 Down: DCD is always raised.

    RS-232C(25-pin) pin 5 is used for CTS.
      Raised when modem is on.

  Hayes SmartModem 2400
  ---------------------
    RS-232C(25-pin) pin 20 is used for DTR.
      AT&D0: DTR is ignored.
      AT&D1: doesn't hang up, but assumes command state when DTR is lowered.
      AT&D2: hangs up, and assumes command state when DTR is lowered.
      AT&D3: resets when DTR is lowered.

    RS-232C(25-pin) pin 6 is used for DSR.
      Raised when modem is on.

    RS-232C(25-pin) pin 8 is used for DCD.
      AT&C0: DCD is always raised.
      AT&C1: DCD is raised when local and remote modems are connected.

    RS-232C(25-pin) pin 5 is used for CTS.
      Raised when modem is on.

  Microcom ZX
  -----------
    RS-232C(25-pin) pin 20 is used for DTR.
      Switch 1 Up:   hangs up if DTR is lowered.
      Switch 1 Down: DTR is ignored.

    RS-232C(25-pin) pin 6 is used for DSR.
      Raised when modem is on.

    RS-232C(25-pin) pin 8 is used for DCD.
      Switch 6 Up:   DCD is raised when local and remote modems are connected.
      Switch 6 Down: DCD is always raised.

    RS-232C(25-pin) pin 5 is used for CTS.
      (rear) Switch 1 Down and (rear) Switch 2 Up:
	     CTS is raised when it's ok for the computer to send data.

  TrailBlazer Plus
  ----------------
    There are zillions of options for the trailblazer...

The net result of all this is that you need to monitor the DCD signal from
the modem to determine when carrier is lost (the two modems are no longer
talking to each other and you need to send DTR to tell the modem to hangup.  
These are the two most important signals.  If you want to use hardware
flow-control, you'll have to give up the ability to monitor the carrier lost
signal (DCD) and monitor the CTS signal instead.

-----------------------------------------------------
Notes on using the Apple Personal and Data Modem 2400
-----------------------------------------------------

First, you'll need the Apple System/Peripheral-8 Cable, which has the Apple
sales part number M0197 (the actual cable has an Apple internal part number
of 590-0552-A or 590-0340 stamped on the plug ends).  This is a DIN-8 to
DIN-8 cable with the following pinouts (the colors may be different in the
actual cable you receive):

    Computer                              Modem
  DIN-8 (male)                         DIN-8 (male)
  ------------                         ------------
  HSKo (DTR) 1 >>----- red --------->> 2 (DTR) HSKi
  HSKi (CTS) 2 <<----- brown -------<< 1 (DSR) HSKo (or CTS)
  TxD- (TD)  3 >>----- green ------->> 5 (TD)  RxD-
  GND  (GND) 4 ------- yellow -------- 4 (GND) GND
  RxD- (RD)  5 <<----- orange ------<< 3 (RD)  TxD-
  TxD+       6 >>----- silver ------>> 8       RxD+
  GPi  (DCD) 7 <<----- purple ------<< 7 (DCD) GPi
  RxD+       8 <<----- blue --------<< 6       TxD+

Notice that the DCD from the Apple modems will not be seen by A/UX because it
doesn't support the GPi pin.  If you want to monitor the state of the DCD
signal, you'll need to modify the cable so it routes the GPi signal from the
modem to the HSKi signal in the computer:

    Computer                              Modem
  DIN-8 (male)                         DIN-8 (male)
  ------------                         ------------
  HSKo (DTR) 1 >>----- red --------->> 2 (DTR) HSKi
  HSKi (CTS) 2 <<----- brown -------<< 7 (DCD) GPi
  TxD- (TD)  3 >>----- green ------->> 5 (TD)  RxD-
  GND  (GND) 4 ------- yellow -------- 4 (GND) GND
  RxD- (RD)  5 <<----- orange ------<< 3 (RD)  TxD-
  TxD+       6 >>----- silver ------>> 8       RxD+
  GPi  n/c                             1 n/c
  RxD+       8 <<----- blue --------<< 6       TxD+

You need to decide if you want the modem to be used for in-coming or out-going
calls.  Bi-directional support is not really supported under A/UX. You might
be able to get the modem to work in both directions.  In all cases, we 
assume the modem has the factory default settings.  After making changes,
save them with the AT&W command.

CONFIGURING THE MODEM FOR DIAL-IN:
  (Parameters that differ from the factory defaults)

  ATS0=1
    Forces the modem to answer the phone on the first ring.

  ATE0
  ATQ1
    Forces the modem not to send any messages from the command state.  This
    is necessary to keep the getty/login programs from holding a rather useless
    conversation with the modem.
   
  AT&D2  
    The modem will hang-up the connection and assume the command state when
    the state of the Hski pin is lowered. 

  AT&K0
    Turn off flow control. 

CONFIGURING THE MODEM FOR DIAL-OUT:
  (Parameters that differ from the factory defaults)

  AT&D2  
    The modem will hang-up the connection and assume the command state when
    the state of the Hski pin is lowered.

  AT&K0
    Turn off flow control.  Only use this for uucico transfers. You may wish
    to try the other flow control settings.

-------------------------------
Notes on using non-Apple Modems
-------------------------------

You'll need to buy or construct a cable that has a DIN-8 plug (male) on one
end and a RS-232C style 25-pin plug (male) on the other:

  DIN-8 (male)                         25-pin (male)
  ------------                         -------------
  HSKo (DTR) 1 >>-----------------+->> 20 DTR
                                  +->>  4 RTS
  GND  (GND) 4 -------------------+---  7 GND
  RxD+ (?)   8 <<-----------------+
  HSKi (CTS) 2 <<-------------------<< (8 CD) or (2 CTS) or (6 DSR)
  TxD- (TD)  3 >>------------------->>  2 TD
  RxD- (RD)  5 <<-------------------<<  3 RD
  TxD+ (?)   6 n/c
  GPi  (?)   7 n/c

-----------------------------------------------------
The complete list of BNU files
-----------------------------------------------------

  File					Own  Grp  Mode Type

Required directories:
  /usr/lib/uucp				uucp uucp 0755 directory
  /usr/spool/locks			uucp uucp 0777 directory
  /usr/spool/uucp			uucp uucp 0755 directory
  /usr/spool/uucp/.Admin		uucp uucp 0755 directory
  /usr/spool/uucp/.Corrupt		uucp uucp 0755 directory
  /usr/spool/uucp/.Log			uucp uucp 0755 directory
  /usr/spool/uucp/.Log/uucico		uucp uucp 0755 directory
  /usr/spool/uucp/.Log/uucp		uucp uucp 0755 directory
  /usr/spool/uucp/.Log/uux		uucp uucp 0755 directory
  /usr/spool/uucp/.Log/uuxqt		uucp uucp 0755 directory
  /usr/spool/uucp/.Old			uucp uucp 0755 directory
  /usr/spool/uucp/.Sequence		uucp uucp 0755 directory
  /usr/spool/uucp/.Status		uucp uucp 0755 directory
  /usr/spool/uucp/.Workspace		uucp uucp 0755 directory
  /usr/spool/uucp/.Xqtdir		uucp uucp 0755 directory
  /usr/spool/uucppublic			uucp uucp 0777 directory

Empty files:
  /usr/spool/uucp/.Admin/Foreign	uucp uucp 0640 text
  /usr/spool/uucp/.Admin/account	uucp uucp 0644 text
  /usr/spool/uucp/.Admin/audit		uucp uucp 0640 text
  /usr/spool/uucp/.Admin/command	uucp uucp 0644 text
  /usr/spool/uucp/.Admin/ctlog		uucp uucp 0640 text
  /usr/spool/uucp/.Admin/culog		uucp uucp 0640 text
  /usr/spool/uucp/.Admin/errors		uucp uucp 0644 text
  /usr/spool/uucp/.Admin/perflog	uucp uucp 0644 text
  /usr/spool/uucp/.Admin/security	uucp uucp 0640 text

/bin:
  ct     				root uucp 4111 executable

/etc:
  uucpd 				uucp uucp 0100 executable

/usr/ucb:
  uusend				uucp uucp 4111 executable

/usr/lib/uucp:
  Config				uucp uucp 0644 text
  Devconfig				uucp uucp 0644 text
  Devices				uucp uucp 0644 text
  Dialcodes				uucp uucp 0644 text
  Dialers				uucp uucp 0644 text
  Grades				uucp uucp 0644 text
  Limits				uucp uucp 0644 text
  Permissions				uucp uucp 0600 text
  Poll					uucp uucp 0644 text
  Sysfiles				uucp uucp 0644 text
  Systems				uucp uucp 0600 text
  Uutry					uucp uucp 0555 script
  remote.unknown			uucp uucp 4111 executable
  uucheck				uucp uucp 0110 executable
  uucico				uucp uucp 4111 executable
  uucleanup				uucp uucp 0110 executable
  uudemon.admin				uucp uucp 0555 script
  uudemon.cleanup			uucp uucp 0555 script
  uudemon.hour				uucp uucp 0555 script
  uudemon.poll				uucp uucp 0555 script
  uusched				uucp uucp 4111 executable
  uuxqt					uucp uucp 4111 executable

/usr/bin:
  cu     				uucp uucp 4111 executable
  uucp   				uucp uucp 4111 executable
  uudecode				uucp uucp 0555 executable
  uuencode				uucp uucp 0555 executable
  uuglist 				uucp uucp 4111 executable
  uulog   				uucp uucp 0555 script
  uuname  				uucp uucp 4111 executable
  uupick  				uucp uucp 0555 script
  uustat  				uucp uucp 4111 executable
  uuto    				uucp uucp 0555 script
  uux     				uucp uucp 4111 executable

===============================================================================
Questions and Answers
-------------------------------------------------------------------------------

Q:
  What is hardware flow-control?

A:
  The modem can tell the computer when to send data to it by raising (ok to
  send the data) and lowering (stop sending the data) it's CTS signal which
  is connected to the HSKi signal (DIN-8, pin 2 on the Mac).  The modem uses
  this raising and lowering of the CTS signal to keep it's internal character
  buffer from overflowing with computer's data stream.  Other methods of flow
  control, such as Xon/Xoff can also be used, but where hardware flow-control
  really shines is when sending 8-bit binary.  With Xon/Xoff flow-control, the
  Xon/Xoff characters themselves might be "seen" in the binary data stream and
  acted upon.  This can cause a uucico connection to fail, so you should NEVER
  use Xon/Xoff flow-control with uucico (unless you're using the 'f' protocol).
  
  The Apple Personal Modem doesn't have hardware flow-control support, but
  the Apple Data Modem 2400 does.  You'll have to look at Owner's Manual for
  3rd party modems to determine if they support it.  Usually the CTS signal is
  used for hardware flow-control.

  The big problem with using the HSKi pin on the Mac for hardware flow-control
  is that you can no longer monitor the state of the DCD signal from the modem.
  This means you can not detect when the modem hangs up.

