! Xyplex CCL   $RCSfile: Microcom_4232_series,v $
!             $Revision: 1.3 $
!                 $Date: 1994/01/06 20:53:33 $
!
!==============================================================================
!
!  MODEM SCRIPT FOR THE MICROCOM 4232BIS SERIES MODEMS - NORMAL MODE
!                   **********
!
!  Version 1.1.2  (with out EC and DC)  February 19, 1993
!
!  Authors: G. Pearson & J. Fitzgerald
!           Microcom, Inc.
!
!  Ammended by M. S-Carter - Microcom, Inc. 
!
!    4/26/93 - Changed serial port settings in ARA to fix DTE rate - FC
!        
!  Please direct questions to Martin S-Carter (617) 551-1313
!     
!==============================================================================
!
!******************************************************************************
! ENTRY POINT - Originate
! ENTRY POINT - Answer
!
@ORIGINATE
@ANSWER
!
! Configure the serial port.
!     - 19,200 bps (max speed feasible for MAC, the modem can go faster...)
!     - no parity, 8 data bits, 1 stop bit (ARAP requires this char format)
!
serreset 19200, 0, 8, 1
!
! Set the modem configuration to a known state by recalling the factory
! configuration (&F).  Also:
!     - turn off command echo (E0)
!     - disable auto-answering (S0=0) 
!     - CD follows the state of carrier from the remote modem (&C1)
!     - DTE On-to-Off causes hangup (&D2)
!     - *FC Disabled (\Q0)
!     - *Normal Connection \N0.
!     - *auto-bps adjust diabled /J0. 
!     - set disconnect buffer delay, to be sure that ARAP disconnect message
!       gets through on hangup (%D2)
! 
matchclr
matchstr 1 1 "OK\13\10"
write "AT&FE0S0=0&C1&D2\\Q0\\N0\\V0\\J0%C0%D2-J0-K0\13"
matchread 30
jump 59
!
! Configure the modem speaker.  If the 'speaker on' flag is true, do nothing
! as the speaker is on-til-carrier in the default configuration.  Else turn
! off the speaker.
!
@LABEL 1
ifstr 2 2 "1"
matchstr 1 2 "OK\13\10"
write "ATM0\13"
matchread 30
jump 59
!
! Continue configuration based on originate/answer role.
!
@LABEL 2
ifANSWER 4
!
! Configure modem for call originating:
!
matchstr 1 8 "OK\13\10"
write "AT\\V0\13"
matchread 30
jump 59
!
! Configure modem for call answering.
!     - enable auto-answer on the first ring (S0=1)
!     - set response string type (\V0)
!
@LABEL 4
matchstr 1 30 "OK\13\10"
write "ATS0=1\\V0\13"
matchread 30
jump 59
!
! Originate a call.  Tone dial the number passed in string ^1.
!
@LABEL 8
note "Dialing ^1" 3
write "ATDT^1\13"
!
@LABEL 9
matchstr 1 11 "CONNECT 1200\13\10"
matchstr 2 12 "CONNECT 2400\13\10"
matchstr 3 13 "CONNECT 4800\13\10"
!matchstr 4 14 "CONNECT 7200\13\10"
matchstr 5 15 "CONNECT 9600\13\10"
!matchstr 6 16 "CONNECT 12000\13\10"
matchstr 7 17 "CONNECT 14400\13\10"
matchstr 8 50 "NO CARRIER\13\10"
matchstr 9 50 "ERROR\13\10"
matchstr 10 52 "NO DIALTONE\13\10"
matchstr 11 53 "BUSY\13\10"
matchstr 12 54 "NO ANSWER\13\10"
matchread 1200
jump 59
!
! A connection has been established.  Enable outputCTS flow control in the
! serial driver.  If we were the call originator, wait 6 seconds before exiting the script.
!
@LABEL 11
note "Communicating with MNP 10" 2
CommunicatingAt 1200
jump 18
!
@LABEL 12
note "Communicating at 2400" 2
CommunicatingAt 2400
jump 18
!
@LABEL 13
note "Communicating at 4800" 2
CommunicatingAt 4800
jump 18
!
@LABEL 14
note "Communicating at 7200" 2
CommunicatingAt 7200
jump 18
!
@LABEL 15
note "Communicating at 9600" 2
CommunicatingAt 9600
jump 18
!
@LABEL 16
note "Communicating at 12000" 2
CommunicatingAt 12000
jump 18
!
@LABEL 17
note "Communicating at 14400" 2
!setspeed 14400, 0, 8, 1
CommunicatingAt 14400
!
@LABEL 18
HSReset 0 1 0 0 0 0 
ifANSWER 19
pause 30
@LABEL 19
exit 0
!
! Answer a call.
! 
@LABEL 30
matchstr 1 32 "RING\13\10"
matchstr 2 11 "CONNECT 1200\13\10"
matchstr 3 12 "CONNECT 2400\13\10"
matchstr 4 13 "CONNECT 4800\13\10"
matchstr 5	14 "CONNECT 7200\13\10"
matchstr 6 15 "CONNECT 9600\13\10"
matchstr 7	16 "CONNECT 12000\13\10"
matchstr 8  17 "CONNECT 14400\13\10"
matchstr 9  50 "NO CARRIER\13\10"
matchstr 10	50 "ERROR\13\10"
matchstr 11	52 "NO DIALTONE\13\10"
matchstr 12	53 "BUSY\13\10"
matchstr 13 54 "NO ANSWER\13\10"
matchread 1200
jump 30
!
@LABEL 32
userhook 1
note "Answering phone" 2
jump 30
!
! @LABEL 50-59: Exit with an error message.
!
! No carrier
@LABEL 50
exit -6021
!
! No dialtone
@LABEL 52
exit -6020
!
! Line busy
@LABEL 53
exit -6022
!
! No answer
@LABEL 54
exit -6023
!
! Modem not responding.
@LABEL 59
exit -6019
!
!*******************************************************************************
! ENTRY POINT - Hang up
!
@HANGUP
@LABEL 60
HSReset 0 0 0 0 0 0 
!
! Drop DTR
!
DTRClear
pause 5
DTRSet
pause 10
!
! Reconfigure modem to factory default settings and be sure that
! auto-answer is disabled.
!
write "AT&FS0=0\13"
matchclr
matchstr 1 63 "OK\13\10"
matchread 30
!
@LABEL 63
exit 0
