-- USRobotics.twk - Version 1.0 du 30/01/1989 -- USRobotics HST setup script for TWinTalk -- Translated to TWinPas By Jean-Michel COHEN -- Based on Dan More Script {$l-} -- no listing {$d-} -- no cross refs {$s=0} -- no extra stack alloc Program USROBOTICS; Const MAXTIM = 30; NOTFOUND = 'String not found...'; Type String = Array[1..40] Of Char; Var i:Integer; c:Char; Procedure WaitFor(str:String); Var Times, Result:integer; Begin InitTake(str, 1); Times := 0; Result := 0; While (Taken = 0) and (Times <= MAXTIM) do Begin Times := Succ(Times); Wait(1); End; if Times > MAXTIM Then Begin WriteLn(NOTFOUND); Exit End End; Function IsHst:Integer; Var Times, Result: Integer; Begin InitTake('961', 1); InitTake('963', 2); InitTake('964', 3); Send('ATI0', RETURN); Times := 0; Result := 0; While (Result = 0) and (Times <= MAXTIM) Do Begin Wait(1); Times := Succ(Times); Result := Taken; End; IsHst := Result; End; Procedure SlowSetup; Begin Move(16, 52, 74, 21); Cls; WriteLn('Starting Slow Setup...'); WriteLn; WriteLn('SET Transmitter enabled : ATC1'); Send('ATC1', RETURN); WaitFor('OK'); WriteLn('SET Command mode echo OFF: ATE0'); Send('ATE0', RETURN); WaitFor('OK'); WriteLn('SET Local echo OFF after CONNECT: ATF1'); Send('ATF1', RETURN); WaitFor('OK'); WriteLn('SET speaker ON until carrier established: ATM1'); Send('ATM1', RETURN); WaitFor('OK'); WriteLn('SET quiet mode OFF - RESULT codes displayed: ATQ0'); Send('ATQ0', RETURN); WaitFor('OK'); WriteLn('SET Results to verbal mode: ATV1'); Send('ATV1', RETURN); WaitFor('OK'); WriteLn('SET Extended result code option: ATX7'); Send('ATX7', RETURN); WaitFor('OK'); WriteLn('SET U.S. answer sequence default: ATB1'); Send('ATB1', RETURN); WaitFor('OK'); WriteLn('Extended function - Enable ARQ result code: AT&A1'); Send('AT&A1', RETURN); WaitFor('OK'); WriteLn('Extended function - Fix DTE rate: AT&B1'); Send('AT&B1', RETURN); WaitFor('OK'); WriteLn('No Guard Tone (US/Canada): AT&G0'); Send('AT&G0', RETURN); WaitFor('OK'); WriteLn('Extended function - Xmit data CTS hardware flow control: AT&H1'); Send('AT&H1', RETURN); WaitFor('OK'); WriteLn('Extended function - rcv data flow control disabled: AT&I0'); Send('AT&I0', RETURN); WaitFor('OK'); WriteLn('Extended function - Error control mode NORMAL/ARQ: AT&M4'); Send('AT&M4', RETURN); WaitFor('OK'); WriteLn('Extended function - Data rate set to normal link operations: AT&N0'); Send('AT&N0', RETURN); WaitFor('OK'); WriteLn('Extended function - Set pulse dial MAKE/BREAK ratio to U.S.: AT&P0'); Send('AT&P0', RETURN); WaitFor('OK'); WriteLn('Extended function - Rcv data flow control->pass on RTS high: AT&R2'); Send('AT&R2', RETURN); WaitFor('OK'); WriteLn('Extended function - Modem controls data set ready line: AT&S1'); Send('AT&S1', RETURN); WaitFor('OK'); WriteLn('Extended function - Send destructive, expedited BREAKS: AT&Y1'); Send('AT&Y1', RETURN); WaitFor('OK'); WriteLn('S-Register - Disable auto answer: ATS0=0'); Send('ATS0=0', RETURN); WaitFor('OK'); WriteLn('S-Register - Reset incoming ring count to zero: ATS1=0'); Send('ATS1=0', RETURN); WaitFor('OK'); WriteLn('S-Register - Set ASCII escape code default to ''+'': ATS2=43'); Send('ATS2=43', RETURN); WaitFor('OK'); WriteLn('S-Register - Set ASCII carriage return to 13: ATS3=13'); Send('ATS3=13', RETURN); WaitFor('OK'); WriteLn('S-Register - Set ASCII line feed to 10: ATS4=10'); Send('ATS4=10', RETURN); WaitFor('OK'); WriteLn('S-Register - Set ASCII backspace to 8: ATS5=8'); Send('ATS5=8', RETURN); WaitFor('OK'); WriteLn('S-Register - Set #seconds modem waits before dialing to 2: ATS6=2'); Send('ATS6=2', RETURN); WaitFor('OK'); WriteLn('S-Register - Set #seconds modem waits for carrier to 45: ATS7=45'); Send('ATS7=45', RETURN); WaitFor('OK'); WriteLn('S-Register - Set duration of pause (,) to 2/10th second: ATS8=2'); Send('ATS8=2', RETURN); WaitFor('OK'); WriteLn('S-Register - Required duration of remote carrier 6/10TH sec: ATS9=6'); Send('ATS9=6', RETURN); WaitFor('OK'); WriteLn('S-Register - Hang up 5 sec after loss of carrier: ATS10=50'); Send('ATS10=50', RETURN); WaitFor('OK'); WriteLn('S-Register - Touch-Tone duration and spacing is 70 millisecs: ATS11=70'); Send('ATS11=70', RETURN); WaitFor('OK'); WriteLn('S-Register - Escape code sequence guard time is 50 millisecs: ATS12=50'); Send('ATS12=50', RETURN); WaitFor('OK'); WriteLn('S-Register - Set bit-mapped register to zero: ATS13=0'); Send('ATS13=0', RETURN); WaitFor('OK'); WriteLn('S-Register - Set self-test register to data mode (NO TEST): ATS16=0'); Send('ATS16=0', RETURN); WaitFor('OK'); WriteLn('S-Register - Set ARQ link disconnect reason register to zero: ATS17=0'); Send('ATS17=0', RETURN); WaitFor('OK'); WriteLn('S-Register - Set inactivity timer to zero (NO AUTO HANGUP): ATS19=0'); Send('ATS19=0', RETURN); WaitFor('OK'); WriteLn('S-Register - Set no carrier reason code register to zero: ATS20=0'); Send('ATS20=0', RETURN); WaitFor('OK'); WriteLn('S-Register - Set length of BREAKS to 100 milliseconds: ATS21=10'); Send('ATS21=10', RETURN); WaitFor('OK'); WriteLn('S-Register - Set ASCII value of XON to 17: ATS22=17'); Send('ATS22=17', RETURN); WaitFor('OK'); WriteLn('S-Register - Set ASCII value of XOFF to 19: ATS23=19'); Send('ATS23=19', RETURN); WaitFor('OK'); End; Procedure FastSetup; Begin Cls; WriteLn('Starting Fast Setup...'); WriteLn; Send('AT C1 E0 F1 M1 Q0 V1 X7 B1', RETURN); WaitFor('OK'); Send('AT &A1 &B1 &G0 &H1 &I0', RETURN); WaitFor('OK'); Send('AT &M4 &N0 &P0 &R2 &S1 &Y1', RETURN); WaitFor('OK'); Send('AT S0=0 S1=0 S2=43 S3=13', RETURN); WaitFor('OK'); Send('AT S4=10 S5=8 S6=2 S7=45 S8=2', RETURN); WaitFor('OK'); Send('AT S9=6 S10=50 S11=70 S12=50', RETURN); WaitFor('OK'); Send('AT S13=0 S16=0 S17=0', RETURN); WaitFor('OK'); Send('AT S19=0 S20=0 S21=10 S22=17 S23=19', RETURN); WaitFor('OK'); End; Begin Cls; Caption('USRobotics Setup'); Move(344, 52, 32, 17); WriteLn('USRobotics modem setup...'); WriteLn; WriteLn('0) Exit'); WriteLn; WriteLn('1) Fast modem setup'); WriteLn('2) Slow modem setup'); WriteLn('3) Copy settings to NRAM'); Show; Repeat ReadLn(i); Until (i >= 0) and (i <= 3); if (i = 0) Then Exit(1); Connect; if IsHST = 0 Then Begin WriteLn('Bad luck, your modem is not a USRobotics !'); Exit; End Else Case i Of 1: FastSetup; 2: SlowSetup; 3: Send('AT&W'); End; if (i # 3) Then Begin WriteLn; WriteLn('Copy settings to NRAM ? (y/n)'); ReadLn(c); if (c = 'y') or (c = 'Y') Then Send('AT&W'); End; Disconnect; Exit(1); End.