[comp.sources.misc] SHOW TERMINAL for VAX/VMS

allbery@ncoast.UUCP (09/29/87)

An Improved VAX/VMS "SHOW TERMINAL" Display		-D.A. Munroe


How many times have you typed "SHOW TERMINAL" only to spend time
hunting around the display for the set of characteristics you need to
know about?  This program not only displays terminal characteristics
in a much more organized format, but also shows some additional ones
such as modem signals.  A sample display is shown below.

The program is written in MACRO, so anyone with VAX/VMS can use it.  
Once installed as a foreign command, it behaves just like the regular 
"SHOW TERMINAL", with the exception that output cannot be sent to 
disk.



Terminal:           _TXD1:              Owner process:      TA1
Device type:        FT2                 Username:           TYPESETTING


--- speed ---       --- comm. line ---  --- flow ---        ---  generic  ---
Transmit: 9600      Full duplex         No Host sync        Scope
Receive:  9600      No Modem            No TT sync          No ANSI CRT
No Autobaud         No Dialup line      No Read sync        No DEC CRT
No Set speed priv   No Remote           No Force XON        No DEC CRT2
                    No Hangup           Type ahead          No Block mode
--- bits ---        No Modify hangup    Alt. type ahead     No Edit mode
Passall             No Disconnect proc  DMA                 No Advanced video
Pasthru                                 CR fill: 0          No Printer port
No Escape                               LF fill: 0          No Soft characters
Eightbit            --- format ---                          No SIXEL graphics
No Fallback         Width:  80                              No ReGIS graphics
Odd Parity          Page:   24          --- user/appl ---
Terminate on errors No Wrap             No Broadcast
                    Lowercase           Line editing
                    Tab                 Overstrike editing
--- security ---    Form                Numeric Keypad
No Secure server    No Echo             MBX Enable
No Sys. password    No Local echo       No Broadcast MBX

------------------------  Cut Here  ---------------------------------

                .title  TERM  Improved "Show Terminal"
;----------------------------------------------------------------
;       TERM                            3/87  D.A. Munroe
;
;       This utility improves upon the SHOW TERMINAL command,
;       not only by displaying more terminal characteristics,
;       but by showing those characteristics in terms of these
;       basic categories:
;
;               - transmission speed
;               - bit interpretation
;               - communication
;               - terminal formatting
;               - flow control
;               - user and application settings
;               - generic capabilities
;
;       status:
;               output can only be to a terminal, but the program is
;               otherwise complete
;
;
;       notes:
;               should be installed or used with the priviliges: log_io,
;               share, world, and sysprv.
;
;               comments, corrections, and suggestions should be sent to:
;
;                       David A. Munroe
;                       Capital Cities Communications/ABC
;                       7818 SE Stark Ave
;                       Portland, Oregon  97215
;                       (503) 251-7533
;
;               uucp:   ...tektronix!reed!omen!safari!dave
;                       ...ptsfa!safari!dave
;                       ...ihnp4!safari!dave
;               
;
;       Revision history:
;
;       v1.00   13-Mar-87  dm   Initial release
;       v1.01   06-Apr-87  dm   Use "Hardcopy" instead of "No Scope"
;
;------------------------------------------------------------------------


                                                ; Bring in definitions
                $DVIDEF                         ; for dvi item codes
                $DEVDEF                         ; for device characteristics
                $JPIDEF                         ; for device owner & username
                $DCDEF                          ; for device class request
                $TTDEF                          ; for basic characteristics
                $TT2DEF                         ; for extended characteristics

; macro to generate general purpose string descriptor

                .macro  string_dsc      buffer, size
                .word           size            ; output buffer size
                .byte           DSC$K_DTYPE_T   ; text data type
                .byte           DSC$K_CLASS_S   ; string descriptor class
                .address        buffer          ; address of output buffer
                .endm

; macro to generate general purpose item descriptor

                .macro  item_dsc        item, buffer, size, return_length_address
                .word           size            ; output buffer size
                .word           item            ; item code (e.g. $DVI$_*)
                .address        buffer          ; output buffer
                .address        return_length_address
                .endm



                .ident  \v1.01\                         ; 06-Apr-1987,  D.A. Munroe
                .psect  CODE,nowrt,exe
                .entry  TERM,^m<r2,r3,r4,r5,r6,r7,r8>   ; movc3 stomps on r0..r5

;----------------------------------------------------------------
;       Assign an I/O channel to SYS$OUTPUT
;----------------------------------------------------------------

                $assign_s -
                        devnam  = outdev_dsc,-
                        chan    = outdev_chan

                blbs    r0,gcml
                brw     exit



;----------------------------------------------------------------
;       Look at the command line to determine the terminal
;       under test.   If TERM is invoked with a command
;       line such as:
;                       $ TERM OPA0
;
;       then the effect of calling lib$get_foreign is to
;       put "OPA0" in tt_buff (via tt_dsc).
;----------------------------------------------------------------

gcml:           pushaw  tt_len                  ; where to put length of terminal name
                clrl    -(sp)                   ; no prompt string
                pushaq  tt_dsc                  ; descriptor for terminal name
                calls   #3,g^lib$get_foreign    ; look at command line
                blbs    r0,assn_term            ; continue if ok
                brw     exit



;----------------------------------------------------------------
;       Assign an I/O channel to the terminal under test.
;       If no terminal name was given, we use SYS$OUTPUT.
;       We need to do this in order to give tt_chan to the
;       $QIO, below.
;----------------------------------------------------------------
assn_term:
                tstw    tt_len                  ; any terminal specified?
                bneq    10$                     ; branch if so

                                                ; otherwise use SYS$OUTPUT
                movc3   #outdev_size,outdev_dsc,tt_dsc
                movw    outdev_chan,tt_chan

10$:            $assign_s -
                        devnam  = tt_dsc,-
                        chan    = tt_chan

                blbs    r0,20$
                brw     exit

20$:


;----------------------------------------------------------------
;       Get terminal characteristics associated with the
;       device on tt_chan.  The IO$_SENSEMODE request provides
;       additional terminal characteristics than that given by
;       $GETDVI
;----------------------------------------------------------------
get_ch:
                $qiow_s -
                        efn     = #0,-
                        chan    = tt_chan,-
                        func    = #IO$_SENSEMODE,-
                        iosb    = sense_iosb,-
                        p1      = ch_buff,-
                        p2      = #ch_size

                blbs    r0,10$
                brw     exit

10$:            movzwl  sense_iosb,r0
                blbs    r0,20$
                brw     exit
20$:


;----------------------------------------------------------------
;       If the terminal has the modem characteristic, look at
;       the modem signals.   This is also a good time to place
;       those signals in the prototype screen.
;----------------------------------------------------------------
get_modem_ch:
                bbs     #TT$V_MODEM,ch_basic,5$
                brw     70$                                     ; branch if not modem

5$:             $qiow_s -
                        efn     = #0,-
                        chan    = tt_chan,-
                        func    = #IO$_SENSEMODE!IO$M_RD_MODEM,-
                        iosb    = modem_iosb,-
                        p1      = modem_buff

                blbs    r0,10$
                brw     exit

10$:            movzwl  modem_iosb,r0
                blbs    r0,20$
                brw     exit

20$:            bbc     #TT$V_DS_DSR,modem_buff+2,21$           ; show any modem signals
                movl    dsr,dsr_msg
21$:            bbc     #TT$V_DS_RING,modem_buff+2,22$
                movl    ri,ri_msg
22$:            bbc     #TT$V_DS_CARRIER,modem_buff+2,23$
                movl    cd,cd_msg
23$:            bbc     #TT$V_DS_CTS,modem_buff+2,24$
                movl    cts,cts_msg
24$:            bbc     #TT$V_DS_SECREC,modem_buff+2,25$
                movl    srd,srd_msg
25$:            
70$:
;----------------------------------------------------------------
;       Deassign the channel
;       (otherwise we will appear as the terminal owner)
;----------------------------------------------------------------
deassign:
                $dassgn_s -
                        chan    = tt_chan

                blbs    r0,10$
                brw     exit
10$:


;----------------------------------------------------------------
;       Get device information (e.g. terminal name)
;----------------------------------------------------------------
dev_info:
                $getdviw_s -
                        efn     = #0,-
                        devnam  = tt_dsc,-
                        itmlst  = device_itemlist,-
                        iosb    = dvi_iosb

                blbs    r0,30$
                brw     exit

30$:            movzwl  dvi_iosb,r0
                blbs    r0,40$
                brw     exit

40$:
                movw    devnam_retlen,r0
                beql    45$
                movc3   r0,devnam_buff,term_name
                brb     50$

45$:            movc3   devnam2_retlen,devnam2_buff,term_name
50$:


;----------------------------------------------------------------
;       Get terminal owner and username
;----------------------------------------------------------------
job_info:
                tstl    pid_buff                ; does the terminal have an owner?
                bneq    20$                     ; if so, find owner & username
                tstl    pid2_buff               ; else check secondary characteristics
                beql    10$                     ; branch if really no owner
                movl    pid2_buff,pid_buff      ; set owner pid for $GETJPI call
                brb     20$                     ; find owner & username

                                                ; arrive here if no owner
10$:            movc3   #no_owner_size,no_owner_msg,owner_msg
                brb     70$

20$:            $getjpiw_s -
                        efn     = #0,-
                        pidadr  = pid_buff,-
                        itmlst  = job_itemlist,-
                        iosb    = jpi_iosb

                blbs    r0,30$
                brw     exit

30$:            movzwl  jpi_iosb,r0
                blbs    r0,40$
                brw     exit

;----------------------------------------------------------------
;       Although VMS blank fills the username, the process name
;       is zero filled, so we have to move it from a separate
;       buffer.
;----------------------------------------------------------------
40$:            movc3   owner_retlen,owner_buff,owner_msg       ; set owner name

70$:


;----------------------------------------------------------------
;  Here we scan the basic and extended characteristics bits and
;  modify the display accordingly.  In order to understand the
;  method used, we need to consider column alignment.  For
;  example:
;
;       No Modem             No TT Sync           No ANSI CRT
;       No Dialup line       No Read sync         No DEC CRT
;
;  When the "No "-condition is not present, we cannot simply
;  blank it out, because that would produce a ragged looking
;  display:
;
;          Modem             No TT Sync              ANSI CRT
;       No Dialup line          Read sync            DEC CRT
;
;  The following technique is efficient with both memory and
;  time: a prototype screen in memory will have characteristics
;  given in their "asserted" form, such as "Wrap" (as opposed
;  to "No Wrap").  For "normal" characteristics, such as "Wrap",
;  a clear bit indicates "No Wrap" and a set bit indicates "Wrap".
;  We check the characteristic, and if it's set, we leave the
;  screen alone.  If it's clear, we move the text right by three
;  characters and insert a "No ".  Note that we couldn't have
;  used the reverse method (with the prototype having the "No "
;  initially, and moving the text left) since that would leave
;  trailing characters on the right.
;
;  Some characteristics are "inverted", such as "No Broadcast".
;  Here, a clear bit means "Broadcast" and a set one means "No
;  Broadcast".  To handle this, we use a longword bit map to
;  indicate whether a characteristic is normal or inverted, and
;  decide what to do based on that.  Also, some characteristics
;  (such as those for parity) require special handling, so there
;  is a longword bit map for those, too.
;----------------------------------------------------------------

text_size       =       15.                             ; excludes "No "

                clrl    r6                              ; r6 = bit index
                movab   line1,r7                        ; r7 = address of line1
basic_loop:
                bbs     r6,basic_special,60$            ; branch (ignore) if special
                bbc     r6,basic_attr,20$               ; branch if inverted
                                                        ; else attribute is normal
                bbs     r6,ch_basic,60$                 ; bit set means leave alone
10$:            movzwl  o_basic[r6],r8                  ; grab offset to display entry
                addl2   r7,r8                           ; get absolute pointer to it
                movc3   #text_size,(r8),3(r8)           ; shift right 3 characters
                movw    #^a\No\,(r8)                    ; insert "No"
                movb    #^a\ \,2(r8)                    ; insert " "
                brb     60$

20$:            bbs     r6,ch_basic,10$                 ; bit set means put in "No "

60$:            aobleq  #basic_count,r6,basic_loop

;----------------------------------------------------------------
;       Loop for testing extended characteristics
;----------------------------------------------------------------
                clrl    r6                              ; clear bit index
extend_loop:
                bbs     r6,extend_special,60$           ; branch (ignore) if special
                bbc     r6,extend_attr,20$              ; branch if inverted
                                                        ; else attribute is normal
                bbs     r6,ch_extend,60$                ; bit set means leave alone
10$:            movzwl  o_extend[r6],r8                 ; grab offset to display entry
                addl2   r7,r8                           ; get absolute pointer to it
                movc3   #text_size,(r8),3(r8)           ; shift right 3 characters
                movw    #^a\No\,(r8)                    ; insert "No"
                movb    #^a\ \,2(r8)                    ; insert " "
                brb     60$

20$:            bbs     r6,ch_extend,10$                ; bit set means put in "No "

60$:            aobleq  #extend_count,r6,extend_loop


;----------------------------------------------------------------
;       Here we put in special descriptions.  For example,
;       instead of "No Passall" we have "Interactive".
;----------------------------------------------------------------
specials:
                                                        ; passall/interactive
                bbs     #TT$V_PASSALL,ch_basic,10$
                movc3   #interactive_size,interactive,passall_msg

                                                        ; half/full duplex
10$:            bbs     #TT$V_HALFDUP,ch_basic,20$
                movc3   #fullduplex_size,fullduplex,halfduplex_msg

                                                        ; insert/overstrike editing
20$:            bbs     #TT2$V_INSERT,ch_extend,30$
                movc3   #overstrike_size,overstrike,insert_edit_msg

                                                        ; application/numeric keypad
30$:            bbs     #TT2$V_APP_KEYPAD,ch_extend,40$
                movc3   #numeric_size,numeric,keypad_msg

                                                        ; mailbox disable/enable
40$:            bbs     #TT$V_MBXDSABL,ch_basic,50$
                movc3   #mbxenable_size,mbxenable,mbxdisable_msg


DISMISS_PARITY  =       1                               ;  TT$V_DISPARERR is defined as 9, it should be 1

50$:            bbc     #TT$V_PARITY,sense_iosb+6,60$           ; branch if no parity
                bbc     #DISMISS_PARITY,sense_iosb+6,52$        ; branch if terminating on parity errors
                movc3   #dismiss_size,dismiss,parity_err_msg
                brb     54$

52$:            movc3   #terminate_size,terminate,parity_err_msg

54$:            bbs     #TT$V_ODD,sense_iosb+6,56$              ; branch if odd parity
                movc3   #evenparity_size,evenparity,parity_msg
                brb     60$

56$:            movc3   #oddparity_size,oddparity,parity_msg
60$:
                bbc     #DEV$V_SPL,devchar_buff,70$             ; branch if not spooled
                movc3   spooldev_retlen,spooldev_buff,spooldev_msg
                movc3   #spooled_size,spooled,spooled_msg

                                                        ; Scope/Hardcopy
70$:            bbs     #TT$V_SCOPE,ch_basic,77$
                movc3   #hardcopy_size,hardcopy,scope_msg
77$:


;----------------------------------------------------------------
;       Format numerical values (baud rate, screen width, etc.)
;----------------------------------------------------------------
format:
                                                ; transmit speed
                movzbl  sense_iosb+2,r0         ; look up encoded baudrate
                movl    baudrate[r0],r0         ; get numeric value of baudrate
                $fao_s -
                        ctrstr  = transmit_fmt,-        ; descriptor for format control string
                        outlen  = out_len,-             ; where to store length of formatted output
                        outbuf  = transmit_dsc,-        ; descriptor for formatted output buffer
                        p1      = r0                    ; where the transmit speed resides
                blbs    r0,10$
                brw     exit

10$:                                            ; receive speed
                tstb    sense_iosb+3            ; receive speed same as transmit?
                bneq    15$                     ; branch if different
                movc3   #transmit_size,transmit_val,receive_val
                brb     20$

15$:            movzbl  sense_iosb+3,r0         ; look up encoded baudrate
                movl    baudrate[r0],r0         ; get numeric value of baudrate
                $fao_s -                        ; receive speed
                        ctrstr  = receive_fmt,-
                        outlen  = out_len,-
                        outbuf  = receive_dsc,-
                        p1      = r0
                blbs    r0,20$
                brw     exit

20$:            $fao_s -                        ; terminal page width
                        ctrstr  = width_fmt,-
                        outlen  = out_len,-
                        outbuf  = width_dsc,-
                        p1      = ch_pgwid
                blbs    r0,30$
                brw     exit

30$:            $fao_s -                        ; terminal page length
                        ctrstr  = page_fmt,-
                        outlen  = out_len,-
                        outbuf  = page_dsc,-
                        p1      = ch_pglen
                blbs    r0,40$
                brw     exit

40$:            $fao_s -                        ; CR fill
                        ctrstr  = cr_fill_fmt,-
                        outlen  = out_len,-
                        outbuf  = cr_fill_dsc,-
                        p1      = sense_iosb+4
                blbs    r0,50$
                brw     exit

50$:            $fao_s -                        ; LF fill
                        ctrstr  = lf_fill_fmt,-
                        outlen  = out_len,-
                        outbuf  = lf_fill_dsc,-
                        p1      = sense_iosb+5
                blbs    r0,60$
                brw     exit
60$:


;----------------------------------------------------------------
;       Find the terminal type
;
;       Entries in the terminal list table have the form:
;
;               .byte   term_id
;               .byte   length_of_terminal_name
;               .ascii  \terminal_name\
;
;       The last entry in the table has an id of 0
;
;----------------------------------------------------------------
                movb    ch_type,r0              ; r0 is terminal id
                movab   terminal_list,r1        ; r1 = ptr to list of id's
70$:            movb    (r1)+,r2                ; look at next id in table
                beql    75$                     ; if entry = 0, not found
                cmpb    r0,r2                   ; terminal id matches entry?
                beql    75$                     ; branch if match
                movzbl  (r1)+,r2                ; for longw arith. with count
                addl2   r2,r1                   ; skip to next entry
                brb     70$
75$:                                            ; at match or "Unknown" entry
                movb    (r1)+,r0                ; r0 = character count
                movc3   r0,(r1),term_type


;----------------------------------------------------------------
;               Show prototype screen
;----------------------------------------------------------------
                $qiow_s -
                        efn     = #0,-
                        chan    = outdev_chan,-
                        func    = #IO$_WRITEVBLK,-
                        iosb    = write_iosb,-
                        p1      = line1,-
                        p2      = #screen_size,-
                        p4      = #0

                blbc            r0,exit
                movzwl          write_iosb,r0

exit:           ret


                .psect  RWDATA,wrt,noexe
;----------------------------------------------------------------
;       Data structures for the $ASSIGN service
;----------------------------------------------------------------
outdev_chan:    .blkw
outdev_dsc:     .ascid  \SYS$OUTPUT\
outdev_size     =       . - outdev_dsc

tt_chan:        .blkw

tt_buffsize     =       32.
tt_dsc:                                         ; descriptor for the terminal
tt_len:         .word           tt_buffsize     ; in: tt_buff size;  out: length of terminal name
                .byte           DSC$K_DTYPE_T   ; text data type
                .byte           DSC$K_CLASS_S   ; string descriptor class
                .address        tt_buff         ; address of terminal name

tt_buff:        .blkb           tt_buffsize     ; for name of terminal we're interested in


;----------------------------------------------------------------
;       Data structures for the $GETDVI service
;
;       If the terminal is spooled, the primary characteristics
;       are for the intermediate device (i.e. the disk) and the
;       secondary characteristics are those of the terminal
;----------------------------------------------------------------
device_itemlist:                                ; list of addresses for items we want
                item_dsc -
                        DVI$_DEVCHAR!DVI$C_SECONDARY,-
                        devchar_buff,devchar_size,devchar_retlen

                item_dsc -
                        DVI$_PID,-
                        pid_buff,pid_size,pid_retlen

                item_dsc -
                        DVI$_PID!DVI$C_SECONDARY,-
                        pid2_buff,pid2_size,pid2_retlen

                item_dsc -
                        DVI$_TT_PHYDEVNAM,-
                        devnam_buff,devnam_size,devnam_retlen

                item_dsc -
                        DVI$_TT_PHYDEVNAM!DVI$C_SECONDARY,-
                        devnam2_buff,devnam2_size,devnam2_retlen

                item_dsc -
                        DVI$_DEVNAM,-
                        spooldev_buff,spooldev_size,spooldev_retlen

                .long           0

;       data structures for device-independent characteristics

devchar_buff:   .blkl                           
devchar_size    =               . - devchar_buff
devchar_retlen: .blkw

;       data structures for owner PID

pid_buff:       .blkl
pid_size        =               . - pid_buff
pid_retlen:     .blkw

;       data structures for owner PID
;       (if primary pid was 0)

pid2_buff:      .blkl
pid2_size       =               . - pid2_buff
pid2_retlen:    .blkw

;       data structures for physical device name

devnam_buff:    .blkb           64
devnam_size     =               . - devnam_buff
devnam_retlen:  .blkw

;       data structures for physical device name
;       (if devnam_retlen was 0)

devnam2_buff:   .blkb           64
devnam2_size    =               . - devnam2_buff
devnam2_retlen: .blkw

;       data structures for name of spooling device (if any)

spooldev_buff:  .blkb           64
spooldev_size   =               . - spooldev_buff
spooldev_retlen:.blkw

dvi_iosb:       .blkq


;----------------------------------------------------------------
;       Data structures for the $GETJPI service
;----------------------------------------------------------------

MAX_PROC_NAME   =               15
MAX_USER_NAME   =               12

job_itemlist:                                   ; list of addresses for items we want
owner_dsc:      item_dsc        JPI$_PRCNAM,owner_buff,MAX_PROC_NAME,owner_retlen
username_dsc:   item_dsc        JPI$_USERNAME,username_msg,MAX_USER_NAME,username_retlen
                .long           0

owner_buff:     .blkb           MAX_PROC_NAME
owner_retlen:   .blkw

username_retlen:.blkw

jpi_iosb:       .blkq


;----------------------------------------------------------------
;       Data structures for the $QIO service
;----------------------------------------------------------------
ch_buff:                                        ; terminal characteristics buffer
                .byte           DC$_TERM        ; device class (input to $QIO)
ch_type:        .blkb                           ; terminal type (e.g. vt100)
ch_pgwid:       .blkw                           ; page width (max is 255)
ch_basic:       .blkb           3               ; basic characteristics
ch_pglen:       .blkb                           ; page length
ch_extend:      .blkl                           ; extended characteristics
ch_size         =               . - ch_buff

out_len:        .blkl
write_iosb:     .blkq
sense_iosb:     .blkq
modem_iosb:     .blkq
modem_buff:     .blkq


;----------------------------------------------------------------
;       Screen prototype
;
;       Text descriptions which can have a "No " prefixed to
;       them must be no longer than text_size bytes.
;----------------------------------------------------------------

cr              =               ^o15
lf              =               ^o12

no_owner_msg:   .ascii          \no owner\
no_owner_size   =               . - no_owner_msg

line1:
                .ascii          \Terminal:           \
term_name:      .ascii          \                    \
                .ascii          \Owner process:      \
owner_msg:      .ascii          \                  \<cr><lf>    ; should be MAX_PROC_NAME or larger

line2:
                .ascii          \Device type         \
term_type:      .ascii          \                    \
                .ascii          \Username:           \
username_msg:   .ascii          \                  \<cr><lf>    ; should be MAX_USER_NAME or larger

line3:
spooled_msg:    .ascii          \                    \<cr><lf>

line4:          .ascii          <cr><lf>

line5:
                .ascii          \--- speed ---       --- comm. line ---  \
                .ascii          \--- flow ---        --- generic ---\<cr><lf>

line6:
                .ascii          \Transmit: \
transmit_val:   .ascii          \          \
transmit_size   =               . - transmit_val
halfduplex      =               . - line1
halfduplex_msg: .ascii          \Half duplex         \
hostsync        =               . - line1
                .ascii          \Host sync           \
scope           =               . - line1
scope_msg:      .ascii          \Scope             \<cr><lf>

line7:
                .ascii          \Receive:  \
receive_val:    .ascii          \          \
receive_size    =               . - receive_val
modem           =               . - line1
                .ascii          \Modem               \
ttsync          =               . - line1
                .ascii          \TT sync             \
ansi            =               . - line1
                .ascii          \ANSI CRT          \<cr><lf>

line8:
autobaud        =               . - line1
                .ascii          \Autobaud            \
dialup          =               . - line1
                .ascii          \Dialup line         \
readsync        =               . - line1
                .ascii          \Read sync           \
crt             =               . - line1
                .ascii          \DEC CRT           \<cr><lf>

line9:
set_speed       =               . - line1
                .ascii          \Set speed priv      \
remote          =               . - line1
                .ascii          \Remote              \
force_xon       =               . - line1
                .ascii          \Force XON           \
crt2            =               . - line1
                .ascii          \DEC CRT2          \<cr><lf>

line10:
                .ascii          \                    \
hangup          =               . - line1
                .ascii          \Hangup              \
type_ahead      =               . - line1
                .ascii          \Type ahead          \
block           =               . - line1
                .ascii          \Block mode        \<cr><lf>

line11:
                .ascii          \--- bits ---        \
modhangup       =               . - line1
                .ascii          \Modify hangup       \
altypeahd       =               . - line1
                .ascii          \Alt. type ahead     \
edit_mode       =               . - line1
                .ascii          \Edit mode         \<cr><lf>

line12:
passall         =               . - line1
passall_msg:    .ascii          \Passall             \
disconnect      =               . - line1
                .ascii          \Disconnect proc     \
dma             =               . - line1
                .ascii          \DMA                 \
avo             =               . - line1
                .ascii          \Advanced video    \<cr><lf>

line13:
pasthru         =               . - line1
                .ascii          \Pasthru             \
dsr_msg:        .ascii          \    \
ri_msg:         .ascii          \    \
cd_msg:         .ascii          \    \
cts_msg:        .ascii          \    \
srd_msg:        .ascii          \    \
                .ascii          \CR fill: \
cr_fill         =               . - line1
cr_fill_val:    .ascii          \           \
cr_fill_size    =               . - cr_fill_val
printer         =               . - line1
                .ascii          \Printer port      \<cr><lf>

line14:
escape          =               . - line1
                .ascii          \Escape              \
                .ascii          \                    \
                .ascii          \LF fill: \
lf_fill         =               . - line1
lf_fill_val:    .ascii          \           \
lf_fill_size    =               . - lf_fill_val
softchars       =               . - line1
                .ascii          \Soft characters   \<cr><lf>

line15:
eightbit        =               . - line1
                .ascii          \Eightbit            \
                .ascii          \--- format ---      \
                .ascii          \                    \
sixel           =               . - line1
                .ascii          \SIXEL graphics    \<cr><lf>

line16:
fallback        =               . - line1
                .ascii          \Fallback            \
                .ascii          \Width:  \
width_val:      .ascii          \            \
width_size      =               . - width_val
                .ascii          \                    \
regis           =               . - line1
                .ascii          \ReGIS graphics    \<cr><lf>

line17:
parity          =               . - line1
parity_msg:     .ascii          \No Parity           \
                .ascii          \Page:   \
page_val:       .ascii          \            \
page_size       =               . - page_val
                .ascii          \--- user/appl ---   \
                .ascii          <cr><lf>

line18:
parity_err_msg: .ascii          \                    \
wrap            =               . - line1
                .ascii          \Wrap                \
broadcast       =               . - line1
                .ascii          \Broadcast           \
                .ascii          <cr><lf>

line19:
                .ascii          \                    \
lowercase       =               . - line1
                .ascii          \Lowercase           \
line_edit       =               . - line1
                .ascii          \Line editing        \
                .ascii          <cr><lf>

line20:
                .ascii          \                    \
tab             =               . - line1
                .ascii          \Tab                 \
insert_edit     =               . - line1
insert_edit_msg:.ascii          \Insert editing      \
                .ascii          <cr><lf>

line21:
                .ascii          \--- security ---    \
form            =               . - line1
                .ascii          \Form                \
keypad          =               . - line1
keypad_msg:     .ascii          \Application keypad  \
                .ascii          <cr><lf>

line22:
secure          =               . - line1
                .ascii          \Secure server       \
echo            =               . - line1
                .ascii          \Echo                \
mbxdisable      =               . - line1
mbxdisable_msg: .ascii          \MBX Disable         \
                .ascii          <cr><lf>

line23:
syspassword     =               . - line1
                .ascii          \Sys. password       \
local_echo      =               . - line1
                .ascii          \Local echo          \
nobrdcstmbx     =               . - line1
                .ascii          \Broadcast MBX       \

                .ascii          <cr>
screen_size     =               . - line1
                .even


;----------------------------------------------------------------
;       Alternate descriptions for special characteristics
;----------------------------------------------------------------
interactive:    .ascii          \Interactive\                   ;  overwrites "passall"
interactive_size =              . - interactive

fullduplex:     .ascii          \Full duplex\                   ; overwrites "half duplex"
fullduplex_size =               . - fullduplex

overstrike:     .ascii          \Overstrike editing\            ; overwrites "insert editing"
overstrike_size =               . - overstrike

numeric:        .ascii          \Numeric keypad    \            ; overwrites "application keypad"
numeric_size    =               . - numeric

mbxenable:      .ascii          \MBX Enable \                   ; overwrites "MBX disable"
mbxenable_size  =               . - mbxenable

dismiss:        .ascii          \Dismiss parity errs\
dismiss_size    =               . - dismiss

terminate:      .ascii          \Terminate on errors\
terminate_size  =               . - terminate

hardcopy:       .ascii          \Hardcopy\
hardcopy_size   =               . - hardcopy

;  the even and odd parity messages overwrite "No Parity"

evenparity:     .ascii          \Even Parity\
evenparity_size =               . - evenparity

oddparity:      .ascii          \Odd Parity\
oddparity_size  =               . - oddparity

spooled:        .ascii          \Spooled to \
spooldev_msg:   .ascii          \        \
spooled_size    =               . - spooled

dsr:            .ascii          \DSR \
ri:             .ascii          \RI  \
cd:             .ascii          \CD  \
cts:            .ascii          \CTS \
srd:            .ascii          \SRD \


;----------------------------------------------------------------
;       offset_tables:  o_basic,  o_extend
;
;       Entries in these tables are ordered by the TT$V and TT2$V
;       bit numbers which represent terminal characteristics as
;       known by VMS.  The contents of an entry is the offset
;       into the screen display for that characteristic.
;----------------------------------------------------------------

UNUSED          =               0               ; also flagged in the *_special masks

o_basic:        .word           passall
                .word           echo
                .word           type_ahead
                .word           escape
                .word           hostsync
                .word           ttsync
                .word           UNUSED          ; script
                .word           lowercase
                .word           tab
                .word           wrap
                .word           cr_fill
                .word           lf_fill
                .word           scope
                .word           remote
                .word           UNUSED          ; holdscreen
                .word           eightbit
                .word           mbxdisable
                .word           broadcast
                .word           readsync
                .word           form
                .word           halfduplex
                .word           modem

basic_count     =               < . - o_basic > / 2     ; count of basic attributes


o_extend:       .word           local_echo
                .word           autobaud
                .word           hangup
                .word           modhangup
                .word           nobrdcstmbx
                .word           force_xon
                .word           dma
                .word           altypeahd
                .word           set_speed
                .word           UNUSED          ; dclmailbx
                .word           UNUSED          ; dcloutbnd
                .word           UNUSED          ; dclctrlc
                .word           line_edit
                .word           insert_edit
                .word           fallback
                .word           dialup
                .word           secure
                .word           disconnect
                .word           pasthru
                .word           syspassword
                .word           sixel
                .word           softchars
                .word           printer
                .word           keypad
                .word           ansi
                .word           regis
                .word           block
                .word           avo
                .word           edit_mode
                .word           crt
                .word           crt2

extend_count    =               < . - o_extend > / 2    ; count of extended attributes


;----------------------------------------------------------------
;       bit masks:      basic_special, basic_attr
;                       extend_special, extend_attr
;
;       Entries in these masks are ordered by the TT$V and TT2$V
;       bit numbers which represent terminal characteristics as
;       known by VMS.  The contents of an entry determines how
;       the state of a bit affects the display.
;
;       For basic_special and extend_special:
;
;               0  =    not special
;               1  =    special display handling required
;
;       For basic_attr and extend_attr:
;
;               1  =    "normal attribute" where the characteristic
;                       bit means:
;                                       0  =>  put in "No "
;                                       1  =>  leave alone
;
;               0  =    "inverted attribute" where the characteristic
;                       bit means:
;                                       0  =>  leave alone
;                                       1  =>  put in "No "
;
;----------------------------------------------------------------


basic_special:  .long           ^b0100010101110001000001
basic_attr:     .long           ^b1111011111111111111001

extend_special: .long           ^b0000000100000000010111000000000
extend_attr:    .long           ^b1111111111111111111111111111111


;----------------------------------------------------------------
;       Data structures for $FAO
;----------------------------------------------------------------
transmit_fmt:   .ascid          \!SL\
receive_fmt:    .ascid          \!SL\
width_fmt:      .ascid          \!SW\
page_fmt:       .ascid          \!SB\
cr_fill_fmt:    .ascid          \!SB\
lf_fill_fmt:    .ascid          \!SB\

transmit_dsc:   string_dsc      transmit_val, transmit_size
receive_dsc:    string_dsc      receive_val, receive_size
width_dsc:      string_dsc      width_val, width_size
page_dsc:       string_dsc      page_val, page_size
cr_fill_dsc:    string_dsc      cr_fill_val, cr_fill_size
lf_fill_dsc:    string_dsc      lf_fill_val, lf_fill_size


;----------------------------------------------------------------
;       Baud rate table -- ordered by TT$C_BAUD_*
;----------------------------------------------------------------

baudrate:       .long           0, 50, 75, 110, 134, 150, 300, 600, 1200, 1800, 2000, 2400
                .long           3600, 4800, 7200, 9600, 19200, 38400


;----------------------------------------------------------------
;       Terminal type is indicated by a terminal-id number.
;       These numbers have a large range and are not contiguous,
;       so we have a macro to generate entries in the terminal
;       type lookup table.
;----------------------------------------------------------------

                .macro  term_entry      term_id,term_name,?l1,?l2
                .byte   term_id
                .byte   l2 - l1         ; indicates length of name
l1:             .ascii  \term_name\
l2:
                .endm

terminal_list:

                term_entry      1,VT05
                term_entry      2,VK100
                term_entry      3,VT173
                term_entry      10,TEK401x
                term_entry      16,FT1
                term_entry      17,FT2
                term_entry      18,FT3
                term_entry      19,FT4
                term_entry      20,FT5
                term_entry      21,FT6
                term_entry      22,FT7
                term_entry      23,FT8
                term_entry      32,LA36
                term_entry      33,LA120
                term_entry      34,LA34
                term_entry      35,LA38
                term_entry      36,LA12
                term_entry      37,LA100
                term_entry      38,LQP02
                term_entry      39,LA84
                term_entry      40,LA210
                term_entry      41,LN03
                term_entry      42,LN01K
                term_entry      43,LA80
                term_entry      64,VT52
                term_entry      65,VT55
                term_entry      96,VT100
                term_entry      97,VT101
                term_entry      98,VT102
                term_entry      99,VT105
                term_entry      100,VT125
                term_entry      101,VT131
                term_entry      102,VT132
                term_entry      103,VT80
                term_entry      110,<VT200 Series>
                term_entry      111,<Pro Series>
                term_entry      0,Unknown

                .end            TERM

;-----------------  end of posting  ------------------------