Send a Message to Another Terminal

From CometWiki

Revision as of 10:58, 13 June 2009 by Badge (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

DOS pseudo functions: Send a Message to Another Terminal

Syntax:

 DOSRW(AX-value, terminal-number, number-of-bytes, format-statement-label) EXCP=statement-label  

Entry:

  AX-value = "@FFFF@"
                                                                                                                   .
 terminal-number = terminal where the message is to be sent
                                                                                                                   .
 number-of-bytes = number of characters to be written to another terminal
                                                                                                                     .
 format-statement-label = format statement containing the message to be written to the other terminal (may be a constant or variable)


Return:
If the write function is successful, the message contained in the format statement will be sent to the terminal specified.

If an exception occurs, byte 2 of the AX field will contain the DOS error code (in hex).

Discussion:
The DOSRW function can be used to send a message to another terminal on the Comet system. The message to be sent is contained in an Internet Basic format statement. The message may be a string constant or a string variable. This function requires that the AX-value be set to "@FFFF@".

The second parameter in this function call is the terminal number of the terminal receiving the message. This may be a string constant or variable in the standard Comet form (for example, T00, T05, T12). To send a message to all terminals, this string should be "ALL".

The third parameter contains the number of bytes to be written to the receiving terminal. This must be a constant value hard-coded into the function call (i.e., it may not be a variable).

The fourth parameter, the format-statement-label, is the label of a FORMAT statement containing the appropriate control codes to place the message at the desired location on the receiving terminal. For example, to display a message on the bottom line (i.e., the message line), you should include the hex control "@0E07@" at the beginning of the format statement.

Example:

 ! S SMESSAGE,DSK
 ! O MESSAGE,DSK
 ! L T00,E
 ! R QMONITOR
 !
 !==========  SEND MESSAGE TO ANOTHER TERMINAL  ==================
 !
 LENGTH 2 & LOCAL AX$                 ! Define AX register
 LENGTH 3 & LOCAL TERMINAL$           ! Define terminal number
 LENGTH 60 & LOCAL DATALINE$          ! Define message variable
 !
 100 FORMAT (ET)                      ! Screen format
 !
 MESSAGE: FORMAT "@0E07@";_           ! Write to the control line
                (RB);(SF);_           ! Ring bell/set foreground
                DATALINE$             ! Display the message
 !
 CLEAR                                ! Initialize all variables
 PRINT (0,100)                        ! Set typewriter mode
 !
 PRINT (0) "ENTER TERMINAL NUMBER:"   ! Display prompt
 INPUT (0) TERMINAL$                  ! Enter terminal number
 IF TERMINAL$ = "" THEN RUN "QMONITOR"  ! If null, then stop
 !
 PRINT (0) "ENTER MESSAGE:"           ! Display prompt
 INPUT (0) DATALINE$                  ! Enter message to be sent
 IF DATALINE$ = "" THEN RUN "QMONITOR"  ! If null, then stop
 !
 AX$ = "@FFFF@"                       ! Set AX to "SEND MESSAGE"
 !
 DOSRW(AX$,TERMINAL$,60,MESSAGE) EXCP=EXCEPTION   ! Send message
 !
 PRINT (0) "MESSAGE SENT TO ";TERMINAL$
 INPUT (0) ""
 RUN "QMONITOR"
 !
 EXCEPTION:                           ! Exception routine
 PRINT (0) "MESSAGE NOT SENT."
 INPUT (0) ""
 RUN "QMONITOR"
 END



Also see Send a Message to All Terminals



DOS pseudo functions

Personal tools