
"   TERMINAL DEFINITION FILE FOR TEKTRONIX T4109 TERMINAL
"      NOS/VE VERSION
"
"   Copyright Control Data Systems Inc. 1992
"
"   AUTHOR: Kirk M. Hoaglund
"           CIM Division
"           AHS225
"           (612) 482-6055
"
"   TO COMPILE: /deft tek4109 b=tek_4109
"
"   TO COMPILE: /deft tek4109 b=tek_4109
"
"   TO USE:     /setpa al=tek_4109
"               /setta tm=tek_4109
"
"
"
"   Keys are defined as:
"
"   +------+------+------+------+   +------+------+------+------+
"   |  F1  |  F2  |  F3  |  F4  |   |  F5  |  F6  |  F7  |  F8  |  SHIFT
"   |  f1  |  f2  |  f3  |  f4  |   |  f5  |  f6  |  f7  |  f8  |  normal
"   +------+------+------+------+   +------+------+------+------+
"
"                                   +------+------+------+------+
"                                   | RepM | Back | HELP |clrSCR|
"                                   | InsM | Data | help |clrEOL|
"                                   +------+------+------+------+
"                            SHIFT  | BKW  | UP   | delL | delC |
"                           normal  | bkw  | up   | delC | delL |
"                                   +------+------+------+------+
"                                   | FWD  | DWN  | insL |      |
"                                   | fwd  | dwn  | insC |      |
"                                   +-------------+------| insC |
"                                   |             | EDIT | insL |
"                                   |    HOME     | edit |      |
"                                   +-------------+------+------+
"
"
"   +------+------+------+------+   +------+------+------+------+
"   |  F9  | F10  | F11  | F12  |   | F13  | F14  | F15  | F16  | cntrl-shft
"   |  f9  | f10  | f11  | f12  |   | f13  | f14  | f15  | f16  | control
"   +------+------+------+------+   +------+------+------+------+
"
"                                   +------+------+------+------+
"                                   |  F7  |  F8  |  F9  | F14  |
"                                   |  f7  |  f8  |  f9  | f14  |
"                                   +------+------+------+------+
"                  control-SHIFT    |  F4  |  F5  |  F6  | F15  |
"                        control    |  f4  |  f5  |  f6  | f15  |
"                                   +------+------+------+------+
"                                   |  F1  |  F2  |  F3  |      |
"                                   |  f1  |  f2  |  f3  |      |
"                                   +-------------+------|      |
"                                   |             |      |      |
"                                   |    HOME     |      |      |
"                                   +-------------+------+------+
"
"   The cursor is controlled by the JoyDisk in the obvious manner.
"      normal JoyDisk = cursor moves one space/line
"      shift  JoyDisk = cursor moves two spaces/lines
"     control JoyDisk = cursor moves four spaces/lines
"  cntrl-shft JoyDisk = cursor moves eight space/lines
"
"   Diagonal moves are supported.
"
"   Other keys (for compatibility):
"
"                           CONTROL:
"                           +------+------+------+------+
"                           | bkw  | home | InsC | DelC |
"                           |  Q   |  W   |  E   |  R   |
"  Tek 4115 Style           ++-----++-----++-----++-----++
"  Standard Keys and         | left | down |  up  |right |
"       Cursor control       |  A   |  S   |  D   |  F   |
"                            ++-----++-----++-----++-----++
"                             | fwd  | edit | InsL | DelL |
"                             |  Z   |  X   |  C   |  V   |
"                             +------+------+------+------+
"
"
"
"   MISC. VARIABLES                                                                 "

    csi                 = ( esc '[' )
    function            = ( esc 'O' )
    extra_func          = ( esc 'P' )
    select_code_tek     = ( esc '%!0' )
    select_code_ansi    = ( esc '%!1' )
    int_32              = ( 'B0' )
    int_80              = ( 'E0' )
    int_100             = ( 'F4' )

"   KEYBOARD MACRO CONTROL CODES

"      JOY DISK KEYCODES

    int_joy_right       = ( 'H''')
    int_joy_up          = ( 'H(' )
    int_joy_left        = ( 'H)' )
    int_joy_down        = ( 'H*' )
    int_joy_right_s     = ( 'H+' )
    int_joy_up_s        = ( 'H,' )
    int_joy_left_s      = ( 'H-' )
    int_joy_down_s      = ( 'H.' )
    int_joy_right_c     = ( 'H/' )
    int_joy_up_c        = ( 'I ' )
    int_joy_left_c      = ( 'I!' )
    int_joy_down_c      = ( 'I"' )
    int_joy_right_cs    = ( 'I#' )
    int_joy_up_cs       = ( 'I$' )
    int_joy_left_cs     = ( 'I%' )
    int_joy_down_cs     = ( 'I&' )

"      KEY PAD KEYCODES
"              unshifted

    int_pad_0           = ( 'C''')
    int_pad_1           = ( 'C(' )
    int_pad_2           = ( 'C)' )
    int_pad_3           = ( 'C*' )
    int_pad_4           = ( 'C+' )
    int_pad_5           = ( 'C,' )
    int_pad_6           = ( 'C-' )
    int_pad_7           = ( 'C.' )
    int_pad_8           = ( 'C/' )
    int_pad_9           = ( 'D ' )
    int_pad_dash        = ( 'D#' )
    int_pad_comma       = ( 'D"' )
    int_pad_enter       = ( 'D$' )
    int_pad_period      = ( 'D!' )

"              shifted

    int_pad_0_s         = ( 'D%' )
    int_pad_1_s         = ( 'D&' )
    int_pad_2_s         = ( 'D''')
    int_pad_3_s         = ( 'D(' )
    int_pad_4_s         = ( 'D)' )
    int_pad_5_s         = ( 'D*' )
    int_pad_6_s         = ( 'D+' )
    int_pad_7_s         = ( 'D,' )
    int_pad_8_s         = ( 'D-' )
    int_pad_9_s         = ( 'D.' )
    int_pad_dash_s      = ( 'E!' )
    int_pad_comma_s     = ( 'E ' )
    int_pad_enter_s     = ( 'E"' )
    int_pad_period_s    = ( 'D/' )

"              controlled

    int_pad_0_c         = ( 'E#' )
    int_pad_1_c         = ( 'E$' )
    int_pad_2_c         = ( 'E%' )
    int_pad_3_c         = ( 'E&' )
    int_pad_4_c         = ( 'E''')
    int_pad_5_c         = ( 'E(' )
    int_pad_6_c         = ( 'E)' )
    int_pad_7_c         = ( 'E*' )
    int_pad_8_c         = ( 'E+' )
    int_pad_9_c         = ( 'E,' )
    int_pad_dash_c      = ( 'E/' )
    int_pad_comma_c     = ( 'E.' )
    int_pad_enter_c     = ( 'F0' )
    int_pad_period_c    = ( 'E-' )

"              control-shifted

    int_pad_0_cs        = ( 'F!' )
    int_pad_1_cs        = ( 'F"' )
    int_pad_2_cs        = ( 'F#' )
    int_pad_3_cs        = ( 'F$' )
    int_pad_4_cs        = ( 'F%' )
    int_pad_5_cs        = ( 'F&' )
    int_pad_6_cs        = ( 'F''')
    int_pad_7_cs        = ( 'F(' )
    int_pad_8_cs        = ( 'F)' )
    int_pad_9_cs        = ( 'F*' )
    int_pad_dash_cs     = ( 'F-' )
    int_pad_comma_cs    = ( 'F,' )
    int_pad_enter_cs    = ( 'F.' )
    int_pad_period_cs   = ( 'F+' )

"      FUNCTION KEY KEYCODES
"              unshifted

    int_f1              = ( 'H0' )
    int_f2              = ( 'H1' )
    int_f3              = ( 'H2' )
    int_f4              = ( 'H3' )
    int_f5              = ( 'H4' )
    int_f6              = ( 'H5' )
    int_f7              = ( 'H6' )
    int_f8              = ( 'H7' )
    int_f9              = ( '"'  )
    int_f10             = ( '#'  )
    int_f11             = ( '$'  )
    int_f12             = ( '%'  )
    int_f13             = ( '&'  )
    int_f14             = ( '''' )
    int_f15             = ( '('  )
    int_f16             = ( ')'  )

"              shifted

    int_f1_s            = ( 'H8' )
    int_f2_s            = ( 'H9' )
    int_f3_s            = ( 'H:' )
    int_f4_s            = ( 'H;' )
    int_f5_s            = ( 'H<' )
    int_f6_s            = ( 'H=' )
    int_f7_s            = ( 'H>' )
    int_f8_s            = ( 'H?' )
    int_f9_s            = ( '*'  )
    int_f10_s           = ( '+'  )
    int_f11_s           = ( ','  )
    int_f12_s           = ( '-'  )
    int_f13_s           = ( '.'  )
    int_f14_s           = ( '/'  )
    int_f15_s           = ( 'A ' )
    int_f16_s           = ( 'A!' )

"     TEK4115 STYLE CURSOR CONTROL AND STANDARD KEY CODES

    int_q_c             = ( 'A1' )
    int_w_c             = ( 'A7' )
    int_e_c             = ( '5'  )
    int_r_c             = ( 'A2' )
    int_a_c             = ( '1'  )
    int_s_c             = ( 'A3' )
    int_d_c             = ( '4'  )
    int_f_c             = ( '6'  )
    int_z_c             = ( 'A:' )
    int_x_c             = ( 'A8' )
    int_c_c             = ( '3'  )
    int_v_c             = ( 'A6' )

"      MISC. KEY CODES

    int_tab_s           = ( 'B.' )

"      TEK INT CODES FOR VARIOUS CHARACTER SEQUENCES

    int_esc             = ( 'A;' )
    int_cr              = ( '=' )
    int_csi             = ( int_esc 'E;' )
    int_ch_4            = ( 'C4' )
    int_EP              = ( 'B1' )
    int_AT              = ( 'D0' )
    int_PS              = ( 'B3' )
    int_DS              = ( 'B4' )
    int_PC              = ( 'B5' )
    int_UA              = ( 'E>' )
    int_GT              = ( 'C>' )
    int_dot             = ( 'B>' )
    int_star            = ( 'B:' )
    int_A               = ( 'D1' )
    int_B               = ( 'D2' )
    int_C               = ( 'D3' )
    int_D               = ( 'D4' )
    int_E               = ( 'D5' )
    int_F               = ( 'D6' )
    int_G               = ( 'D7' )
    int_H               = ( 'D8' )
    int_I               = ( 'D9' )
    int_J               = ( 'D:' )
    int_K               = ( 'D;' )
    int_L               = ( 'D<' )
    int_M               = ( 'D=' )
    int_N               = ( 'D>' )
    int_O               = ( 'D?' )
    int_P               = ( 'E0' )
    int_Z               = ( 'E:' )
    int_l_a             = ( 'F1' )
    int_l_b             = ( 'F2' )
    int_l_c             = ( 'F3' )
    int_l_d             = ( 'F4' )
    int_l_e             = ( 'F5' )
    int_l_f             = ( 'F6' )
    int_l_g             = ( 'F7' )
    int_l_h             = ( 'F8' )
    int_l_i             = ( 'F9' )
    int_l_j             = ( 'F:' )
    int_l_k             = ( 'F;' )
    int_l_l             = ( 'F<' )
    int_l_m             = ( 'F=' )
    int_l_n             = ( 'F>' )
    int_l_o             = ( 'F?' )
    int_l_p             = ( 'G0' )
    int_0               = ( 'C0' )
    int_1               = ( 'C1' )
    int_2               = ( 'C2' )
    int_3               = ( 'C3' )
    int_4               = ( 'C4' )
    int_5               = ( 'C5' )
    int_6               = ( 'C6' )
    int_7               = ( 'C7' )
    int_8               = ( 'C8' )
    int_9               = ( 'C9' )

"      SENDING SEQUENCES

    define_macro        = ( esc 'KD' )
    clear_all_macros    = ( define_macro '!' '0' )

    set_screen_size     = ( select_code_tek esc 'LB' int_32 esc 'LL' ..
                            int_32 select_code_tek esc 'LC' int_80 ..
                            esc '8' esc 'LV' '1' select_code_ansi )

    start_alternate     = ( csi '1m' )
    stop_alternate      = ( csi 'm' )
    start_inverse       = ( csi '7m' )
    stop_inverse        = ( csi 'm' )
    start_underline     = ( csi '4m' )
    stop_underline      = ( csi 'm' )
    start_blink         = ( csi '5m')
    stop_blink          = ( csi 'm')

    forward_tab         = ( 09(16) )
    backward_tab        = ( csi 'Z' )
    clear_all_tabs      = ( csi '3g' )
    set_tab             = ( esc 'H' )

    set_table_1         = ( esc 'KT4' esc 'TM111' esc 'RD14' esc 'RI211' ..
                            esc 'TFA4' )
    set_table_2         = ( '0' '0'     '0'     '0'     ..
                            '1' int_100 int_100 int_100 )
    set_table_3         = ( '2' int_100 '0'     '0'     ..
                            '3' '0'     int_100 '0'     ..
                            '4' '0'     '0'     int_100 )
    set_color_table     = ( set_table_1 set_table_2 set_table_3 )

    set_alpha_cursor    = ( esc 'TD31' )


"     FUNCTION KEY PROGRAM MACROS
"     Tek function keys: unshifted F1..F8      are F1..F8
"                          shifted F1..F8      are shift F1..F8
"                          control F1..F8      are F9..F16
"                  control-shifted F1..F8      are shift F9..F16

    macro_f1    = ( define_macro int_f1  '4' int_esc int_O int_A int_cr )
    macro_f2    = ( define_macro int_f2  '4' int_esc int_O int_B int_cr )
    macro_f3    = ( define_macro int_f3  '4' int_esc int_O int_C int_cr )
    macro_f4    = ( define_macro int_f4  '4' int_esc int_O int_D int_cr )
    macro_f5    = ( define_macro int_f5  '4' int_esc int_O int_E int_cr )
    macro_f6    = ( define_macro int_f6  '4' int_esc int_O int_F int_cr )
    macro_f7    = ( define_macro int_f7  '4' int_esc int_O int_G int_cr )
    macro_f8    = ( define_macro int_f8  '4' int_esc int_O int_H int_cr )
    macro_f9    = ( define_macro int_f9  '4' int_esc int_O int_I int_cr )
    macro_f10   = ( define_macro int_f10 '4' int_esc int_O int_J int_cr )
    macro_f11   = ( define_macro int_f11 '4' int_esc int_O int_K int_cr )
    macro_f12   = ( define_macro int_f12 '4' int_esc int_O int_L int_cr )
    macro_f13   = ( define_macro int_f13 '4' int_esc int_O int_M int_cr )
    macro_f14   = ( define_macro int_f14 '4' int_esc int_O int_N int_cr )
    macro_f15   = ( define_macro int_f15 '4' int_esc int_O int_O int_cr )
    macro_f16   = ( define_macro int_f16 '4' int_esc int_O int_P int_cr )
    macro_f1_s  = ( define_macro int_f1_s  '4' int_esc int_O int_l_a int_cr )
    macro_f2_s  = ( define_macro int_f2_s  '4' int_esc int_O int_l_b int_cr )
    macro_f3_s  = ( define_macro int_f3_s  '4' int_esc int_O int_l_c int_cr )
    macro_f4_s  = ( define_macro int_f4_s  '4' int_esc int_O int_l_d int_cr )
    macro_f5_s  = ( define_macro int_f5_s  '4' int_esc int_O int_l_e int_cr )
    macro_f6_s  = ( define_macro int_f6_s  '4' int_esc int_O int_l_f int_cr )
    macro_f7_s  = ( define_macro int_f7_s  '4' int_esc int_O int_l_g int_cr )
    macro_f8_s  = ( define_macro int_f8_s  '4' int_esc int_O int_l_h int_cr )
    macro_f9_s  = ( define_macro int_f9_s  '4' int_esc int_O int_l_i int_cr )
    macro_f10_s = ( define_macro int_f10_s '4' int_esc int_O int_l_j int_cr )
    macro_f11_s = ( define_macro int_f11_s '4' int_esc int_O int_l_k int_cr )
    macro_f12_s = ( define_macro int_f12_s '4' int_esc int_O int_l_l int_cr )
    macro_f13_s = ( define_macro int_f13_s '4' int_esc int_O int_l_m int_cr )
    macro_f14_s = ( define_macro int_f14_s '4' int_esc int_O int_l_n int_cr )
    macro_f15_s = ( define_macro int_f15_s '4' int_esc int_O int_l_o int_cr )
    macro_f16_s = ( define_macro int_f16_s '4' int_esc int_O int_l_p int_cr )

"     JOY PAD PROGRAM MACROS
"     Tek Joy Pad moves the cursor in obvious directions
"          unshifted moves by one character position
"            shifted moves by two character positions
"            control moves by four character positions
"      control-shift moves by eight character positions

    macro_joy_r = ( define_macro int_joy_right '3' int_csi int_C )
    macro_joy_u = ( define_macro int_joy_up    '3' int_csi int_A )
    macro_joy_l = ( define_macro int_joy_left  '3' int_csi int_D )
    macro_joy_d = ( define_macro int_joy_down  '3' int_csi int_B )

    macro_joy_rs= ( define_macro int_joy_right_s '6' int_csi int_C ..
                    int_csi int_C)
    macro_joy_us= ( define_macro int_joy_up_s '6' int_csi int_A int_csi int_A)
    macro_joy_ls= ( define_macro int_joy_left_s '6' int_csi int_D int_csi int_D)
    macro_joy_ds= ( define_macro int_joy_down_s '6' int_csi int_B int_csi int_B)

    macro_joy_rc= ( define_macro int_joy_right_c '<' int_csi int_C int_csi ..
                    int_C int_csi int_C int_csi int_C )

    macro_joy_uc= ( define_macro int_joy_up_c '<' int_csi int_A int_csi int_A ..
                    int_csi int_A int_csi int_A )

    macro_joy_lc= ( define_macro int_joy_left_c '<' int_csi int_D int_csi ..
                    int_D int_csi int_D int_csi int_D )

    macro_joy_dc= ( define_macro int_joy_down_c  '<' int_csi int_B int_csi ..
                    int_B int_csi int_B int_csi int_B )

    macro_joy_rcs=( define_macro int_joy_right_cs 'A' '8' int_csi int_C ..
                    int_csi int_C int_csi int_C int_csi int_C int_csi int_C ..
                    int_csi int_C int_csi int_C int_csi int_C )

    macro_joy_ucs=( define_macro int_joy_up_cs 'A' '8' int_csi int_A int_csi ..
                    int_A int_csi int_A int_csi int_A int_csi int_A int_csi ..
                    int_A int_csi int_A int_csi int_A )

    macro_joy_lcs=( define_macro int_joy_left_cs 'A' '8' int_csi int_D ..
                    int_csi int_D int_csi int_D int_csi int_D int_csi int_D ..
                    int_csi int_D int_csi int_D int_csi int_D )

    macro_joy_dcs=( define_macro int_joy_down_cs 'A' '8' int_csi int_B ..
                    int_csi int_B int_csi int_B int_csi int_B int_csi int_B ..
                    int_csi int_B int_csi int_B int_csi int_B )

"     NUMERIC PAD KEY PROGRAM MACROS

    macro_pad_0      = (define_macro int_pad_0 '3' int_csi int_H)
    macro_pad_1      = (define_macro int_pad_1 '4' int_esc int_P int_1 int_cr)
    macro_pad_2      = (define_macro int_pad_2 '4' int_esc int_P int_2 int_cr)
    macro_pad_3      = (define_macro int_pad_3 '3' int_csi int_AT)
    macro_pad_4      = (define_macro int_pad_4 '4' int_esc int_P int_4 int_cr)
    macro_pad_5      = (define_macro int_pad_5 '4' int_esc int_P int_5 int_cr)
    macro_pad_6      = (define_macro int_pad_6 '3' int_csi int_P)
    macro_pad_7      = (define_macro int_pad_7 '5' int_csi int_ch_4 int_l_h)
    macro_pad_8      = (define_macro int_pad_8 '4' int_esc int_P int_8 int_cr)
    macro_pad_9      = (define_macro int_pad_9 '4' int_esc int_P int_9 int_cr)
    macro_pad_dash   = (define_macro int_pad_dash   '3' int_csi int_K)
    macro_pad_comma  = (define_macro int_pad_comma  '3' int_csi int_M)
    macro_pad_enter  = (define_macro int_pad_enter  '3' int_csi int_L)
    macro_pad_period = (define_macro int_pad_period '4' int_esc int_P ..
                        int_dot int_cr)

    macro_pad_0_s    = (define_macro int_pad_0_s '3' int_csi int_H)
    macro_pad_1_s    = (define_macro int_pad_1_s '4' int_esc int_P int_EP ..
                        int_cr)
    macro_pad_2_s    = (define_macro int_pad_2_s '4' int_esc int_P int_AT ..
                        int_cr)
    macro_pad_3_s    = (define_macro int_pad_3_s '3' int_csi int_P)
    macro_pad_4_s    = (define_macro int_pad_4_s '4' int_esc int_P int_DS ..
                        int_cr)
    macro_pad_5_s    = (define_macro int_pad_5_s '4' int_esc int_P int_PC ..
                        int_cr)
    macro_pad_6_s    = (define_macro int_pad_6_s '3' int_csi int_AT)
    macro_pad_7_s    = (define_macro int_pad_7_s '5' int_csi int_ch_4 int_l_l)
    macro_pad_8_s    = (define_macro int_pad_8_s '4' int_esc int_P int_star ..
                        int_cr)
    macro_pad_9_s    = (define_macro int_pad_9_s '5' int_csi int_ch_4 int_l_l)
    macro_pad_dash_s = (define_macro int_pad_dash_s   '3' int_csi int_J)
    macro_pad_comma_s= (define_macro int_pad_comma_s  '3' int_csi int_P)
    macro_pad_enter_s= (define_macro int_pad_enter_s  '3' int_csi int_AT)
    macro_pad_period_s=(define_macro int_pad_period_s '4' int_esc int_P ..
                        int_GT int_cr)

    macro_pad_1_c    = ( define_macro int_pad_1_c '4' int_esc int_O int_A int_cr )
    macro_pad_2_c    = ( define_macro int_pad_2_c '4' int_esc int_O int_B int_cr )
    macro_pad_3_c    = ( define_macro int_pad_3_c '4' int_esc int_O int_C int_cr )
    macro_pad_4_c    = ( define_macro int_pad_4_c '4' int_esc int_O int_D int_cr )
    macro_pad_5_c    = ( define_macro int_pad_5_c '4' int_esc int_O int_E int_cr )
    macro_pad_6_c    = ( define_macro int_pad_6_c '4' int_esc int_O int_F int_cr )
    macro_pad_7_c    = ( define_macro int_pad_7_c '4' int_esc int_O int_G int_cr )
    macro_pad_8_c    = ( define_macro int_pad_8_c '4' int_esc int_O int_H int_cr )
    macro_pad_9_c    = ( define_macro int_pad_9_c '4' int_esc int_O int_I int_cr )
    macro_pad_dash_c = ( define_macro int_pad_dash_c '4' int_esc int_O int_N int_cr )
    macro_pad_comma_c= ( define_macro int_pad_comma_c '4' int_esc int_O int_O int_cr )

    macro_pad_1_cs   = ( define_macro int_pad_1_cs '4' int_esc int_O int_l_a int_cr )
    macro_pad_2_cs   = ( define_macro int_pad_2_cs '4' int_esc int_O int_l_b int_cr )
    macro_pad_3_cs   = ( define_macro int_pad_3_cs '4' int_esc int_O int_l_c int_cr )
    macro_pad_4_cs   = ( define_macro int_pad_4_cs '4' int_esc int_O int_l_d int_cr )
    macro_pad_5_cs   = ( define_macro int_pad_5_cs '4' int_esc int_O int_l_e int_cr )
    macro_pad_6_cs   = ( define_macro int_pad_6_cs '4' int_esc int_O int_l_f int_cr )
    macro_pad_7_cs   = ( define_macro int_pad_7_cs '4' int_esc int_O int_l_g int_cr )
    macro_pad_8_cs   = ( define_macro int_pad_8_cs '4' int_esc int_O int_l_h int_cr )
    macro_pad_9_cs   = ( define_macro int_pad_9_cs '4' int_esc int_O int_l_i int_cr )
    macro_pad_dash_cs= ( define_macro int_pad_dash_cs '4' int_esc int_O int_l_n int_cr )
    macro_pad_comma_cs=( define_macro int_pad_comma_cs '4' int_esc int_O int_l_o int_cr )

"     TEK4115 STYLE CURSOR CONTROL AND STANDARD KEY MACROS

    macro_q_c        = (define_macro int_q_c '4' int_esc int_P int_4 int_cr)
    macro_w_c        = (define_macro int_w_c '3' int_csi int_H)
    macro_e_c        = (define_macro int_e_c '3' int_csi int_AT)
    macro_r_c        = (define_macro int_r_c '3' int_csi int_P)
    macro_a_c        = (define_macro int_a_c '3' int_csi int_D)
    macro_s_c        = (define_macro int_s_c '3' int_csi int_B)
    macro_d_c        = (define_macro int_d_c '3' int_csi int_A)
    macro_f_c        = (define_macro int_f_c '3' int_csi int_C)
    macro_z_c        = (define_macro int_z_c '4' int_esc int_P int_1 int_cr)
    macro_x_c        = (define_macro int_x_c '4' int_esc int_P int_0 int_cr)
    macro_c_c        = (define_macro int_c_c '3' int_csi int_L)
    macro_v_c        = (define_macro int_v_c '3' int_csi int_M)

"     OTHER KEY PROGRAM MACROS

    macro_tab_s      = (define_macro int_tab_s      '3' int_csi int_Z)

"     MODE CHANGE CHARACTER SEQUENCES

    set_BG    = ( csi '30;42m' )
    set_GB    = ( csi '32;40m' )
    set_RB    = ( csi '31;40m' )
    set_RR    = ( csi '31;41m' )
    set_WB    = ( csi '37;40m' )
    set_WBl   = ( csi '37;44m' )

    init_tek  = ( esc 'SK!' esc 'SV!0' esc 'KF0' esc 'KA1' esc 'LI100' ..
                  esc 'LS1' esc 'LM0' esc 'LV1' )

    init_ansi = ( select_code_ansi csi '?8h' csi '4l' csi '2l' csi '20l' ..
                  esc ')3' )


"   MODEL NAME AND COMMUNICATION TYPE

    model_name          value = 'TEK_4109'
    communications      type  = asynch

"   END OF INFORMATION SPECIFICATION

    end_of_information  in    = (0)

"   CURSOR POSITIONING INFORMATION

    cursor_pos_encoding      bias  = (1)   type = ansi_cursor

"NOS: cursor_pos_encoding      bias  = (0)   type = ansi_cursor

    cursor_pos_column_first  value = FALSE
    cursor_pos_column_length value = (0)
    cursor_pos_row_length    value = (0)
    cursor_pos_begin         out   = (csi)
    cursor_pos_second        out   = (';')
    cursor_pos_third         out   = ('H')

"   CURSOR MOVEMENT INFORMATION

    cursor_home              inout = (csi 'H')  label = ('Cursor Home')
    cursor_up                inout = (csi 'A')  label = ('Cursor Up')
    cursor_down              inout = (csi 'B')  label = ('Cursor Down')
    cursor_left              inout = (csi 'D')  label = ('Cursor Left')
    cursor_right             inout = (csi 'C')  label = ('Cursor Right')

"   CURSOR BEHAVIOR (for cursor movement keys)

    move_past_right          type  = stop_next
    move_past_left           type  = stop_next
    move_past_top            type  = stop_next
    move_past_bottom         type  = stop_next

"   CURSOR BEHAVIOR (for character keys)

    char_past_right          type  = stop_next
    char_past_left           type  = stop_next
    char_past_last_position  type  = stop_next

"   TERMINAL ATTRIBUTES

    function_key_leaves_mark value = 1

"NOS: function_key_leaves_mark value = TRUE

    automatic_tabbing        value = FALSE
    clears_when_change_size  value = TRUE
    has_hidden               value = FALSE
    has_protect              value = FALSE
    home_at_top              value = TRUE
    multiple_sizes           value = FALSE
    tabs_to_home             value = FALSE
    tabs_to_tab_stops        value = TRUE
    tabs_to_unprotected      value = FALSE
    type_ahead               value = TRUE

"   SCREEN SIZES

    set_size       rows = 32 columns = 80   out = (set_screen_size)

"   SCREEN AND LINE MODE TRANSITION

    screen_init      out =    ( select_code_tek )
    screen_init      out =    ( set_color_table )
    screen_init      out =    ( set_alpha_cursor)
    screen_init      out =    ( init_tek    )
    screen_init      out =    ( macro_f1    )
    screen_init      out =    ( macro_f2    )
    screen_init      out =    ( macro_f3    )
    screen_init      out =    ( macro_f4    )
    screen_init      out =    ( macro_f5    )
    screen_init      out =    ( macro_f6    )
    screen_init      out =    ( macro_f7    )
    screen_init      out =    ( macro_f8    )
    screen_init      out =    ( macro_f9    )
    screen_init      out =    ( macro_f10   )
    screen_init      out =    ( macro_f11   )
    screen_init      out =    ( macro_f12   )
    screen_init      out =    ( macro_f13   )
    screen_init      out =    ( macro_f14   )
    screen_init      out =    ( macro_f15   )
    screen_init      out =    ( macro_f16   )
    screen_init      out =    ( macro_joy_r )
    screen_init      out =    ( macro_joy_u )
    screen_init      out =    ( macro_joy_l )
    screen_init      out =    ( macro_joy_d )
    screen_init      out =    ( macro_joy_rs)
    screen_init      out =    ( macro_joy_us)
    screen_init      out =    ( macro_joy_ls)
    screen_init      out =    ( macro_joy_ds)
    screen_init      out =    ( macro_joy_rc)
    screen_init      out =    ( macro_joy_uc)
    screen_init      out =    ( macro_joy_lc)
    screen_init      out =    ( macro_joy_dc)
    screen_init      out =    ( macro_joy_rcs)
    screen_init      out =    ( macro_joy_ucs)
    screen_init      out =    ( macro_joy_lcs)
    screen_init      out =    ( macro_joy_dcs)
    screen_init      out =    ( macro_f1_s  )
    screen_init      out =    ( macro_f2_s  )
    screen_init      out =    ( macro_f3_s  )
    screen_init      out =    ( macro_f4_s  )
    screen_init      out =    ( macro_f5_s  )
    screen_init      out =    ( macro_f6_s  )
    screen_init      out =    ( macro_f7_s  )
    screen_init      out =    ( macro_f8_s  )
    screen_init      out =    ( macro_f9_s  )
    screen_init      out =    ( macro_f10_s )
    screen_init      out =    ( macro_f11_s )
    screen_init      out =    ( macro_f12_s )
    screen_init      out =    ( macro_f13_s )
    screen_init      out =    ( macro_f14_s )
    screen_init      out =    ( macro_f15_s )
    screen_init      out =    ( macro_f16_s )
    screen_init      out =    ( macro_pad_0 )
    screen_init      out =    ( macro_pad_1 )
    screen_init      out =    ( macro_pad_2 )
    screen_init      out =    ( macro_pad_3 )
    screen_init      out =    ( macro_pad_4 )
    screen_init      out =    ( macro_pad_5 )
    screen_init      out =    ( macro_pad_6 )
    screen_init      out =    ( macro_pad_7 )
    screen_init      out =    ( macro_pad_8 )
    screen_init      out =    ( macro_pad_9 )
    screen_init      out =    ( macro_pad_dash)
    screen_init      out =    ( macro_pad_comma)
    screen_init      out =    ( macro_pad_enter)
    screen_init      out =    ( macro_pad_period)
    screen_init      out =    ( macro_pad_0_s)
    screen_init      out =    ( macro_pad_1_s)
    screen_init      out =    ( macro_pad_2_s)
    screen_init      out =    ( macro_pad_3_s)
    screen_init      out =    ( macro_pad_4_s)
    screen_init      out =    ( macro_pad_5_s)
    screen_init      out =    ( macro_pad_6_s)
    screen_init      out =    ( macro_pad_7_s)
    screen_init      out =    ( macro_pad_8_s)
    screen_init      out =    ( macro_pad_9_s)
    screen_init      out =    ( macro_pad_dash_s)
    screen_init      out =    ( macro_pad_comma_s)
    screen_init      out =    ( macro_pad_enter_s)
    screen_init      out =    ( macro_pad_period_s)
    screen_init      out =    ( macro_pad_1_c)
    screen_init      out =    ( macro_pad_2_c)
    screen_init      out =    ( macro_pad_3_c)
    screen_init      out =    ( macro_pad_4_c)
    screen_init      out =    ( macro_pad_5_c)
    screen_init      out =    ( macro_pad_6_c)
    screen_init      out =    ( macro_pad_7_c)
    screen_init      out =    ( macro_pad_8_c)
    screen_init      out =    ( macro_pad_9_c)
    screen_init      out =    ( macro_pad_dash_c)
    screen_init      out =    ( macro_pad_comma_c)
    screen_init      out =    ( macro_pad_1_cs )
    screen_init      out =    ( macro_pad_2_cs )
    screen_init      out =    ( macro_pad_3_cs )
    screen_init      out =    ( macro_pad_4_cs )
    screen_init      out =    ( macro_pad_5_cs )
    screen_init      out =    ( macro_pad_6_cs )
    screen_init      out =    ( macro_pad_7_cs )
    screen_init      out =    ( macro_pad_8_cs )
    screen_init      out =    ( macro_pad_9_cs )
    screen_init      out =    ( macro_pad_dash_cs )
    screen_init      out =    ( macro_pad_comma_cs )
    screen_init      out =    ( macro_q_c   )
    screen_init      out =    ( macro_w_c   )
    screen_init      out =    ( macro_e_c   )
    screen_init      out =    ( macro_r_c   )
    screen_init      out =    ( macro_a_c   )
    screen_init      out =    ( macro_s_c   )
    screen_init      out =    ( macro_d_c   )
    screen_init      out =    ( macro_f_c   )
    screen_init      out =    ( macro_z_c   )
    screen_init      out =    ( macro_x_c   )
    screen_init      out =    ( macro_c_c   )
    screen_init      out =    ( macro_v_c   )
    screen_init      out =    ( macro_tab_s )
    screen_init      out =    ( init_ansi )

    set_line_mode    out =    ( )
    line_init        out =    ( select_code_tek clear_all_macros )

    set_screen_mode  out =    ( select_code_tek set_color_table ..
                                init_tek set_screen_size ..
                                init_ansi clear_all_tabs )



"   TERMINAL CAPABILITIES

    backspace           in    = (08(16))
    delete_char         inout = (csi 'P')     label='keypad 6'
    insert_char         inout = (csi '@')     label='keypad 3'
    insert_line_stay    inout = (csi 'L' )    label='keypad enter'
    delete_line_stay    inout = (csi 'M' )    label='keypad comma'
    erase_line_stay     inout = (csi '2K')
    erase_page_stay     inout = (csi '2J')
    erase_end_of_page   inout = (csi 'J')     label='shift keypad dash'
    erase_end_of_line   inout = (csi 'K' )    label='keypad dash'
    insert_mode_begin   inout = (csi '4h')
    insert_mode_end     inout = (csi '4l')
    tab_forward         inout = (forward_tab)
    tab_backward        inout = (backward_tab)
    tab_clear_all       inout = (clear_all_tabs)
    tab_set             inout = (set_tab)

"   MISCELLANEOUS TERMINAL SEQUENCES

    bell_nak            out = ( bel select_code_tek esc 'TF40' int_100 '00' ..
                                  esc 'TF40000' select_code_ansi )
    output_begin        out = ( )

"   PROGRAMMABLE FUNCTION KEY INPUT INFORMATION

    f1        in = (function 'A')     label = ('f1')
    f2        in = (function 'B')     label = ('f2')
    f3        in = (function 'C')     label = ('f3')
    f4        in = (function 'D')     label = ('f4')
    f5        in = (function 'E')     label = ('f5')
    f6        in = (function 'F')     label = ('f6')
    f7        in = (function 'G')     label = ('f7')
    f8        in = (function 'H')     label = ('f8')
    f9        in = (function 'I')     label = ('c1')
    f10       in = (function 'J')     label = ('c2')
    f11       in = (function 'K')     label = ('c3')
    f12       in = (function 'L')     label = ('c4')
    f13       in = (function 'M')     label = ('c5')
    f14       in = (function 'N')     label = ('c6')
    f15       in = (function 'O')     label = ('c7')
    f16       in = (function 'P')     label = ('c8')
    f1_s      in = (function 'a')     label = ('F1')
    f2_s      in = (function 'b')     label = ('F2')
    f3_s      in = (function 'c')     label = ('F3')
    f4_s      in = (function 'd')     label = ('F4')
    f5_s      in = (function 'e')     label = ('F5')
    f6_s      in = (function 'f')     label = ('F6')
    f7_s      in = (function 'g')     label = ('F7')
    f8_s      in = (function 'h')     label = ('F8')
    f9_s      in = (function 'i')     label = ('C1')
    f10_s     in = (function 'j')     label = ('C2')
    f11_s     in = (function 'k')     label = ('C3')
    f12_s     in = (function 'l')     label = ('C4')
    f13_s     in = (function 'm')     label = ('C5')
    f14_s     in = (function 'n')     label = ('C6')
    f15_s     in = (function 'o')     label = ('C7')
    f16_s     in = (function 'p')     label = ('C8')

"   CDC STANDARD FUNCTION KEY INPUT INFORMATION

    next      in = 13  label='NEXT'
    data      in = (extra_func '8')   label = ('Data')
    data_s    in = ()                 label = ('UNUSED')
    back      in = (extra_func '*')   label = ('Back')
    back_s    in = ()                 label = ('UNUSED')
    help      in = (extra_func '9')   label = ('Help')
    help_s    in = (extra_func '(')   label = ('Shift-Help')
    down      in = (extra_func '2')   label = ('Down')
    down_s    in = (extra_func '@')   label = ('Shift-Down')
    up        in = (extra_func '5')   label = ('Up')
    up_s      in = (extra_func '%')   label = ('Shift-Up')
    fwd       in = (extra_func '1')   label = ('FWD')
    fwd_s     in = (extra_func '!')   label = ('Shift-FWD')
    bkw       in = (extra_func '4')   label = ('BKW')
    bkw_s     in = (extra_func '$')   label = ('Shift-BKW')
    edit      in = (extra_func '.')   label = ('Edit')
    edit_s    in = (extra_func '>')   label = ('Shift-Edit')
    stop      in = (function 'F')     label = ('F6')
    stop_s    in = (function 'f')     label = ('Shift-F6')
    undo      in = (function 'E')     label = ('F5')
    undo_s    in = (function 'e')     label = ('Shift-F5')

"   Optional for use with command-redo
"   bkw       in = ( stx          )   label = ('BKW')
"   fwd       in = ( soh          )   label = ('FWD')

"   TERMINAL VIDEO ATTRIBUTES

    alt_begin           out = (start_alternate)
    alt_end             out = (stop_alternate)
    blink_begin         out = (start_blink)
    blink_end           out = (stop_blink)
    hidden_begin        out = (set_RR)
    hidden_end          out = (set_WB)
    inverse_begin       out = (set_BG)
    inverse_end         out = (set_WB)
    underline_begin     out = (start_underline set_GB)
    underline_end       out = (set_WB stop_underline)

"   LOGICAL ATTRIBUTE SPECIFICATIONS

    error_begin         out = (set_RB)
    error_end           out = (set_WB)
    input_text_begin    out = (start_underline set_WBl)
    input_text_end      out = (set_WB stop_underline)
    italic_begin        out = (set_WBl)
    italic_end          out = (set_WB)


"   LINE DRAWING CHARACTER SPECIFICATION

   ld_fine_begin            out = (so )
   ld_fine_end              out = (si )
   ld_fine_horizontal       out = ('q')
   ld_fine_vertical         out = ('x')
   ld_fine_upper_left       out = ('l')
   ld_fine_upper_right      out = ('k')
   ld_fine_lower_left       out = ('m')
   ld_fine_lower_right      out = ('j')
   ld_fine_up_t             out = ('w')
   ld_fine_down_t           out = ('v')
   ld_fine_left_t           out = ('t')
   ld_fine_right_t          out = ('u')
   ld_fine_cross            out = ('n')
   ld_medium_begin          out = (so set_GB)
   ld_medium_end            out = (si set_WB)
   ld_medium_horizontal     out = ('q')
   ld_medium_vertical       out = ('x')
   ld_medium_upper_left     out = ('l')
   ld_medium_upper_right    out = ('k')
   ld_medium_lower_left     out = ('m')
   ld_medium_lower_right    out = ('j')
   ld_medium_up_t           out = ('w')
   ld_medium_down_t         out = ('v')
   ld_medium_left_t         out = ('t')
   ld_medium_right_t        out = ('u')
   ld_medium_cross          out = ('n')
   ld_bold_begin            out = (set_WBl)
   ld_bold_end              out = (set_WB )
   ld_bold_horizontal       out = (' ')
   ld_bold_vertical         out = (' ')
   ld_bold_upper_left       out = (' ')
   ld_bold_upper_right      out = (' ')
   ld_bold_lower_left       out = (' ')
   ld_bold_lower_right      out = (' ')
   ld_bold_up_t             out = (' ')
   ld_bold_down_t           out = (' ')
   ld_bold_left_t           out = (' ')
   ld_bold_right_t          out = (' ')
   ld_bold_cross            out = (' ')


"  DEFAULT KEY DEFINITIONS FOR THE FULL SCREEN EDITOR

"   END OF TERMINAL DEFINITION FILE FOR TEKTRONIX T4109 TERMINAL
