.TITLE DTE_DF112 - SET HOST/DTE dialer module .IDENT 'X-1' ; ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1978, 1980, 1982, 1984 BY * ;* DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. * ;* * ;* * ;**************************************************************************** ; ;++ ; ; FACILITY: ; ; SET HOST/DTE ; ; ABSTRACT: ; ; Provide modem-specific support for autodialing on a DF112. ; Activated as a sharable image when ; SET HOST ttcn: /DTE /DIAL=(number:string,MODEM_TYPE=DF112) ; is run. ; ; ENVIRONMENT: ; ; VAX/VMS, user mode. ; ;-- ; ; AUTHOR: Pam Levesque CREATION DATE: 18-Feb-1985 ; ; MODIFIED BY: ; ;** .SBTTL DECLARATIONS ; ; INCLUDE FILES: ; $SHRDEF ; shared messages $STSDEF ; status fields ; ; MACROS: ; ; ; EQUATED SYMBOLS: ; REM$_FACILITY = ^X1FE REM$_BADVALUE = SHR$_BADVALUE! CR = 13 LF = 10 ; ; OWN STORAGE: ; CTRLA_DESC: .LONG 1 ; length .LONG 0 ; will get filled in by code CTRLA_STR: .LONG 1 ; "1" is ^A CONN_DESC: .LONG CONN_STR_LEN ; length .LONG 0 ; will get filled in by code CONN_STR: .ASCII /Connection made to remote port/ CONN_STR_LEN = .-CONN_STR FAIL_DESC: .LONG FAIL_STR_LEN ; length .LONG 0 ; will get filled in by code FAIL_STR: .ASCII /Failed to connect to remote port/ FAIL_STR_LEN = .-FAIL_STR READ_BUFFER: .BLKB 20 ; read buffer IOSB: .LONG 0,0 ; I/O status READ_STATUS: .LONG 0 ; completion status USER_CHAN: .LONG 0 ; command channel own storage DF112_CHAN: .LONG 0 TMASK: .LONG 0,0 ; quadword terminator mask .SBTTL DTE_DF112 - DF112 autodial routine ;++ ; ; FUNCTIONAL DESCRIPTION: ; ; Perform the necessary autodial protocol on a DF112 modem. ; ; CALLING SEQUENCE: ; ; DIAL_ROUTINE (number_desc, port_chan, command_chan) ; ; INPUT PARAMETERS: ; ; 4(AP) - descriptor of string specified in NUMBER:string ; 8(AP) - channel number of port DF112 is connected to ; 12(AP) - channel number of user's terminal ; ; IMPLICIT INPUTS: ; NONE ; ; OUTPUT PARAMETERS: ; NONE ; ; IMPLICIT OUTPUTS: ; NONE ; ; COMPLETION CODES: ; ; R0 - status ; ; SIDE EFFECTS: ; NONE ; ;-- number = 4 port_chan = 8 command_chan = 12 .TRANSFER DIAL_ROUTINE .MASK DIAL_ROUTINE BRW DIAL_ROUTINE+2 .ENTRY DIAL_ROUTINE,^M MOVZWL command_chan(AP),user_chan ; save for later MOVZWL port_chan(AP),df112_chan MOVL number(AP),R2 ; fetch address of descriptor MOVZWL (R2),R3 ; length of string MOVL 4(R2),R4 ; address ; ; Loop through string to check for illegal characters. Validity ; checking is minimal - we let the modem or the phone do most of ; the checking. ; ; Valid characters are: ; 0 - 9 phone number ; # start dial ; = pause ; T tone dialing ; P pulse dialing ; Lowercase is also acceptable. ; 10$: CMPB #^A/#/,(R4) ; end of number, start dial BEQL 45$ ; skip to number ok CMPB #^A/=/,(R4) ; "=" is pause character BEQL 20$ ; branch if match CMPB #^A/0/,(R4) ; check for number BGTRU 30$ ; can't be legal char CMPB #^A/9/,(R4) ; check for number BLSSU 12$ ; not in 0 - 9 range BRB 20$ ; found 0 - 9 12$: CMPB #^A/T/,(R4) ; T for tone dialing BEQL 20$ ; branch if match CMPB #^A/t/,(R4) ; T for tone dialing BEQL 20$ ; branch if match CMPB #^A/P/,(R4) ; T for pulse dialing BEQL 20$ ; branch if match CMPB #^A/p/,(R4) ; T for pulse dialing BNEQU 30$ ; error if no match 20$: INCL R4 ; next character SOBGTR R3,10$ ; legal character, loop BRB 40$ ; continue, number ok ; ; error in number string ; 30$: PUSHL number(AP) ; signal error PUSHL #1 ; number of FAO args PUSHL #REM$_BADVALUE ; error type CALLS #3,G^LIB$SIGNAL ; error MOVL #REM$_BADVALUE!STS$M_INHIB_MSG,R0 ; return status RET ; return ; ; The last character in the string must be # to activate the ; dialer. Make sure it is, to avoid a hang. ; 40$: DECL R4 ; back up to last char CMPB #^A/#/,(R4) ; must be # BNEQU 30$ ; branch if error ; ; number string ok, continue. ; queue read for character ; 45$: BSBW READ_CHAR ; read status character BLBC R0,100$ ; exit on error ; ; Write string to modem. Use ^A (burst mode) to avoid READY message ; from the modem. ; MOVAB CTRLA_STR,CTRLA_DESC+4 ; set address MOVAB CTRLA_DESC,R2 ; ^A initiates dial BSBW WRITE_STR ; write string BLBC R0,100$ ; exit on error MOVL number(AP),R2 ; fetch address of descriptor BSBW WRITE_STR ; write number string BLBC R0,100$ ; exit on error $HIBER_S ; wait for read to complete MOVL READ_STATUS,R0 ; set status 100$: RET .SBTTL WRITE_STR - write string to port channel ;++ ; ; FUNCTIONAL DESCRIPTION: ; ; write a string to the DTE port ; ; CALLING SEQUENCE: ; ; BSBW WRITE_STR ; ; INPUT PARAMETERS: ; ; R2 - address of descriptor to write ; ; COMPLETION CODES: ; ; R0 - status ; ;-- WRITE_STR: $QIOW_S - CHAN = port_chan(AP),- ; channel FUNC = #IO$_WRITEVBLK!IO$M_NOFORMAT,- ; write no format P1 = @4(R2),- ; address P2 = (R2) ; length RSB .SBTTL READ_CHAR - read status character from port ;++ ; ; FUNCTIONAL DESCRIPTION: ; ; Read the status character from the DF112, allowing a maximum ; of 60 seconds for the event to occur. ; ; CALLING SEQUENCE: ; ; BSBW READ_CHAR ; ; INPUT PARAMETERS: ; NONE ; ; COMPLETION CODES: ; ; R0 - status ; ; uses R2 ;-- READ_CHAR: MOVAB TMASK, R2 $QIO_S - CHAN = port_chan(AP),- ; channel FUNC = #IO$_READVBLK!IO$M_TIMED!IO$M_NOECHO!IO$M_PURGE,- - ; read timed IOSB = IOSB,- ; I/O status ASTADR = READ_DONE,- ; ast routine P1 = READ_BUFFER,- ; address P2 = #3,- ; length P3 = #60,- ; timeout P4 = R2 ; no terminators RSB ; exit with status .SBTTL READ_DONE - ast for read completion ;++ ; ; FUNCTIONAL DESCRIPTION: ; ; Check for timeout or status character ; ; CALLING SEQUENCE: ; ; CALLed as AST routine ; ; INPUT PARAMETERS: ; NONE ; ; COMPLETION CODES: ; ; R0 - status ; ;-- .ENTRY READ_DONE,^M MOVZWL IOSB,R0 ; get status of read BLBC R0,100$ ; branch if timeout MOVAB TMASK,R3 MOVZBL READ_BUFFER+2,R2 ; fetch data - skip over CRLF $QIOW_S - ; purge any junk CHAN = df112_chan,- ; channel FUNC = #IO$_READVBLK!IO$M_NOECHO!IO$M_TIMED,- - ; read timed IOSB = IOSB,- ; I/O status P1 = READ_BUFFER,- ; address P2 = #20,- ; length P3 = #4,- P4 = R3 CMPB #^A/A/,R2 ; look for Attached BNEQ 10$ ; branch if not MOVAB conn_desc,R2 ; set up string MOVAB conn_str,4(R2) ; set up string BSBW WRITE_STR_TO_USER ; tell user, ready BLBC R0,100$ ; exit on error MOVL #SS$_NORMAL,R0 ; ready BRB 100$ ; exit 10$: MOVAB fail_desc,R2 ; set up string MOVAB fail_str,4(R2) ; set up string BSBW WRITE_STR_TO_USER ; tell user, ready MOVZWL #SS$_HANGUP,R0 ; status 100$: MOVL R0,READ_STATUS ; save status $WAKE_S ; wake main stream RET .SBTTL WRITE_STR_TO_USER - write string to command channel ;++ ; ; FUNCTIONAL DESCRIPTION: ; ; write a string to the user terminal channel ; ; CALLING SEQUENCE: ; ; BSBW WRITE_STR_TO_USER ; ; INPUT PARAMETERS: ; ; R2 - address of descriptor to write ; ; COMPLETION CODES: ; ; R0 - status ; ;-- WRITE_STR_TO_USER: $QIOW_S - CHAN = user_chan,- ; channel FUNC = #IO$_WRITEVBLK,- ; write P1 = @4(R2),- ; address P2 = (R2) ; length RSB .END