! Zoom Universal CCL for all Zoom Modems (sets Port to 115K) ! Author: Kris Kreutzman ! Modified by Damien Stefanidis for Zoom Telephonics on 5-25-97 ! Modified to be V.90 & Lucent/Rockwell compliant by Kaz Mizuma for Zoom Telephonics on 8-28-98 ! ! Copyright: © 1991-1996 Apple Computer, Inc. All Rights Reserved. ! ! revision history: ! v2.1 as shipped with the ARA 2.1 ! ! 'mlts' resource info for this modem: ! byte 1 == 01 -> modem HAS built-in error correction protocols ! byte 2 == 01 -> modem HAS built-in data compression protocols ! byte 3 == 38 -> max number of chars in varstr 7 ! byte 4 == 38 -> max number of chars in varstr 8 ! byte 5 == 38 -> max number of chars in varstr 9 ! @ORIGINATE @ANSWER ! ! ---- Initial modem setup ---- ! ! Set serial port speed depending upon the compression flag ! A higher rate with compression on to handle expanded data from the modem ! A lower rate closer to the DCE when compression is off ! ifstr 5 1 "0" serreset 115200, 0, 8, 1 jump 2 ! @LABEL 1 serreset 57600, 0, 8, 1 ! @LABEL 2 hsreset 0 0 0 0 0 0 settries 0 ! ! Get the modem's attention ! matchclr matchstr 1 3 "OK\13\10" write "AT\13" matchread 30 ! @LABEL 3 ! ! Setup the modem for the following: ! Reset to factory settings ! Standard compression/reliablity ! Lock serial port speed ! Serial port hardware handshaking, turn off software handshaking ! Verbose responses and compression/protocol results ! CONNECT returns DCE speed ! Turn off answering ! Reset or return to command mode on DTR toggle (optional) ! matchclr matchstr 1 4 "OK\13\10" matchstr 2 111 "ERROR\13\10" write "AT&FE0V1&C1&D2\\N3S95=45S0=0\13" matchread 30 inctries iftries 3 111 ! ! Reset the Modem on setup failure ! DTRClear pause 5 DTRSet flush jump 3 ! ! @LABEL 4 ! Varstring 4 , reliable link protocol: ! = 0, handled by computer (ARAP) ! = 1, handled by modem (PPP) ! = 2, MNP10 protocol (Cellular protocol, no longer supported) ifstr 4 5 "1" ifstr 4 5 "2" ! ! Varstring 4 == 0, turn off reliable link protocol in modem (ARAP) matchclr matchstr 1 9 "OK\13\10" write "AT\\N0\13" matchread 30 jump 111 ! ! @LABEL 5 ! Varstring 5, compression protocol: ! = 0, handled by computer ! = 1, handled by modem ifstr 5 9 "1" ! ! Varstring 5 == 0, turn off compression protocol in modem. matchclr matchstr 1 9 "OK\13\10" write "AT%C0\13" matchread 30 jump 111 ! ! @LABEL 9 ! Varstring 2, modem speaker: ! = 0, speaker off ! = 1, speaker on ifstr 2 13 "1" pause 5 matchclr matchstr 1 13 "OK\13\10" write "ATM0\13" matchread 30 jump 111 ! ! Modem ready, wait for a call or originate a call ! @LABEL 13 ifANSWER 32 ! ! ! ---- Originating a call ---- ! ! Varstring 6, dialing mode: ! = 0, normal dialing ! = 1, blind dialing ! = 2, manual dialing ifstr 6 17 "1" ifstr 6 15 "2" jump 19 ! @LABEL 15 ! Display ASK dialog with message. Goto label 117 if dialog canceled. ASK 2 "Pick up the phone & dial ^1. Hit OK when the phone rings, then hangup." 117 note "Manual dialing initiated" 3 ! X1 to ignore dialtone & busy, D to dial, \^ generates data tone write "ATX1D\13" jump 32 ! @LABEL 17 note "Dialing without tone" 3 matchclr matchstr 1 19 "OK\13\10" ! X1 to ignore dialtone & busy write "ATX1\13" matchread 30 jump 111 ! ! @LABEL 19 ! Display the full dialstring contained in Varstring 1 note "Dialing ^1" 3 ! ! Varstrings 7, 8 and 9, contain dialstring fragments ! Long phone numbers may need to be split into smaller groups ! for the modem to use ! ! Varstring 3: "p" for pulse & "t" for tone dialing ! Varstring 8 == blank (dialstring in varstring 7) ! Varstring 9 == blank (dialstring in varstrings 7 & 8) ! Otherwise (dialstring in varstrings 7, 8 & 9) ! \^ is added to the dialstring to force the modem to generate a data tone ifstr 8 27 " " ifstr 9 24 " " ! ! Write dialstring in varstrings 7, 8 & 9 matchclr matchstr 1 21 "OK\13\10" write "ATD^3^7;\13" matchread 400 jump 111 @LABEL 21 matchclr matchstr 1 22 "OK\13\10" write "ATD^3^8;\13" matchread 400 jump 111 @LABEL 22 write "ATD^3^9\13" jump 32 ! ! @LABEL 24 ! Write dialstring in varstrings 7 & 8 matchclr matchstr 1 25 "OK\13\10" write "ATD^3^7;\13" matchread 400 jump 111 @LABEL 25 write "ATD^3^8\13" jump 32 ! @LABEL 27 ! Write dialstring in varstring 7 write "ATD^3^7\13" ! ! ! ---- Connection response ---- ! ! The following section will parse modem responses of two types: ! 1) PROTOCOL: xxx, COMPRESSION: xxx, CONNECT xxx ! 2) CONNECT xxx/ARQ/V42 ! @LABEL 32 matchclr matchstr 1 91 "RING\13\10" matchstr 2 112 "NO DIALTONE\13\10" matchstr 3 113 "NO CARRIER" matchstr 4 113 "ERROR\13\10" matchstr 5 114 "BUSY\13\10" matchstr 6 115 "NO ANSWER\13\10" matchstr 7 33 "CONNECT " matchstr 8 32 "CARRIER" matchstr 9 40 "CONNECT\13\10" matchstr 10 72 "PROTOCOL: LAP" matchstr 11 72 "PROTOCOL: MNP" matchstr 12 72 "PROTOCOL: ALT" matchstr 13 77 "COMPRESSION: V" matchstr 14 77 "COMPRESSION: MNP5" matchstr 15 77 "COMPRESSION: CLASS" matchread 700 ifANSWER 32 jump 111 ! ! Parse the speed of connect result codes ! 2400 and 4800 have two entries each ! to distinguish them from 24000 and 48000 ! @LABEL 33 matchclr matchstr 1 40 "2400\13" matchstr 2 40 "2400/" matchstr 3 41 "4800\13" matchstr 4 41 "4800/" matchstr 5 42 "7200" matchstr 6 43 "9600" matchstr 7 44 "12000" matchstr 8 45 "14400" matchstr 9 46 "16800" matchstr 10 47 "19200" matchstr 11 48 "21600" matchstr 12 49 "24000" matchstr 13 50 "26400" matchstr 14 51 "28800" matchstr 15 52 "31200" matchstr 16 53 "33600" matchstr 17 54 "34000" matchstr 18 55 "36000" matchstr 19 56 "38000" matchstr 20 57 "40000" matchstr 21 58 "42000" matchstr 22 59 "44000" matchstr 23 60 "46000" matchstr 24 61 "48000" matchstr 25 62 "50000" matchstr 26 63 "52000" matchstr 27 64 "54000" matchstr 28 83 "28000" matchstr 29 84 "29333" matchstr 30 85 "3066" matchstr 31 86 "32000" matchstr 32 87 "33333" matchstr 33 88 "3466" matchstr 34 89 "36000" matchstr 35 93 "37333" matchstr 36 94 "3866" matchstr 37 95 "41333" matchstr 38 96 "4266" matchstr 39 97 "45333" matchstr 40 98 "4666" matchstr 41 119 "49333" matchstr 42 120 "5066" matchstr 43 121 "53333" matchstr 44 122 "5466" matchstr 45 123 "56000" matchread 30 jump 69 ! ! -- Connection rates -- ! CommunicatingAt informs ARA of the raw modem to modem ! connection speed. ! @LABEL 40 note "Communicating at 2400 bps." 2 CommunicatingAt 2400 jump 70 ! @LABEL 41 note "Communicating at 4800 bps." 2 CommunicatingAt 4800 jump 70 ! @LABEL 42 note "Communicating at 7200 bps." 2 CommunicatingAt 7200 jump 70 ! @LABEL 43 note "Communicating at 9600 bps." 2 CommunicatingAt 9600 jump 70 ! @LABEL 44 note "Communicating at 12000 bps." 2 CommunicatingAt 12000 jump 70 ! @LABEL 45 note "Communicating at 14400 bps." 2 CommunicatingAt 14400 jump 70 ! @LABEL 46 note "Communicating at 16800 bps." 2 CommunicatingAt 16800 jump 70 ! @LABEL 47 note "Communicating at 19200 bps." 2 CommunicatingAt 19200 jump 70 ! @LABEL 48 note "Communicating at 21600 bps." 2 CommunicatingAt 21600 jump 70 ! @LABEL 49 note "Communicating at 24000 bps." 2 CommunicatingAt 24000 jump 70 ! @LABEL 50 note "Communicating at 26400 bps." 2 CommunicatingAt 26400 jump 70 ! @LABEL 51 note "Communicating at 28800 bps." 2 CommunicatingAt 28800 jump 70 ! @LABEL 52 note "Communicating at 31200 bps." 2 CommunicatingAt 31200 jump 70 ! @LABEL 53 note "Communicating at 33600 bps." 2 CommunicatingAt 33600 jump 70 ! @LABEL 54 note "Communicating at 34000 bps." 2 CommunicatingAt 34000 jump 70 ! @LABEL 55 note "Communicating at 36000 bps." 2 CommunicatingAt 36000 jump 70 ! @LABEL 56 note "Communicating at 38000 bps." 2 CommunicatingAt 38000 jump 70 ! @LABEL 57 note "Communicating at 40000 bps." 2 CommunicatingAt 40000 jump 70 ! @LABEL 58 note "Communicating at 42000 bps." 2 CommunicatingAt 42000 jump 70 ! @LABEL 59 note "Communicating at 44000 bps." 2 CommunicatingAt 44000 jump 70 ! @LABEL 60 note "Communicating at 46000 bps." 2 CommunicatingAt 46000 jump 70 ! @LABEL 61 note "Communicating at 48000 bps." 2 CommunicatingAt 48000 jump 70 ! @LABEL 62 note "Communicating at 50000 bps." 2 CommunicatingAt 50000 jump 70 ! @LABEL 63 note "Communicating at 52000 bps." 2 CommunicatingAt 52000 jump 70 ! @LABEL 64 note "Communicating at 54000 bps." 2 CommunicatingAt 54000 jump 70 ! @LABEL 83 note "Communicating at 28000 bps." 2 CommunicatingAt 28000 jump 70 ! @LABEL 84 note "Communicating at 29333 bps." 2 CommunicatingAt 29333 jump 70 ! @LABEL 85 note "Communicating at 30667 bps." 2 CommunicatingAt 30667 jump 70 ! @LABEL 86 note "Communicating at 32000 bps." 2 CommunicatingAt 32000 jump 70 ! @LABEL 87 note "Communicating at 33333 bps." 2 CommunicatingAt 33333 jump 70 ! @LABEL 88 note "Communicating at 34667 bps." 2 CommunicatingAt 34667 jump 70 ! @LABEL 89 note "Communicating at 36000 bps." 2 CommunicatingAt 36000 jump 70 ! @LABEL 93 note "Communicating at 37333 bps." 2 CommunicatingAt 37333 jump 70 ! @LABEL 94 note "Communicating at 38667 bps." 2 CommunicatingAt 38667 jump 70 ! @LABEL 95 note "Communicating at 41333 bps." 2 CommunicatingAt 41333 jump 70 ! @LABEL 96 note "Communicating at 42667 bps." 2 CommunicatingAt 42667 jump 70 ! @LABEL 97 note "Communicating at 45333 bps." 2 CommunicatingAt 45333 jump 70 ! @LABEL 98 note "Communicating at 46667 bps." 2 CommunicatingAt 46667 jump 70 ! @LABEL 119 note "Communicating at 49333 bps." 2 CommunicatingAt 49333 jump 70 ! @LABEL 120 note "Communicating at 50667 bps." 2 CommunicatingAt 50667 jump 70 ! @LABEL 121 note "Communicating at 53333 bps." 2 CommunicatingAt 53333 jump 70 ! @LABEL 122 note "Communicating at 54667 bps." 2 CommunicatingAt 54667 jump 70 ! @LABEL 123 note "Communicating at 56000 bps." 2 CommunicatingAt 56000 jump 70 ! @LABEL 69 note "Communicating at an unknown rate." 2 jump 70 ! ! Look for reliablilty and compression results ! at the end of the connect result. ! @LABEL 70 matchclr matchstr 1 73 "LAPM" matchstr 2 73 "REL" matchstr 3 73 "ARQ" matchstr 4 78 "COMP/" matchstr 5 78 "COMP\13" matchstr 6 73 "V42/" matchstr 7 73 "V42\13" matchstr 8 78 "V42BIS" matchstr 9 78 "V42bis" matchstr 10 73 "MNP\13" matchstr 11 78 "MNP5" matchstr 12 80 "\10" matchread 30 jump 80 ! -- Modem error correction link negotiation -- ! Userhook 2 informs ARA that a modem-to-modem error ! correcting protocol has been negotiated ! ! @LABEL 72 note "Modem Reliable Link Established." 2 userhook 2 jump 32 ! @LABEL 73 note "Modem Reliable Link Established." 2 userhook 2 jump 70 ! ! -- Compression negotiation -- ! Userhook 3 informs ARA that a modem-to-modem compression ! protocol has been negotiated ! @LABEL 77 note "Modem Compression Established." 2 userhook 3 jump 32 ! @LABEL 78 note "Modem Compression Established." 2 userhook 3 jump 70 ! ! ! -- Normal exit after "CONNECT" -- ! ! This modem has been setup to do CTS handshaking, ! and we assume that a CTS handshaking cable is being used. ! @LABEL 80 ! Turn on CTS handshaking. HSReset 0 1 0 0 0 0 ! ifANSWER 81 pause 30 @LABEL 81 exit 0 ! ! ! ---- Answer calls ---- ! ! A RING result from the modem and in ANSWERING mode ! claims the serial port and answering the phone ! @LABEL 91 ifORIGINATE 32 userhook 1 note "Answering phone..." 2 write "ATA\13" jump 32 ! ! ! ---- Hang up and reset modem ---- ! @HANGUP @LABEL 100 settries 0 HSReset 0 0 0 0 0 0 ! @LABEL 102 ! Escape from data to command mode matchclr matchstr 1 106 "OK\13\10" write "+++" matchread 20 ! @LABEL 104 ! Force a hangup matchclr matchstr 1 108 "NO CARRIER\13\10" matchstr 2 108 "OK\13\10" matchstr 3 108 "ERROR\13\10" matchstr 4 108 "0\13\10" write "ATH\13" matchread 30 ! ! Try to get control of the modem by toggling DTR DTRClear pause 5 DTRSet flush ! ! Try the hangup sequence three times otherwise declare and error inctries iftries 3 111 jump 102 ! @LABEL 106 ! Pause between data and command mode pause 50 jump 104 ! ! @LABEL 108 ! Recall the factory settings pause 15 matchclr matchstr 1 109 "OK\13\10" write "AT&F\13" matchread 30 jump 111 ! @LABEL 109 exit 0 ! ! ---- Error messages ----- ! ! Modem Not Responding @LABEL 111 exit -6019 ! ! No Dial Tone @LABEL 112 exit -6020 ! ! No Carrier or Error @LABEL 113 exit -6021 ! ! Busy @LABEL 114 exit -6022 ! ! No Answer @LABEL 115 exit -6023 ! ! User Cancellation @LABEL 117 exit -6008