.TITLE TMESS -- TERMINAL MESSAGE SENDER .IDENT /TMS1.0/ .SBTTL AUTHOR'S CREDITS .NLIST BEX,MEB,CND .enabl LC ; Author: Henry R. Tumblin ; Date: April 1, 1978 ; Version: 2.0 ; For: Systems/Utilities ; Residence: unknown ; Machine / System : PDP-11/70 IAS V2.0 ; Type/Language: Main / Assembler (MACRO) ; Abstract: ; Edits: ; Date By Reason ; --------- ------ ------------------------------------------------------ ; .SBTTL Define all local macros and tell MAC which macros to use .MCALL QIO$,DIR$,ALUN$,EXIT$S,C$C,QIOW$ .MCALL C$C,GMCR$,MARGOT,push,pop,PRINT .MCALL INPUT,DNTLST,GLUN$,VSDR$,WTSE$S C$C ; Define Carriage control characters .sbttl Define all QIO's to be used. VSDR: VSDR$ TMS...,GEN,200,,,SNDBUF,SNBUFS,6,200 WRITE: QIOW$ IO.WVB,1,3,200,,,<0,0,> READ: QIOW$ IO.RPR,1,1,200,IOS1,,<0,0,,PR1,PR1S> TIASN: ALUN$ 1,TI,0 ; Assign input lun to ourselves GLUN: GLUN$ 1,LUNBUF ; Get lun info DPB IOS1: .BLKW 2. ; I/O Status block for input only LUNBUF: .BLKW 6 ; Lun info buffer BEGSTR: .WORD 0 ; Used by INISTR for begin of STR. ENDSTR: .WORD 0 ; Used by INISTR for end of STR. LENSTR: .WORD 0 ; Used by INISTR for LEN of STR. SNDBUF: FRMDEV: .BLKW 1 ; From device FRMNUM: .BLKW 1 ; From device number DEVNAM: .BLKW 1 ; Buffer to store the device DEVNUM: .BLKW 1 ; Buffer to store the device # FRMSIZ: .BLKW 1 ; Size of "FROM" message in bytes. FRMMES: .BLKB 16. ; Buffer to be sent to LG: TOOSIZ: .BLKW 1 ; Size of "TO" message in bytes. TOOMES: .BLKB 80. ; Buffer containing "TOO" message. SNBUFS=<.-SNDBUF>/2 CMDIN: GMCR$ ; Define MCR Buffer TERBUF = CMDIN + 2 ; Terminal input buffer PLST: DNTLST TOPLEV,IOS1+2,TERBUF,80. ; DINT PARAMETER BLOCK .SBTTL Ascii Prompt strings (For more than one line messages) pr1: .ascii /From ? / ; To ask the sender's name pr1s=.-pr1 pr2: .ascii /Message ?/ ; Get the message to be sent pr2s=.-pr2 PR3: .ASCII /To which terminal ? / ; And the terminal number pr3s=.-pr3 ER1: .ASCII "Terminal '" ERRSTR: .BLKB 5. .ASCII "' is not a valid terminal or device " ER1S=.-ER1 ER2: .ASCII "'BREAK' key depressed -- message aborted" ER2S=.-ER2 .SBTTL HELP Message ; This is the help message that the user will ; receive if they type for the TO prompt HELP HLPMES: .BYTE LF,CR ; Skip 1 line before printing .ASCII " Terminal Message Sender (TMS) utility" .ASCII .ASCII " This utility enables the user to send " .ASCII " one-line messages to any user that is" .ASCII " Logged-In or has their terminal switched on." .ASCII .ASCII " The basic format of this command is :" .ASCII " PDS> TMS " .ASCII " To which terminal?> TT##: " .ASCII " From?> your name " .ASCII " Message?> message" .ASCII " This will send a message to whatever terminal" .ASCII " that was specified in the ## above. To cancel" .ASCII " out of a message at any time, merely hit the" .ASCII " BREAK key. To obtain this help text, type HELP" .ASCII " to the 'To which terminal' prompt. " HLPMS = .-HLPMES ; This module provides a means of any user that ; has system library task privileges to send messages ; to other terminals, whether Logged-In or not, using ; the special function of the LG device. This program ; merely parses out the command line, then performs ; a QIO to the LG handler, which in turn passes the ; message along to the appropriate terminal. The format ; of the buffer that is sent to LG via the QIO is shown below: ; ---------------------- ; ! ASCII "FROM" Device! ----- Word 0 ; ---------------------- ; ! Binary Device # ! ----- Word 1 ; ---------------------- ; ! ASCII "TO" Device ! ----- Word 2 ; ---------------------- ; ! Binary Device # ! ----- Word 3 ; ---------------------- ; ! Size of 1st mesg. ! ----- Word 4 (length is in bytes) ; ---------------------- ; ! Size of 2nd mesg. ! ----- Word 5 (length is in bytes) ; ---------------------- ; ! "FROM" message ! ----- Word 6 - 20 (30 characters) ; ---------------------- ; ! Message ! ----- Word 21 - 60 (30 characters) ; ---------------------- ; Total size of the message buffer is 120. bytes MARGOT ; Define the MARGOT macros ACTION INISTR MOV R4,BEGSTR ; SET BEGINNING POINTER CLC ENDACTION ACTION SAVSTR PUSH ; SAVE REGISTERS MOV 2(R5),R1 ; GET DESTINATION POINTER MOV BEGSTR,R0 ; GET SOURCE POINTER (SET BY INITSTR) MOV R4,R2 ; SET UP TO FIND STRING LENGTH MOV R4,ENDSTR ; SAVE END OF STRING POINTER SUB R0,R2 ; FIND STRING LENGTH MOV R2,LENSTR ; SAVE STRING LENGTH CMP #2,(R5) ; TWO ARGUMENTS SPECIFIED ? BNE NOT2 ; NE - THEN SKIP NEXT PART MOV R2,@4(R5) ; SAVE STRING LENGTH HERE NOT2: MOVB (R0)+,(R1)+ ; MOVE INTO POSITION SOB R2,NOT2 ; LOOP TILL THRU POP ; RESTORE REGISTERS CLC ; CLEAR THE CARRY BIT ENDACTION ACTION HELPER PRINT #HLPMES,#HLPMS ; Output the help message ENDACTION ACTION EXIT ; Exit Action EXIT$S ; And exit Gracefully (always) ENDACTION ACTION GETLIN ; Gets command input line PUSH ; Save work register INPUT 2(R5),4(R5),6(R5),10(R5) ; Get next command input CMPB #IE.BCC,IOS1 ; Was the "BREAK" key depressed? BNE 12$ ; NE - Then continue 11$: PRINT #ER2,#ER2S ; Print message aborted EXIT$S ; And exit gracefully 12$: MOV IOS1+2,R0 ; Get read length ADD 2(R5),R0 ; Point to end of string MOVB #40,(R0) ; Append a space MOVB #40,1(R0) ; or 2 ADD #2,ios1+2 ; Add to string length MOV 2(R5),R4 ; Reset DINT command line pointer POP ; Restore work register CLC ENDACTION ACTION SAVNUM ; SAVE AN INTEGER QUANITY PUSH ; SAVE WORK REGISTERS MOV BEGSTR,R0 ; POINT TO BEGINNING OF STRING CALL $COTB ; CONVERT TO BINARY MOV R1,@2(R5) ; MOVE INTO DST @ POP ; RESTORE REGISTERS CLC ENDACTION ACTION ERROR ; Error handling action MOV BEGSTR,R0 ; Get string pointer MOV 6(R5),R1 ; Get output string pointer MOV #5,R2 ; Move only the 1st 5 chars. 10$: MOVB (R0)+,(R1)+ ; Move a byte SOB R2,10$ ; Loop till thru. PRINT 2(R5),4(R5) ; Print error message. EXIT$S ; And exit gracefully (always) ENDACTION SYNTAX LETTER CHARACTER 'A,'Z ENDSYNTAX SYNTAX MIXED CHARACTER 101,172 ENDSYNTAX SYNTAX OCTAL CHARACTER '0,'7 ENDSYNTAX SYNTAX MESAGE ; MESSAGE SYNTAX INISTR REPEAT 1,80. CHARACTER 40,176 ENDREPEAT SAVSTR ENDSYNTAX SYNTAX FROM INISTR REPEAT 1,16. MIXED ENDREPEAT SAVSTR ENDSYNTAX SYNTAX UNIT ; Unit syntax INISTR ; DDNN: LETTER LETTER SAVSTR OPTIONAL INISTR REPEAT 1,2 OCTAL ENDREPEAT SAVNUM ENDOPTIONAL CHARACTER ': ENDSYNTAX SYNTAX HELP ALTERNATES KEYWORD 2,"HELP" OR KEYWORD 1,"?" ENDALTERNATES HELPER EXIT ENDSYNTAX .SBTTL Top-level syntax definition ;***************************************************************************** TOPLEV:: SYNTAX TMSCMD ; Top level syntax KEYWORD 3,"TMS" ; Command name (From Get MCR) REQUIRE ; Require 1-space ALLOW ; Allow more if necessary ALTERNATIVES HELP ; Help command OR UNIT ; Get terminal to send message to. OR GETLIN ; Else prompt for Terminal # ALTERNATIVES HELP OR UNIT ; And parse it also OR ERROR ; Output error message EXIT ; And leave ENDALTERNATIVES ENDALTERNATIVES REQUIRE ; Require 1-Space ALLOW ; Allow more if necessary ALTERNATIVES FROM OR GETLIN FROM ENDALTERNATIVES REQUIRE ALLOW ALTERNATIVES MESAGE ; Parse message string (Up to A(80)) OR GETLIN ; Prompt for the message MESAGE ; Parse message string (Up to A(80)) ENDALTERNATES ENDSYNTAX ;***************************************************************************** .sbttl start mainline code ;***************************************************************************** start: DIR$ #TIASN ; Assign the TI lun DIR$ #GLUN ; Get LUN info MOV GLUN+G.LUBA,R0 ; Get buffer pointer MOV G.LUNA(R0),FRMDEV ; Store the device name MOVB G.LUNU(R0),R1 ; And the device number MOV R1,FRMNUM ; STORE THE DEVICE # dir$ #cmdin ; Read the command mov @#$DSW,ios1+2 ; store the read length mov #plst,r2 ; set up to call dint mov #TERbuf,r0 ; point to input string add ios1+2,r0 ; and poin to the end of input movb #40,(r0) ; append a blank inc ios1+2 ; update count call dint ; and go parse(instead of fish) BCS 10$ ; CS - THEN DISP REGISTERS DIR$ #VSDR ; Send it off to the receiver WTSE$S #6 ; Wait for it to go 10$: EXIT$S ; And exit gracefully .end START ;***************************************************************************** EXIT$S .END START