home *** CD-ROM | disk | FTP | other *** search
- ! Geoport/Express Modem
- ! Authors: Kris Kreutzman and Enrico Cadorin
- !
- ! Copyright: © 1991-1996 Apple Computer, Inc. All Rights Reserved.
- !
- ! revision history:
- ! v2.1 as shipped with the ARA 2.1
- ! 1/8/97 YM Modified string of "note", "ASK", "exit"
- ! Added "X4" in modem setup commands
- ! Ignore dialtone command changed "X1" to "X3"
- !
- ! '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 == 65 -> max number of chars in varstr 7
- ! byte 4 == 65 -> max number of chars in varstr 8
- ! byte 5 == 65 -> max number of chars in varstr 9
- !
- @ORIGINATE
- @ANSWER
- !
- ! ---- Initial modem setup ----
- !
- ! 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 responces and compression/protocol results
- ! CONNECT returns DCE speed
- ! Turn off answering
- ! Reset or return to command mode on DTR toggle (optional)
- !
- @LABEL 3
- matchclr
- matchstr 1 4 "OK¥13¥10"
- matchstr 2 101 "ERROR¥13¥10"
- !write "AT&FE0S95=40S7=75S0=0¥13" <YM>
- write "AT&FX4E0S95=40S7=75S0=0¥13"
- matchread 30
- inctries
- iftries 3 101
- !
- ! 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&Q0¥13"
- matchread 30
- jump 101
- !
- !
- @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%C0S46=136¥13"
- matchread 30
- jump 101
- !
- !
- @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 101
- !
- ! Modem ready, wait for a call or originate a call
- !
- @LABEL 13
- ifANSWER 82
- !
- !
- ! ---- Originating a call ----
- !
- ! Varstring 6, dialing mode:
- ! = 0, normal dialing
- ! = 1, blind dialing
- ! = 2, manual dialing
- ! otherwise dial as ARA version 1.0
- ifstr 6 19 "0"
- ifstr 6 17 "1"
- ifstr 6 15 "2"
- !
- ! Dialing for ARA version 1.0
- note "^1 にダイアルしています..." 3
- write "ATD^3^1¥13
- jump 32
- !
- @LABEL 15
- ! Display ASK dialog with message. Goto label 120 if dialog canceled.
- ASK 2 "受話器を上げて、^1 をダイアルしてください。発信音が鳴ったら OK をクリックして、受話器を戻してください。" 120
- note "手動でダイアルしています..." 3
- ! X1 to ignore dialtone & busy, D to dial, ¥^ generates data tone
- !write "ATX1D¥13" <YM>
- write "ATX3D¥13"
- jump 32
- !
- @LABEL 17
- note "ダイアルトーンを無視してダイアルしています..." 3
- matchclr
- matchstr 1 19 "OK¥13¥10"
- ! X1 to ignore dialtone & busy
- !write "ATX1¥13" <YM>
- write "ATX3¥13"
- matchread 30
- jump 101
- !
- !
- !
- @LABEL 19
- ! Display the full dialstring contained in Varstring 1
- note "^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 101
-
- @LABEL 21
- matchclr
- matchstr 1 22 "OK¥13¥10"
- write "ATD^3^8;¥13"
- matchread 400
- jump 101
-
- @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 101
-
- @LABEL 25
- write "ATD^3^8¥13"
- jump 32
- !
- @LABEL 27
- ! Write dialstring in varstring 7
- write "ATD^3^7¥13"
- !
- !
- ! ---- Connection responce ----
- !
- ! The following section will parse modem responces of two types:
- ! 1) PROTOCOL: xxx, COMPRESSION: xxx, CONNECT xxx
- ! 2) CONNECT xxx/ARQ/V42
- !
- @LABEL 32
- matchclr
- matchstr 1 81 "RING¥13¥10"
- matchstr 2 33 "NO "
- matchstr 3 103 "ERROR¥13¥10"
- matchstr 4 104 "BUSY¥13¥10"
- matchstr 5 106 "MODEM IN USE¥13¥10"
- matchstr 6 107 "DIALING DISABLED¥13¥10"
- matchstr 7 108 "BLACKLISTED NUMBER¥13¥10"
- matchstr 8 109 "LINE CURRENT DETECTED¥13¥10"
- matchstr 9 111 "FORBIDDEN NUMBER¥13¥10"
- matchstr 10 113 "UNKNOWN COUNTRY CODE¥13¥10"
- matchstr 11 34 "CONNECT "
- matchstr 12 60 "PROTOCOL: "
- matchstr 13 61 "COMPRESSION: "
- matchread 700
- ifANSWER 32
- jump 105
- !
- ! Special parsing of "NO xxx" to keep the number of matchstr above
- ! below 16 for ARA 1.0 compatability
- !
- @LABEL 33
- matchclr
- matchstr 1 102 "DIALTONE¥13¥10"
- matchstr 2 103 "CARRIER¥13¥10"
- matchstr 3 105 "ANSWER¥13¥10"
- matchstr 4 110 "LINE CURRENT¥13¥10"
- matchstr 5 112 "DAA¥13¥10"
- matchread 10
- jump 32
-
- ! Parse the speed of connect result codes
- ! 2400 and 4800 have two entries each
- ! to distinguish them from 24000 and 48000
- !
- @LABEL 34
- 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"
- matchread 30
- jump 59
- !
- ! -- Connection rates --
- ! CommunicatingAt informs ARA of the raw modem to modem
- ! connection speed.
- !
- @LABEL 40
- note "2400 bps で接続しています..." 2
- CommunicatingAt 2400
- jump 70
- !
- @LABEL 41
- note "4800 bps で接続しています..." 2
- CommunicatingAt 4800
- jump 70
- !
- @LABEL 42
- note "7200 bps で接続しています..." 2
- CommunicatingAt 7200
- jump 70
- !
- @LABEL 43
- note "9600 bps で接続しています..." 2
- CommunicatingAt 9600
- jump 70
- !
- @LABEL 44
- note "12400 bps で接続しています..." 2
- CommunicatingAt 12400
- jump 70
- !
- @LABEL 45
- note "14400 bps で接続しています..." 2
- CommunicatingAt 14400
- jump 70
- !
- @LABEL 46
- note "16800 bps で接続しています..." 2
- CommunicatingAt 16800
- jump 70
- !
- @LABEL 47
- note "19200 bps で接続しています..." 2
- CommunicatingAt 19200
- jump 70
- !
- @LABEL 48
- note "21600 bps で接続しています..." 2
- CommunicatingAt 21600
- jump 70
- !
- @LABEL 49
- note "24000 bps で接続しています..." 2
- CommunicatingAt 24000
- jump 70
- !
- @LABEL 50
- note "26400 bps で接続しています..." 2
- CommunicatingAt 26400
- jump 70
- !
- @LABEL 51
- note "28800 bps で接続しています..." 2
- CommunicatingAt 28800
- jump 70
- !
- @LABEL 59
- note "未知のレートで接続しています..." 2
- jump 70
- !
- ! Parse the remainder of the PROTOCOL result
- !
- @LABEL 60
- matchclr
- matchstr 1 62 "LAP-M"
- matchstr 2 62 "MNP"
- matchstr 3 62 "ALT"
- matchstr 4 32 "¥13"
- matchread 10
- jump 32
- !
- ! Parse the remainder of the COMPRESION result
- !
- @LABEL 61
- matchclr
- matchstr 1 67 "V.42BIS"
- matchstr 2 67 "MNP5"
- matchstr 3 67 "CLASS 5"
- matchstr 4 32 "¥13"
- matchread 10
- !
- !
- ! -- Modem error correction link negotiation --
- ! Userhook 2 informs ARA that a modem-to-modem error
- ! correcting protocol has been negotiated
- !
- !
- @LABEL 62
- note "モデムのリンクが確実に成立しました。" 2
- userhook 2
- jump 32
- !
- !
- ! -- Compression negotiation --
- ! Userhook 3 informs ARA that a modem-to-modem compression
- ! protocol has been negotiated
- !
- @LABEL 67
- note "モデムによる圧縮を開始しました。" 2
- userhook 3
- jump 32
- !
- !
- !
- ! -- 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 70
- ! Turn on CTS handshaking.
- HSReset 0 1 0 0 0 0
- !
- ifANSWER 71
- pause 30
- @LABEL 71
- exit 0
- !
- !
- !
- ! ---- Answer calls ----
- !
- ! A RING result from the modem and in ANSWERING mode
- ! claims the serial port and answering the phone
- !
- @LABEL 81
- ifORIGINATE 32
- !
- note "応答しています..." 2
- jump 32
- !
- ! Setup for answering calls
- !
- @LABEL 82
- matchclr
- matchstr 1 32 "OK¥13¥10"
- matchstr 2 101 "ERROR¥13¥10"
- write "ATS0=1¥13"
- matchread 30
- jump 101
- !
- !
- ! ---- Hang up and reset modem ----
- !
- @HANGUP
- @LABEL 90
- settries 0
- HSReset 0 0 0 0 0 0
- !
- @LABEL 92
- ! Escape from data to command mode
- matchclr
- matchstr 1 96 "OK¥13¥10"
- write "+++"
- matchread 20
- !
- @LABEL 94
- ! Force a hangup
- matchclr
- matchstr 1 98 "NO CARRIER¥13¥10"
- matchstr 2 98 "OK¥13¥10"
- matchstr 3 98 "ERROR¥13¥10"
- matchstr 4 98 "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 101
- jump 92
- !
- @LABEL 96
- ! Pause between data and command mode
- pause 50
- jump 94
- !
- !
- @LABEL 98
- ! Recall the factory settings
- pause 15
- matchclr
- matchstr 1 99 "OK¥13¥10"
- write "AT&F¥13"
- matchread 30
- jump 101
- !
- @LABEL 99
- exit 0
- !
- ! ---- Error messages -----
- !
- ! Modem Not Responding
- @LABEL 101
- exit -6019
- !
- ! No Dial Tone
- @LABEL 102
- exit -6020
- !
- ! No Carrier or Error
- @LABEL 103
- exit -6021
- !
- ! Busy
- @LABEL 104
- exit -6022
- !
- ! No Answer
- @LABEL 105
- exit -6023
- !
- ! GeoPort/Express modem extended errors
- !
- @LABEL 106
- exit -6002 "モデムは使用中です"
- !
- @LABEL 107
- exit -6002 "ダイアルできません"
- !
- @LABEL 108
- exit -6002 "ブラックリスト番号です"
- !
- @LABEL 109
- exit -6002 "回線がつながっていません(Line Current Detected)"
- !
- @LABEL 110
- exit -6002 "回線がつながっていません(No Line Current)"
- !
- @LABEL 111
- exit -6002 "許可されていない番号です"
- !
- @LABEL 112
- exit -6002 "DAA なし"
- !
- @LABEL 113
- exit -6002 "不明な国番号です"
- !
- ! User Cancellation
- @LABEL 120
- exit -6008