Program TALK Documentation 5/11/81 1.0 Introduction TALK is a terminal emulation program which enables a PDP-11 user running under the RSX-11M operating system to communicate with a remote host computer. The program usually operates in "terminal" mode which allows the user to talk to the host as if the PDP-11 were invisible. The program also has the capability of bi-directional file transfers. 1.1 System Requirements The PDP-11 must be running under (at least) version 3.2 of RSX-11M. The communications interface between the PDP-11 and host computer, as well as the user terminal must have the full duplex terminal driver loaded. The current version of TALK requires 14K bytes of core. Program TALK Documentation PAGE 2 5/11/81 2.0 Operation Details Once TALK has been initiated, the user is prompted to enter the channel number. This is the number of the interface connected to the host computer. A control-Z input at this time will terminate the program. At this point, TALK is in "terminal" mode - that is, any characters typed will be sent directely to the host computer, and all characters from the host computer will be displayed on the terminal. There are three control characters which are not transmitted from the keyboard to the host computer. The control-S (^S) and control-Q (^Q) characters are used to suspend and resume ( respectively ) the processing of characters from the host. The control-W character (^W) is a break character, instructing the program to enter command input mode. In this mode, the user is prompted to enter an alphabetic character specifying one of a number of program commands which are not specified by control characters. These commands are outlined in the next section. 2.1 Command Descriptions Commands entered from "command input mode" are used primarily to control file transfers. There are also commands to display the command menu, send the control characters which are intercepted by TALK to the host, and exit the TALK program. A carriage return gets the user out of this mode if he does not wish to enter a command at this time. 2.1.1 A - Initiate file transfer to host This command coordinates a number of operations necessary to transfer a text file to the host computer. The user is prompted for the desired host file name as well as the local file name. Redirected input mode is entered and a command is sent to the host to begin the file transfer. When the end-of-file is reached, the character is transmitted to the host to terminate the transfer and redirected input is cancelled. TALK supports file transfers in this manner to one of three host configurations: the Sigma 9 CP-V Operating System, the PDP-11 RSX11M Operating System, or the VAX/VMS Operating System. The desired host configuration is determined when Program TALK Documentation PAGE 3 5/11/81 the program is assembled, by defining the desired system in the TALK prefix file ( see section 3.1.) 2.1.2 B - Initiate file transfer from host This command performs a function similar to the previous command, but is used to transfer files from the host computer. The same general procedure is used, except that the transfer is terminated by the receipt of the host computer's monitor prompt as the first character in any line. Although this may occasionally cause problems, files can always be transfered in a "manual" mode if necessary. 2.1.3 C - Transmit the break character to the host This command will transmit the control character to break to command mode to the host. 2.1.4 E - Change EOR character The user is prompted to enter a new EOR character. The EOR character is used to delimit records in both the redirected input and output modes. If an EOR character is recieved from the host and the input is redirected, the next record from the input file is sent to the host. If an EOR character is recieved from the host and the output is redirected, the buffer containing all characters recieved after the previous EOR is written to the output file. The default EOR character is a carriage return. It may be useful to change the EOR character if the host computer has prompt characters, or if binary files are to be sent to the PDP. 2.1.5 I - Enter redirected input mode In this mode, the terminal is disconnected as an input device, and data is transmitted to the host from the specified file. The redirected file is transmitted record by record to the host on an EOR prompt basis. Program TALK Documentation PAGE 4 5/11/81 Redirected input mode continues until the end of file is reached, a read error occurs (including reading a record longer than INBSIZ), or it is cancelled explicitly by breaking to command mode and entering the command to cancel redirect input. If the input is already redirected, this command will be ignored. 2.1.6 J - Exit redirected input mode If the input is currently redirected, the input file is closed, and the terminal is reconnected to the host as an input device. This command will be ignored if the input is not redirected. 2.1.7 M - Display the command menu This command will display the menu of available commands on the terminal and reissue the prompt for command input. 2.1.8 O - Enter redirected output mode In this mode, everything sent to the terminal from the host computer will also be copied to a specified file. Records are terminated by EOR characters or by exceeding the buffer size, OFBSIZ. Redirected output files have the "list" carriage control attribute and can be editted normally. Redirected output mode continues until it is explicitly cancelled by breaking to command mode and entering the command to cancel redirected output. If the output is already redirected, this command will be ignored. 2.1.9 P - Exit redirected output mode If the output is currently redirected, any partial record is written to the output file and the file is closed. This command will be ignored if the output is already redirected. Program TALK Documentation PAGE 5 5/11/81 2.1.10 Q - Transmit a control-Q (^Q) to the host This command simply transmits the ^Q character to the host, since this character would otherwise be intercepted by TALK as a command to halt the processing of host characters. 2.1.11 S - Transmit a control-S (^S) to the host This command simply transmits the ^S character to the host, since this character would otherwise be intercepted by TALK as a command to halt the processing of host characters. 2.1.12 Z - Exit from TALK This will close any redirected input and/or output files and terminate the program. In addition, the port will be disconnected. This will eliminate uncontrolled host / PDP-11 communication. If desired, TALK may then be rerun, and communication with the host will continue. Exiting from TALK will allow local file preparation without dropping the communications line or logging off the host computer. Program TALK Documentation PAGE 6 5/11/81 3.0 Program Notes 3.1 Parameter and Code Modifications Program command codes and I/O buffer sizes may be easily changed. These parameters are defined in the data definition area of the macro source code and in the TALK prefix file. The number of channels is defined by the constant MAXCHN, which is one less than the number of lines. If there are only two lines configured on the system, change MAXCHN to 1. If the vector address for line 0 is not 300, modify the definition of the constant VECT0R to be the correct vector address. Similarly, modify the constant RCSR0 for the correct CSR. Also modify VECT1R, VECT2R, RCSR1, and RCSR2 if they do not follow VECT0R and RCSR0. The TALK prefix file, TALKPRE.MAC, contains constants which define the host computer for which TALK is being used. If a version of TALK is desired to communicate with a DEC RSX-11M system or a VAX/VMS system, comment out the definition of the constant SIGMA9 and remove the comment indicator (;;;) from the definition of the constant RSX11. If the desired host is the VAX/VMS system, the constant VAX should also be defined. The QSIZE parameter should be increased if the queue overflow message is displayed on the terminal. The current queue size allows 1000 characters to be stored. The INBSIZ and OFBSIZ parameters are the input and output buffers sizes for the redirected files. The current buffer sizes are 133 bytes for input and 133 bytes for output. The logical unit number for the terminal is hard coded into the macro code and should not be modified. When assembling TALK, the prefix file should be assembled along with TALK into the resulting object module. The syntax for the assembler is: MAC TALK=LB:[1,1]EXEMC/ML,SY:[uic]TALKPRE,TALK Program TALK Documentation PAGE 7 5/11/81 3.2 General Transmission of parity bits is dependent upon the EBC parameter of the MCR SET command. If it is desirable that the full 8 bits be read from the port, the EBC parameter should be set before TALK is run. Should TALK be abnormally terminated, the user terminal (along with the port) will have the no echo, binary input, and full duplex characteristics set. GREAT care should be taken to insure that a communications feedback loop is not created between the PDP-11 and the host computer while TALK is not running. Program TALK Documentation PAGE 8 5/11/81 4.0 Program Design On an abstract level, TALK is a simple program. Separate queues are used for characters from the port and from the terminal. Characters from the terminal are handled by an AST routine, which queues the character and indicates that something is in the queue. Port characters are handled in a similar manner through an "interrupt service routine" (ISR) via hardware interrupts. The "connect to interrupt vector" directive (CINT$) is used. When both of the queues are empty, TALK waits for an event flag to be set by one of the interrupt routines. This prevents the program from competing for the CPU when there are no characters to be processed. Once a character appears in one of the queues, both queues are processed until empty. Most prompted input from the terminal (EOR and file names) are entered when the program is in a special mode. Instead of being sent to the host, characters recieved from the terminal in this mode are buffered to create an input string. By reading in this fashion, the unsolicited input feature need not be turned off, and host characters may be processed while typing input. Program TALK Documentation PAGE 9 TALK PDL Source Code 5/11/81 4.1 PDL Source Code TALK initialize file i/o package CALL CNPRT - connect port terminal if connect error then EXIT else CALL ATTDEV( TERMINAL ) - AST attach user terminal - read no echo CALL CONTRL - handle all characters on queue CALL DCNPRT - disconnect the port CALL DETDEV( TERMINAL ) - detach user terminal - read with echo if redirected input then CALL CANINP - cancel redirected input fi if redirected output then CALL CANOUT - cancel redirected output fi fi stop Program TALK Documentation PAGE 10 TALK PDL Source Code 5/11/81 AST -- unsolicited character interrupt handler if queue full then indicate queue overflow else put character on queue if pointer off queue then reset back of queue pointer fi fi return from interrupt Program TALK Documentation PAGE 11 TALK PDL Source Code 5/11/81 PTINTR -- port interrupt routine for character receive disable interrupts if queue has overflowed then set error flag else move character to back of port queue if "back of queue" pointer is at its limit then reset it to the front fi fi set flag to indicate port data if event flag is not set then set event flag indicating presence of something in the queue fi enable interrupts return Program TALK Documentation PAGE 12 TALK PDL Source Code 5/11/81 CONTRL while .TRUE. do /* Loop forever */ if port queue processing has not been suspended then wait for a signal that there is something in a queue if the port queue is not empty then if the port queue has overflowed then WRITE 'QUEUE OVERFLOW' message to terminal else CALL PRTIN( CHARACTER ) - process a port character if the port queue is getting full then CALL PSLEEP to put the host to sleep fi fi fi fi while there is something in the terminal queue do if terminal queue has overflowed then WRITE 'QUEUE OVERFLOW' message to terminal else CALL TRMIN( CHARACTER ) - process a user terminal character if wish to exit program then return fi fi od if port queue processing is not suspended then if port queue is empty then if host is asleep then CALL PAWAKE - to wake up the host fi Program TALK Documentation PAGE 13 TALK PDL Source Code 5/11/81 if there is a record to be sent to port then CALL XFERP to transmit it fi fi fi od Program TALK Documentation PAGE 14 TALK PDL Source Code 5/11/81 PRTIN( CHARACTER ) if a command is being sent to the host then echo the character if the character is a then reset the command flag fi else if input is redirected then if character is a prompt for next file read then indicate a record is to be sent to port fi fi echo the character if output is redirected then if character is not , , or then if TALK is helping with file transfer then if the first character in the line is a monitor prompt then CALL CANOUT - to cancel redirected output return fi fi move character to output file buffer else if CHARACTER is EOR then CALL WRTBUF - to write a record to the output file fi fi fi fi return Program TALK Documentation PAGE 15 TALK PDL Source Code 5/11/81 TRMIN( CHARACTER ) if in the process of building a file name then CALL BUILD( CHARACTER ) - build file name else if in the process of changing the EOR character then CALL ENTEOR( CHARACTER ) - change EOR character else case CHARACTER of / redirect input command / CALL REDINP - start redirected input / redirect output command / CALL REDOUT - start redirected output / cancel redirected input command / CALL CANINP - stop redirected input / cancel redirected output command / CALL CANOUT - stop redirected output / change EOR character command / CALL ASKEOR - solicit input for new EOR character / exit program command / indicate that we are to exit the program else if not redirected input then WRITE CHARACTER to port fi esac fi fi return Program TALK Documentation PAGE 16 TALK PDL Source Code 5/11/81 CMDIN if not legal command character then report error to user CALL BREAK - to prompt for new command else case command to / transmit control character / CALL XMITCC / initiate file transfer to host / CALL RDIHLP / initiate file transfer from host / CALL RDOHLP / display the command menu / CALL MENU - to display the menu CALL BREAK - to prompt for command / cancel redirected input / CALL CANINP / cancel redirected output / CALL CANOUT / change EOR character / CALL ASKEOR - to prompt for new EOR character / exit program / set exit flag / redirect input / CALL REDINP / redirect output / CALL REDOUT / transmit control S / CALL SENDPR( control S ) / transmit control Q / CALL SENDPR( control Q ) esac clear command flag CALL PAWAKE - to wake up the host fi RETURN Program TALK Documentation PAGE 17 TALK PDL Source Code 5/11/81 BREAK CALL PSLEEP - to put the host to sleep indicate that port queue processing is suspended indicate command mode is in effect issue the prompt to enter a command RETURN MENU WRITE the command menu to the terminal RETURN XMITCC transmit the "break to command mode" character to the port RETURN Program TALK Documentation PAGE 18 TALK PDL Source Code 5/11/81 BLDSCA and BLDRCA - build commands for file transfer to port if character is DELETE then if character is not the first one in the name then erase the last character on the terminal delete last character in the command string buffer fi else echo the character to the terminal if character is CR> then clear flag indicating that command is being built set flag to indicate that a command is being sent to the host if host is RSX-11M system then buffer the rest of the PIP command fi buffer the CR> CALL REDINP - to redirect input else if file name too long then WRITE error message to terminal clear flag indicating that a command is being built else buffer the character fi fi fi RETURN Program TALK Documentation PAGE 19 TALK PDL Source Code 5/11/81 BLDSCB and BLDRCB - build command for file transfer from host if character is DELETE then if character is not the first in the name then erase last character on the terminal delete the last character from the command buffer fi else echo character to terminal if character is a CR> then buffer the CR> clear flag indicating that a command is being built set flag indicating that a command is being sent to the host CALL REDOUT - to redirect output else if file name is too long then WRITE error message to the terminal clear the flag indicating that a command is being built else buffer the command character fi fi fi RETURN Program TALK Documentation PAGE 20 TALK PDL Source Code 5/11/81 RDIHLP prompt for destination file name set flag to indicate that a redirected input command is being built initialize the command length and file name length set flag to indicate that TALK is helping with a file transfer RETURN RDOHLP prompt for source file name set flag to indicate that a redirected output command is being built initialize the command length and file name length set flag to indicate that TALK is helping with a file transfer RETURN Program TALK Documentation PAGE 21 TALK PDL Source Code 5/11/81 PSLEEP if port output not already suspended then case / host is SIGMA9 / send an H to suspend output / host is RSX11M system / send a ^S to suspend output esac fi return PAWAKE clear flag indicating suspended output case / host is SIGMA9 / send an to resume host output / host is an RSX11M system / send a ^Q to resume host output esac return Program TALK Documentation PAGE 22 TALK PDL Source Code 5/11/81 REDINP if not redirected input then indicate that we are building an input file name CALL ASKNM - prompt user to enter a file name fi return REDOUT if not redirected output then indicate that we are building an output file name CALL ASKNM - prompt user to enter a file name fi return Program TALK Documentation PAGE 23 TALK PDL Source Code 5/11/81 CANINP if redirected input then CALL CLSFLE( type = INPUT ) - close redirected input file turn off redirected input indicator fi return CANOUT if redirected output then if output file buffer is not empty then CALL WRTBUF - write output buffer to redirected output file fi CALL CLSFLE( type = OUTPUT ) - close redirected output file turn off redirected output indicator fi return Program TALK Documentation PAGE 24 TALK PDL Source Code 5/11/81 ASKNM WRITE 'Enter file name:' to user terminal return Program TALK Documentation PAGE 25 TALK PDL Source Code 5/11/81 BUILD( CHARACTER ) if CHARACTER is a DEL then erase last character written on the terminal delete last character placed in file name buffer else if CHARACTER is a CR then /* End of file name - try to open file */ send a CR to the terminal CALL OPNFLE - to open file turn off build file name indicator else echo CHARACTER on user terminal if file name is longer than legal name then /*Error, stop building file name */ WRITE 'File name is too long' to user terminal turn off build file name indicator else place CHARACTER at the end of file name buffer fi fi fi return Program TALK Documentation PAGE 26 TALK PDL Source Code 5/11/81 OPNFLE prepare file name buffer if want to open an input file then open input file if not open error then turn on redirected input indicator WRITE message indicating that input is redirected if TALK is helping with a file transfer then CALL SNDCMA -- to send the file transfer command to the host else indicate that there is a record to be transfered fi else WRITE ' File open error' to user terminal fi else open output file if not open error then turn on redirected output indicator WRITE message indicating that output is redirected if TALK is helping with a file transfer then CALL SNDCMB -- to send the transfer command to the host fi else WRITE 'File open error' to user terminal fi fi return Program TALK Documentation PAGE 27 TALK PDL Source Code 5/11/81 ASKEOR WRITE 'Enter new EOR character' to user terminal turn on change EOR character indicator return ENTEOR( CHARACTER ) echo CHARACTER to user terminal replace EOR by CHARACTER turn off change EOR character indicator return CLSFLE( TYPE ) close file of type = INPUT or OUTPUT return Program TALK Documentation PAGE 28 TALK PDL Source Code 5/11/81 XFERP READ RECORD from redirected input file if not end of file and not read error then append an EOR character to RECORD until end of record do send a character to port if host is RSX11M system then wait for host to echo the character fi od else CALL CANINP - stop redirected input fi return WRTBUF WRITE output buffer to redirected output file return Program TALK Documentation PAGE 29 TALK PDL Source Code 5/11/81 ATTDEV( DEVICE ) save DEVICE characteristics set new DEVICE characteristics attach DEVICE with unsolicited character AST return DETDEV( DEVICE ) detach DEVICE set DEVICE characteristics return Program TALK Documentation PAGE 30 TALK PDL Source Code 5/11/81 5.0 Building TALK The following is a listing of the file TALK.CMD which is used to assemble and task build program TALK. .; TALK.CMD - 29APR81 .ENABLE SUBSTITUTION .SETS UIC "'UIC>'" ; ASSEMBLE AND BUILD THE TALK PROGRAM - 'DATE>' - 'TIME>' .SETS SPL "" .ASK SPQ DO YOU WANT TO CREATE LISTINGS .IFT SPQ .SETS SPL ",TALK/-SP" .SETF SPX .IFT SPQ .ASK SPX DO YOU WANT A CROSS REFERENCE LISTING .IFT SPX .SETS SPL SPL+"/CR" MAC TALK'SPL'=LB:[1,1]EXEMC/ML,SY:'UIC>'TALKPRE,TALK .; CHANGE PAR$TY TO 0 TO ALLOW 8 BIT TRANSFERS .OPEN TALKTKB.TMP .ENABLE DATA TALK/PR/-CP/-FP'SPL'=TALK,'SYSUIC>'RSX11M.STB / TASK=...TLK PRI=95 STACK=256 UNITS=5 ASG=SY:1:2,TI:4 ACTFIL=2 FMTBUF=0 GBLDEF=PAR$TY:200 // .DISABLE DATA .CLOSE TKB @TALKTKB.TMP PIP TALKTKB.TMP;*/DE SET /UIC='UIC'