home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / k95source / ckotvi.c < prev    next >
C/C++ Source or Header  |  2020-01-01  |  99KB  |  2,474 lines

  1. /*  C K O T V I . C  --  Televideo Emulation  */
  2.  
  3. /*
  4.   Author: Jeffrey Altman <jaltman@secure-endpoints.com>,
  5.             Secure Endpoints Inc., New York City.
  6.  
  7.   Copyright (C) 1985, 2004, Trustees of Columbia University in the City of New
  8.   York.
  9. */
  10.  
  11. #include "ckcdeb.h"
  12. #ifndef NOTERM
  13. #ifdef NT
  14. #include <windows.h>
  15. #else /* NT */
  16. #include <os2.h>
  17. #undef COMMENT
  18. #endif /* NT */
  19.  
  20. #include "ckcker.h"
  21. #include "ckcasc.h"
  22. #include "ckuusr.h"
  23. #include "ckcuni.h"
  24. #include "ckocon.h"
  25. #include "ckotvi.h"
  26. #include "ckctel.h"
  27. #include "ckokvb.h"
  28.  
  29. extern bool keyclick ;
  30. extern int  cursorena[], keylock, duplex, duplex_sav, screenon ;
  31. extern int  printon, aprint, cprint, uprint, xprint, seslog ;
  32. extern int  insertmode, tnlm, decssdt ;
  33. extern int  escstate, debses, decscnm, tt_cursor, ttmdm ;
  34. extern int  tt_type, tt_type_mode, tt_max, tt_answer, tt_status[VNUM], tt_szchng[] ;
  35. extern int  tt_cols[], tt_rows[], tt_wrap, tt_modechg ;
  36. extern int  wherex[], wherey[], margintop, marginbot ;
  37. extern int  marginbell, marginbellcol ;
  38. extern char answerback[], htab[] ;
  39. extern struct tt_info_rec tt_info[] ;
  40. extern vtattrib attrib ;
  41. extern unsigned char attribute, colorstatus;
  42. extern char * udkfkeys[];
  43. extern int tt_senddata ;
  44. extern int tt_hidattr;
  45.  
  46. #ifdef TCPSOCKET
  47. #ifdef CK_NAWS
  48. extern int tn_snaws();
  49. #endif /* CK_NAWS */
  50. #endif /* TCPSOCKET */
  51.  
  52. extern int protect ;
  53. extern int autoscroll ;
  54. extern int writeprotect ;
  55. extern int linelock ;
  56. extern int attrmode ;
  57. extern int wy_keymode ;
  58. extern int wy_enhanced ;
  59. extern int wy_widthclr ;
  60. extern int wy_autopage ;
  61. extern int wy_nullsuppress ;
  62. extern int wy_monitor ;
  63. extern int wy_block;
  64. extern vtattrib WPattrib ;
  65. extern tt_sac;
  66. extern bool xprintff; /* Print formfeed */
  67.  
  68. int tvi_ic = SP;
  69. CHAR tvi_send_field[3] = { XFS, NUL, NUL };
  70. CHAR tvi_send_line[3] = { US, NUL, NUL };
  71. CHAR tvi_send_start_protected_field[3] = { ESC, ')', NUL };
  72. CHAR tvi_send_end_protected_field[3] = { ESC, '(', NUL } ;
  73. CHAR tvi_send_end_of_text[3] = { CR, NUL, NUL };
  74.  
  75. int tvigraphics = FALSE;
  76.  
  77. static char tviuserline[MAXTERMCOL+1] ;
  78.  
  79.  
  80. /* Display Field                n  */
  81. #define WY_FIELD_APPL           0       /* Application Display Area   */
  82. #define WY_FIELD_FNKEY          1       /* Function Key Labeling Line */
  83. #define WY_FIELD_LOCAL_MSG      2       /* Local Message Field        */
  84. #define WY_FIELD_HOST_MSG       3       /* Host Message Field         */
  85.  
  86. _PROTOTYP(VOID wyse_tab, (VOID));
  87. _PROTOTYP(VOID wyse_backtab, (VOID));
  88.  
  89. int
  90. tviinc(void)
  91. {
  92.     extern int pmask, cmask;
  93.     extern int tt_utf8;
  94.     int ch;
  95.  
  96.   loop:
  97.     ch = ttinc(0);
  98.     if ( ch < 0 )
  99.         return ch;
  100.  
  101.     if ( seslog )
  102.         logchar(ch);
  103.  
  104.     /* Handle the UTF8 conversion if we are in that mode */
  105.     if ( tt_utf8 ) {
  106.         USHORT * ucs2 = NULL;
  107.         int rc = utf8_to_ucs2( (CHAR)(ch & 0xFF), &ucs2 );
  108.         if ( rc > 0 )
  109.             goto loop;
  110.         else if ( rc < 0 )
  111.             ch = 0xfffd;
  112.         else
  113.             ch = *ucs2;
  114.     }
  115.  
  116.     if ( !xprint ) {
  117. #ifndef NOXFER
  118.         autodown(ch);
  119. #endif /* NOXFER */
  120. autoexitchk(ch);
  121.     }
  122.     ch = ch & pmask & cmask;
  123.     debugses(ch);
  124.     if (printon && (is_xprint() || is_uprint()))
  125.         prtchar(ch);
  126.     return ch;
  127. }
  128.  
  129. USHORT
  130. xltvigrph( CHAR c ) {
  131.     extern struct _vtG *GNOW;
  132.     extern int win95lucida, win95hsl;
  133.  
  134.     USHORT cx = 0;
  135.     if ( isunicode() ) {
  136.         cx = (*xl_u[TX_TVIGRAPH])(c);
  137.         if ( win95hsl && cx >= 0x23BA && cx <= 0x23BD )
  138.             cx = tx_hslsub(cx);
  139.         else if ( cx >= 0xE000 && cx <= 0xF8FF )
  140.             cx = tx_usub(cx);
  141.         if (win95lucida && cx > 0x017f)
  142.             cx = tx_lucidasub(cx);
  143.     }
  144.     else
  145.     {
  146.         cx = (*xl_u[TX_TVIGRAPH])(c) ;
  147.         if ( win95hsl && cx >= 0x23BA && cx <= 0x23BD )
  148.             cx = tx_hslsub(cx);
  149.         else if ( cx >= 0xE000 && cx <= 0xF8FF )
  150.             cx = tx_usub(cx);
  151.         if ( GNOW->itol )
  152.             cx = (*GNOW->itol)(cx);
  153.     }
  154.     return(cx);
  155. }
  156.  
  157. void
  158. tvictrl( int ch )
  159. {
  160.     int i,j,x,y;
  161.  
  162.     if ( !xprint ) {
  163.     switch ( ch ) {
  164.     case ETX:
  165.         if ( debses )
  166.             break;
  167.         break;
  168.     case EOT:
  169.         if ( debses )
  170.             break;
  171.         break;
  172.     case ENQ:
  173.         if ( debses )
  174.             break;
  175.         if (tt_answer)
  176.             sendchars(answerback,strlen(answerback)) ;
  177.         sendchar(ACK);
  178.         break;
  179.     case ACK:
  180.         if ( debses )
  181.             break;
  182.         break;
  183.     case BEL:
  184.         if ( debses )
  185.             break;
  186.         bleep(BP_BEL);
  187.         break;
  188.     case BS:
  189.         if ( debses )
  190.             break;
  191.         cursorleft(0) ;
  192.         break;
  193.     case HT:
  194.         /* TVI 950 Tab behaves differently depending on state of */
  195.         /* protect/non-protect mode and autopage mode */
  196.  
  197.         if ( debses )
  198.             break;
  199.  
  200.         wyse_tab();
  201.         break;
  202.     case LF:
  203.         if ( debses )
  204.             break;
  205.         if ( autoscroll && !protect || wherey[VTERM] < marginbot )  {
  206.             wrtch((char) LF);
  207.         }
  208.         break;
  209.     case VT:
  210.         if ( debses )
  211.             break;
  212.         cursorup(0) ;
  213.         break;
  214.     case FF:
  215.         if ( debses )
  216.             break;
  217.         cursorright(0) ;
  218.         break;
  219.     case CR:
  220.         if ( debses )
  221.             break;
  222.         wrtch((char) CR);
  223.         break;
  224.     case SO:
  225.         if ( debses )
  226.             break;
  227.         /* Set Host port Receive to DTR */
  228.         break;
  229.     case SI:
  230.         if ( debses )
  231.             break;
  232.         /* Set Host port Receive to XON/XOFF or XPC */
  233.         break;
  234.     case DLE:
  235.         /* Store next, used by load function key only */
  236.         if ( debses )
  237.             break;
  238.         break;
  239.     case DC1:
  240.         /* Enable transmission */
  241.         break;
  242.     case DC2:
  243.         /* Turn on Bi-directional port */
  244.         if ( debses )
  245.         break;
  246.     case DC3:
  247.         /* Disable transmission */
  248.         break;
  249.     case DC4:
  250.         /* Turn off Bi-directional port */
  251.         if ( debses )
  252.             break;
  253.         break;
  254.     case NAK:
  255.         if ( debses )
  256.             break;
  257.         break;
  258.     case SYN:
  259.         /* Cursordown - no scroll */
  260.         if ( debses )
  261.             break;
  262.         cursordown(0) ;
  263.         break;
  264.     case ETB:
  265.         if ( debses )
  266.             break;
  267.         break;
  268.     case CAN:
  269.         if ( debses )
  270.             break;
  271.         break;
  272.     case XEM:
  273.         /* End Message - used by load function key only */
  274.         break;
  275.     case SUB:
  276.         /* Clear unprotected page to Insert Character */
  277.         if ( debses )
  278.             break;
  279.         /* Clear unprotected page to Insert Character */
  280.         selclrscreen( VTERM, tvi_ic );
  281.         lgotoxy(VTERM,1,1);       /* and home the cursor */
  282.         if ( writeprotect ) {
  283.             int xs = VscrnGetWidth(VTERM);
  284.             int ys = VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0);
  285.             vtattrib vta = {0,0,0,0,0,1,0,0,0,0,0}; /* Protected */
  286.             for ( y = 0 ; y < ys ; y++ )
  287.                 for ( x = 0 ; x < xs ; x++ ) {
  288.                     vta = VscrnGetVtCharAttr( VTERM, x, y ) ;
  289.                     vta.unerasable = TRUE ;
  290.                     VscrnSetVtCharAttr( VTERM, x, y, vta ) ;
  291.                 }
  292.         }
  293.         break;
  294.     case ESC:
  295.         /* initiate escape sequence */
  296.         escstate = ES_GOTESC ;
  297.         break;
  298.     case XRS:
  299.         /* Home cursor */
  300.         if ( debses )
  301.             break;
  302.         lgotoxy(VTERM,1,1) ;
  303.         break;
  304.     case US:
  305.         /* Cursor to start on next line */
  306.         if ( debses )
  307.             break;
  308.         if (autoscroll && !protect) {
  309.             wrtch((CHAR)CR);
  310.             wrtch((CHAR)LF);
  311.         }
  312.         break;
  313.     }
  314.     }
  315.     else { /* xprint */
  316.         switch ( ch ) {
  317.         case ESC:
  318.             /* initiate escape sequence */
  319.             escstate = ES_GOTESC ;
  320.             break;
  321.         }
  322.     }
  323. }
  324.  
  325. vtattrib
  326. wysecharattr( int ch ) ;
  327.  
  328. USHORT
  329. wyselineattr( int ch ) ;
  330.  
  331. USHORT
  332. wyselinebg( int ch )  ;
  333.  
  334. void
  335. ApplyPageAttribute( int vmode, int x, int y, vtattrib vta )  ;
  336.  
  337. void
  338. ApplyLineAttribute( int vmode, int x, int y, vtattrib vta )  ;
  339.  
  340. void
  341. tviascii( int ch )
  342. {
  343.     int i,j,k,n,x,y,z;
  344.     vtattrib attr ;
  345.     viocell blankvcell;
  346.  
  347.     if (printon && (is_xprint() || is_uprint()))
  348.         prtchar(ch);
  349.  
  350.     if ( escstate == ES_GOTESC )/* Process character as part of an escstate sequence */
  351.     {
  352.         if ( ch < SP ) {
  353.             escstate = ES_NORMAL ;
  354.             tvictrl(ch) ;
  355.         }
  356.         else
  357.         {
  358.             escstate = ES_ESCSEQ ;
  359.             if ( !xprint ) {
  360.             switch ( ch ) {
  361.             case SP: {
  362.                 /* Time of Day */
  363.                 int mode, ampm, hr, min ;
  364.                 mode = tviinc() ;
  365.                 switch ( mode ) {
  366.                 case '1':       /* Load a/p hr min */
  367.                     ampm = tviinc();
  368.                     hr = tviinc() ;
  369.                     min = tviinc() ;
  370.                     if ( debses )
  371.                         break;
  372.                     break;
  373.                 case '2': {     /* Send */
  374.                     if ( debses )
  375.                         break;
  376.                     break;
  377.                 }
  378.                 }
  379.                 break;
  380.             }
  381.             case '!':
  382.                 if ( ISTVI950(tt_type_mode) )
  383.                 {
  384.                     ch = tviinc();
  385.                     switch ( ch ) {
  386.                     case '1':
  387.                         /* TVI950 - Line lock mode on */
  388.                         /* applies only to current line ?? */
  389.                         if ( debses )
  390.                             break;
  391.                         linelock = TRUE ;
  392.                         break;
  393.                     case '2':
  394.                         /* TVI950 - Line lock mode off */
  395.                         /* Clears all line locks ?? */
  396.                         if ( debses )
  397.                             break;
  398.                         linelock = FALSE ;
  399.                         break;
  400.                 }
  401.                 }
  402.                 else {
  403.                     /* clear unprotected page to display attribute */
  404.                     int attr ;
  405.                     ch = tviinc() ;
  406.                 }
  407.                 break;
  408.             case '"':
  409.                 /* Unlocks the keyboard */
  410.                 if ( !debses )
  411.                     keylock = FALSE ;
  412.                 break;
  413.             case '#':
  414.                 /* Locks the keyboard */
  415.                 if ( !debses )
  416.                     keylock = TRUE ;
  417.                 break;
  418.             case '$':
  419.                 if ( debses )
  420.                     break;
  421.                 tvigraphics = TRUE ;
  422.                 break;
  423.             case '%':
  424.                 if ( debses )
  425.                     break;
  426.                 tvigraphics = FALSE ;
  427.                 break;
  428.             case '&':
  429.                 /* Turns the protect submode on and prevents the auto */
  430.                 /* scroll operation */
  431.                 /* not TVI 910+ */
  432.                 if ( ISTVI910(tt_type_mode) || debses )
  433.                     break;
  434.                 protect = TRUE ;
  435.                 break;
  436.             case '\'':
  437.                 /* Turns the protect submode off and allows the auto */
  438.                 /* scroll operation */
  439.                 if ( !debses )
  440.                     protect = FALSE ;
  441.                 break;
  442.             case '(':
  443.                 /* Turns the write protect submode off */
  444.                 if ( debses || !writeprotect )
  445.                     break;
  446.                 writeprotect = FALSE ;
  447.                 attrib.unerasable = FALSE;
  448.                 break;
  449.             case ')':
  450.                 /* Turns the write protect submode on */
  451.                 if ( debses || writeprotect )
  452.                     break;
  453.                 writeprotect = TRUE ;
  454.                 attrib.unerasable = TRUE ;
  455.                 break;
  456.             case '*':
  457.                 /* Clears the screen to nulls. */
  458.                 /* The protect submode is turned off */
  459.                 if ( debses )
  460.                     break;
  461.                 protect = FALSE ;
  462.                 writeprotect = FALSE ;
  463.                 clrscreen( VTERM, NUL ) ;
  464.                 lgotoxy(VTERM,1,1);       /* and home the cursor */
  465.                 break;
  466.             case '+':
  467.                 /* 955 mode: Clear all to replacement characters         */
  468.                 /* (reset protect and write protect modes)               */
  469.                 /* 950 mode: Clear unprotected to replacement characters */
  470.                 if ( debses )
  471.                     break;
  472.                 selclrscreen( VTERM, tvi_ic );
  473.                 lgotoxy(VTERM,1,1);       /* and home the cursor */
  474.                 if ( writeprotect ) {
  475.                     int xs = VscrnGetWidth(VTERM);
  476.                     int ys = VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0);
  477.                     vtattrib vta = {0,0,0,0,0,1,0,0,0,0,0}; /* Protected */
  478.                     for ( y = 0 ; y < ys ; y++ )
  479.                         for ( x = 0 ; x < xs ; x++ ) {
  480.                             vta = VscrnGetVtCharAttr( VTERM, x, y ) ;
  481.                             vta.unerasable = TRUE ;
  482.                             VscrnSetVtCharAttr( VTERM, x, y, vta ) ;
  483.                         }
  484.                     }
  485.                 break;
  486.             case ',': {
  487.                 /* 955: Clear unprotected to write protected spaces      */
  488.                 /* (reset protect mode)                                  */
  489.                 /* 950: Clear unprotected page to write-protected spaces */
  490.                 /* (do not reset protect mode)                           */
  491.                 int xs = VscrnGetWidth(VTERM);
  492.                 int ys = VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0);
  493.                 vtattrib vta = {0,0,0,0,0,1,0,0,0,0,0}; /* Protected */
  494.  
  495.                 if ( debses )
  496.                     break;
  497.                 clrscreen( VTERM, SP );
  498.                 lgotoxy(VTERM,1,1);       /* and home the cursor */
  499.                 for ( y = 0 ; y < ys ; y++ )
  500.                     for ( x = 0 ; x < xs ; x++ ) {
  501.                         vta = VscrnGetVtCharAttr( VTERM, x, y ) ;
  502.                         vta.unerasable = TRUE ;
  503.                         VscrnSetVtCharAttr( VTERM, x, y, vta ) ;
  504.                     }
  505.                 break;
  506.             }
  507.             case '-': {
  508.                 /* Moves the cursor to a specified text segment. */
  509.                 /* This has a multiple code sequence of:         */
  510.                 /* ESC - prc                                     */
  511.                 /* where p = the page                            */
  512.                 /*       r = the row code                        */
  513.                 /*       c = the column code                     */
  514.                 /* TVI950 */
  515.                 int p,r,c ;
  516.                 p = tviinc();
  517.  
  518.                 r = tviinc()-31;
  519.  
  520.                 c = tviinc();
  521.                 if ( c == '~' )
  522.                     c = tviinc() - 31 + 80 ;
  523.                 else
  524.                     c -= 31 ;
  525.  
  526.                 if ( debses )
  527.                     break;
  528.                 if ( p == WY_FIELD_APPL )
  529.                     lgotoxy(VTERM,c,r);
  530.                 break;
  531.             }
  532.             case '.': {
  533.                 if ( ISTVI910(tt_type_mode) )
  534.                 {
  535.                     /* TVI910 - Toggle Cursor On/Off */
  536.                     if ( debses )
  537.                         break;
  538.                     cursorena[VTERM] = !cursorena[VTERM] ;
  539.                 }
  540.                 else if ( ISTVI950(tt_type_mode) ||
  541.                           ISTVI925(tt_type_mode) ) {
  542.                     /* TVI950 - Set Cursor Type */
  543.                     int n = tviinc() ;
  544.                     if ( debses )
  545.                         break;
  546.                     switch ( n ) {
  547.                     case '0':
  548.                         /* Cursor display off */
  549.                         cursorena[VTERM] = FALSE ;
  550.                         break;
  551.                     case '1':
  552.                         /* Blinking block cursor (default) */
  553.                         tt_cursor = TTC_BLOCK ;
  554.                         setcursormode() ;
  555.                         cursorena[VTERM] = TRUE ;
  556.                         break;
  557.                     case '2':
  558.                         /* Steady block cursor */
  559.                         tt_cursor = TTC_BLOCK ;
  560.                         setcursormode() ;
  561.                         cursorena[VTERM] = TRUE ;
  562.                         break;
  563.                     case '3':
  564.                         /* Blinking line cursor */
  565.                         tt_cursor = TTC_ULINE ;
  566.                         setcursormode() ;
  567.                         cursorena[VTERM] = TRUE ;
  568.                         break;
  569.                     case '4':
  570.                         /* Steady line cursor */
  571.                         tt_cursor = TTC_ULINE ;
  572.                         setcursormode() ;
  573.                         cursorena[VTERM] = TRUE ;
  574.                         break;
  575.                     }
  576.                 }
  577.                 break;
  578.             }
  579.             case '/': {
  580.                 if ( debses )
  581.                     break;
  582.  
  583.                 if ( ISTVI925(tt_type_mode) ||
  584.                      ISTVI950(tt_type_mode) ) {
  585.                          /* Transmits the active text segment number and */
  586.                          /* cursor address. */
  587.                          char buf[5] ;
  588.  
  589.                          buf[0] = 0;
  590.                          buf[1] = wherey[VTERM]+31 ;
  591.                          buf[2] = wherex[VTERM]+31 ;
  592.                          buf[3] = CR ;
  593.                          buf[4] = NUL ;
  594.  
  595.                          sendchars( buf, 4 ) ;
  596.                      }
  597.                 break;
  598.             }
  599.             case '0': {
  600.                 /* 950 - Program the SEND key (unsupported)   */
  601.                 /* 955 - ESC 0 Ps P1 P2 P3                    */
  602.                 /*       Reprogram any individual editing key */
  603.                 if ( ISTVI950(tt_type_mode) ) {
  604.                     int p1, p2, k=-1;
  605.  
  606.                     if ((p1 = tviinc()) < 0)
  607.                         break;
  608.                     if ((p2 = tviinc()) < 0)
  609.                         break;
  610.                     if ( debses )
  611.                         break;
  612.                     switch ( p1 ) {
  613.                     case '0':   /* Shift Send */
  614.                         k = K_TVISSEND;
  615.                         break;
  616.                     case '1':   /* Send */
  617.                         k = K_TVISEND;
  618.                         break;
  619.  
  620.                     }
  621.                     if ( k < 0 )
  622.                         break;
  623.                     if ( udkfkeys[k-K_TVIF01] ) {
  624.                         free(udkfkeys[k-K_TVIF01]);
  625.                         udkfkeys[k-K_TVIF01] = NULL;
  626.                     }
  627.                     switch ( p2 ) {
  628.                     case '4':
  629.                         udkfkeys[k-K_TVIF01] = strdup("\0334");
  630.                         break;
  631.                     case '5':
  632.                         udkfkeys[k-K_TVIF01] = strdup("\0335");
  633.                         break;
  634.                     case '6':
  635.                         udkfkeys[k-K_TVIF01] = strdup("\0336");
  636.                         break;
  637.                     case '7':
  638.                         udkfkeys[k-K_TVIF01] = strdup("\0337");
  639.                         break;
  640.                     case 'S':
  641.                         udkfkeys[k-K_TVIF01] = strdup("\033S");
  642.                         break;
  643.                     case 's':
  644.                         udkfkeys[k-K_TVIF01] = strdup("\033s");
  645.                         break;
  646.                     }
  647.                 }
  648.                 break;
  649.             }
  650.             case '1':
  651.                 /* Sets a tab stop */
  652.                 if ( debses )
  653.                     break;
  654.                 if ( ISTVI910(tt_type_mode) ||
  655.                      ISTVI950(tt_type_mode) )
  656.                     htab[wherex[VTERM]] = 'T';
  657.                 break;
  658.             case '2':
  659.                 /* Clears a tab stop */
  660.                 if ( debses )
  661.                     break;
  662.                 if ( ISTVI910(tt_type_mode) ||
  663.                      ISTVI950(tt_type_mode) )
  664.                     htab[wherex[VTERM]] = '0';
  665.                 break;
  666.             case '3':
  667.                 /* Clears all tab stops */
  668.                 if ( debses )
  669.                     break;
  670.                 if ( ISTVI910(tt_type_mode) ||
  671.                      ISTVI950(tt_type_mode) )
  672.                     for (j = 1; j <=MAXTERMCOL; ++j)
  673.                         htab[j] = '0';
  674.                 break;
  675.             case '4': {  /* Send line unprotected */
  676.                 int x, fs=1 ;
  677.  
  678.                 debug(F110,"TVI Escape","Send all unprotected chars from BOL",0);
  679.                 if ( debses )
  680.                     break;
  681.  
  682.                 for ( x=0;x<=wherex[VTERM]-1;x++ ) {
  683.                     if ( !VscrnGetVtCharAttr(VTERM, x, wherey[VTERM]-1).unerasable ) {
  684.                         int ch = VscrnGetCell( VTERM, x, wherey[VTERM]-1 )->c ;
  685.                         if ( ch || !wy_nullsuppress ) {
  686.                             if ( tt_senddata ) {
  687.                                 unsigned char * bytes;
  688.                                 int nbytes;
  689.                                 if ( isunicode() )
  690.                                     nbytes = utorxlat(ch,&bytes);
  691.                                 else
  692.                                     nbytes = utorxlat(ch,&bytes);
  693.                                 while ( nbytes-- > 0 )
  694.                                     sendchar(*bytes++) ;
  695.                             } else
  696.                                 sendchar(SP);
  697.                         }
  698.                         fs = 0 ;
  699.                     }
  700.                     else if ( !fs ) {
  701.                         /* Send field delimeter */
  702.                         if ( tvi_send_field[0] )
  703.                             sendchars(tvi_send_field,strlen(tvi_send_field));
  704.                         fs = 1 ;
  705.                     }
  706.                 }
  707.                 /* Send End of Text delimeter */
  708.                 if ( tvi_send_end_of_text[0] )
  709.                     sendchars(tvi_send_end_of_text,strlen(tvi_send_end_of_text));
  710.                 break;
  711.             }
  712.             case '5': {  /* Send page unprotected */
  713.                 int x,y,fs=1 ;
  714.  
  715.                 debug(F110,"TVI Escape","Send all unprotected chars from BOS",0);
  716.                 if ( debses )
  717.                     break;
  718.  
  719.                 for ( y=0;y<=wherey[VTERM]-1; y++ ) {
  720.                     for ( x=0;x<=wherex[VTERM]-1;x++ )
  721.                         if ( !VscrnGetVtCharAttr(VTERM, x, y).unerasable ) {
  722.                             int ch = VscrnGetCell( VTERM, x, y )->c ;
  723.                             if ( ch || !wy_nullsuppress ) {
  724.                                 if ( tt_senddata ) {
  725.                                     unsigned char * bytes;
  726.                                     int nbytes;
  727.                                     if ( isunicode() )
  728.                                         nbytes = utorxlat(ch,&bytes);
  729.                                     else
  730.                                         nbytes = utorxlat(ch,&bytes);
  731.                                     while ( nbytes-- > 0 )
  732.                                         sendchar(*bytes++) ;
  733.                                 } else
  734.                                     sendchar(SP);
  735.                             }
  736.                             fs = 0 ;
  737.                         }
  738.                         else if ( !fs ) {
  739.                             /* Send field delimeter */
  740.                             if ( tvi_send_field[0] )
  741.                                 sendchars(tvi_send_field,strlen(tvi_send_field));
  742.                             fs = 1 ;
  743.                         }
  744.                     if ( y < wherey[VTERM]-1 ) {
  745.                         /* Send end of line delimeter */
  746.                         if ( tvi_send_line[0] )
  747.                             sendchars(tvi_send_line,strlen(tvi_send_line));
  748.                     }
  749.                     /* Send End of Text delimeter */
  750.                     if ( tvi_send_end_of_text[0] )
  751.                         sendchars(tvi_send_end_of_text,strlen(tvi_send_end_of_text));
  752.                 }
  753.                 break;
  754.             }
  755.             case '6': {  /* Send line all */
  756.                 int x, fs=0, ch=0 ;
  757.  
  758.                 debug(F110,"TVI Escape","Send all chars from BOL",0);
  759.                 if ( debses )
  760.                     break;
  761.  
  762.                 for ( x=0;x<=wherex[VTERM]-1;x++ ) {
  763.                     if ( !VscrnGetVtCharAttr(VTERM, x, wherey[VTERM]-1).unerasable ) {
  764.                         if ( fs ) {
  765.                             if ( tvi_send_end_protected_field[0] )
  766.                                 sendchars(tvi_send_end_protected_field,
  767.                                            strlen(tvi_send_end_protected_field));
  768.                             fs = 0;
  769.                         }
  770.                     }
  771.                     else if ( !fs ) {
  772.                         if ( tvi_send_start_protected_field[0] )
  773.                             sendchars(tvi_send_start_protected_field,
  774.                                        strlen(tvi_send_start_protected_field));
  775.                         fs = 1 ;
  776.                     }
  777.                     ch = VscrnGetCell( VTERM, x, wherey[VTERM]-1 )->c ;
  778.                     if ( ch  || !wy_nullsuppress ) {
  779.                         if ( tt_senddata ) {
  780.                             unsigned char * bytes;
  781.                             int nbytes;
  782.                             if ( isunicode() )
  783.                                 nbytes = utorxlat(ch,&bytes);
  784.                             else
  785.                                 nbytes = utorxlat(ch,&bytes);
  786.                             while ( nbytes-- > 0 )
  787.                                 sendchar(*bytes++) ;
  788.                         } else
  789.                             sendchar(SP);
  790.                     }
  791.                 }
  792.                 /* Send End of Text delimeter */
  793.                 if ( tvi_send_end_of_text[0] )
  794.                     sendchars(tvi_send_end_of_text,strlen(tvi_send_end_of_text));
  795.                 break;
  796.             }
  797.             case '7': {  /* Send page all */
  798.                 int x,y,fs=0,ch=0;
  799.  
  800.                 debug(F110,"TVI Escape","Send all chars from BOS",0);
  801.                 if ( debses )
  802.                     break;
  803.  
  804.                 for ( y=0;y<=wherey[VTERM]-1; y++ ) {
  805.                     for ( x=0;x<=wherex[VTERM]-1;x++ ) {
  806.                         if ( !VscrnGetVtCharAttr(VTERM, x, y).unerasable ) {
  807.                             if ( fs ) {
  808.                                 if ( tvi_send_end_protected_field[0] )
  809.                                     sendchars(tvi_send_end_protected_field,
  810.                                                strlen(tvi_send_end_protected_field));
  811.                                 fs = 0;
  812.                             }
  813.                         }
  814.                         else if ( !fs ) {
  815.                             if ( tvi_send_start_protected_field[0] )
  816.                                 sendchars(tvi_send_start_protected_field,
  817.                                            strlen(tvi_send_start_protected_field));
  818.                             fs = 1 ;
  819.                         }
  820.                         ch = VscrnGetCell( VTERM, x, y )->c;
  821.                         if ( ch || !wy_nullsuppress ) {
  822.                             if ( tt_senddata ) {
  823.                                 unsigned char * bytes;
  824.                                 int nbytes;
  825.                                 if ( isunicode() )
  826.                                     nbytes = utorxlat(ch,&bytes);
  827.                                 else
  828.                                     nbytes = utorxlat(ch,&bytes);
  829.                                 while ( nbytes-- > 0 )
  830.                                     sendchar(*bytes++) ;
  831.                             } else
  832.                                 sendchar(SP);
  833.                         }
  834.                     }
  835.                     if ( y < wherey[VTERM]-1 ) {
  836.                         /* Send end of line delimeter */
  837.                         if ( tvi_send_line[0] )
  838.                             sendchars(tvi_send_line,strlen(tvi_send_line));
  839.                     }
  840.                 }
  841.                 /* Send End of Text delimeter */
  842.                 if ( tvi_send_end_of_text[0] )
  843.                     sendchars(tvi_send_end_of_text,strlen(tvi_send_end_of_text));
  844.                 break;
  845.             }
  846.             case '8':
  847.                 /* Smooth Scroll On */
  848.                 if ( debses )
  849.                     break;
  850.                 if ( ISTVI950(tt_type_mode) )
  851.                     SmoothScroll() ;
  852.                 break;
  853.             case '9':
  854.                 /* Smooth Scroll Off */
  855.                 if ( debses )
  856.                     break;
  857.                 if ( ISTVI950(tt_type_mode) )
  858.                     JumpScroll() ;
  859.                 break;
  860.             case ':':
  861.                 if ( debses )
  862.                     break;
  863.                 if ( ISTVI925(tt_type_mode) ||
  864.                      ISTVI950(tt_type_mode) ) {
  865.                     /* Clear unprotected page to NULs */
  866.                     selclrscreen( VTERM, NUL );
  867.                     lgotoxy(VTERM,1,1);       /* and home the cursor */
  868.                     if ( writeprotect ) {
  869.                         int xs = VscrnGetWidth(VTERM);
  870.                         int ys = VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0);
  871.                         vtattrib vta = {0,0,0,0,0,1,0,0,0,0,0}; /* Protected */
  872.                         for ( y = 0 ; y < ys ; y++ )
  873.                             for ( x = 0 ; x < xs ; x++ ) {
  874.                                 vta = VscrnGetVtCharAttr( VTERM, x, y ) ;
  875.                                 vta.unerasable = TRUE ;
  876.                                 VscrnSetVtCharAttr( VTERM, x, y, vta ) ;
  877.                         }
  878.                     }
  879.                 }
  880.                 break;
  881.             case ';':
  882.                 if ( debses )
  883.                     break;
  884.                 if ( ISTVI925(tt_type_mode) ||
  885.                      ISTVI950(tt_type_mode) ) {
  886.                     /* Clear unprotected page to Insert Character */
  887.                     selclrscreen( VTERM, tvi_ic );
  888.                     lgotoxy(VTERM,1,1);       /* and home the cursor */
  889.                     if ( writeprotect ) {
  890.                         int xs = VscrnGetWidth(VTERM);
  891.                         int ys = VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0);
  892.                         vtattrib vta = {0,0,0,0,0,1,0,0,0,0,0}; /* Protected */
  893.                         for ( y = 0 ; y < ys ; y++ )
  894.                             for ( x = 0 ; x < xs ; x++ ) {
  895.                                 vta = VscrnGetVtCharAttr( VTERM, x, y ) ;
  896.                                 vta.unerasable = TRUE ;
  897.                                 VscrnSetVtCharAttr( VTERM, x, y, vta ) ;
  898.                         }
  899.                     }
  900.                 }
  901.                 break;
  902.             case '<':
  903.                 /* Turn off keyclick */
  904.                 if ( debses )
  905.                     break;
  906.                 if ( ISTVI925(tt_type_mode) ||
  907.                      ISTVI950(tt_type_mode) )
  908.                     setkeyclick(FALSE);
  909.                 break;
  910.             case '=': {
  911.                 /* Moves the cursor to a specified row and column for */
  912.                 /* an 80-column screen.  This has a format of:        */
  913.                 /*    ESC = rc where                                  */
  914.                 /* r = the row code; and c = the column code          */
  915.                 int r,c ;
  916.                 r = tviinc() ;
  917.  
  918.                 if ( r < SP ) {
  919.                     escstate = ES_NORMAL ;
  920.                     tviascii(r) ;
  921.                     return ;
  922.                 }
  923.                 c = tviinc() ;
  924.  
  925.                 if ( c < SP ) {
  926.                     escstate = ES_NORMAL ;
  927.                     tviascii(c) ;
  928.                     return ;
  929.                 }
  930.                 if ( debses )
  931.                     break;
  932.                 if ( /* VscrnGetWidth(VTERM) == 80 && */ c > 31 && r > 31 )
  933.                      lgotoxy(VTERM,c-31,r-31);
  934.                 else if ( VscrnGetWidth(VTERM) == 132 && c > 31 && r > 31 )
  935.                      lgotoxy(VTERM,c-31,r-31);
  936.                 break;
  937.             }
  938.             case '>':
  939.                 /* Turn on keyclick */
  940.                 if ( debses )
  941.                     break;
  942.                 if ( ISTVI925(tt_type_mode) ||
  943.                      ISTVI950(tt_type_mode) )
  944.                     setkeyclick(TRUE);
  945.                 break;
  946.             case '?':
  947.                 /* Transmits the cursor address for the active text    */
  948.                 /* segment of an 80-column screen only.  The format is */
  949.                 /*    rc CR where r = the row code; and c = the column */
  950.                 /* code.                                               */
  951.                 if ( debses )
  952.                     break;
  953.                 if ( 1 /* VscrnGetWidth(VTERM) == 80 */ ) {
  954.                     char buf[4] ;
  955.                     buf[0] = (char)(wherey[VTERM]+31) ;
  956.                     buf[1] = (char)(wherex[VTERM]+31) ;
  957.                     buf[2] = CR ;
  958.                     buf[3] = NUL ;
  959.                     sendchars(buf,3) ;
  960.                 }
  961.                 break;
  962.             case '@':
  963.                 /* Copy print mode on */
  964.                 if ( debses )
  965.                     break;
  966.                 cprint = TRUE ;
  967.                 if ( !printon )
  968.                     printeron() ;
  969.                 break;
  970.             case 'A': {
  971.                 /* Turn copy-print mode off */
  972.                 if ( debses )
  973.                     break;
  974.                 cprint = FALSE ;
  975.                 if ( !cprint && !uprint && !xprint && !aprint && printon )
  976.                     printeroff();
  977.                 break;
  978.             }
  979.             case 'B':
  980.                 /* Places the terminal in the block mode.                  */
  981.                 if ( debses )
  982.                     break;
  983.                 if ( ISTVI950(tt_type_mode) )
  984.                     wy_block = TRUE;
  985.                 break;
  986.             case 'C':
  987.                 /* Conversation mode; block mode off */
  988.                 if ( debses )
  989.                     break;
  990.                 if ( ISTVI950(tt_type_mode) )
  991.                     wy_block = FALSE;
  992.                 break;
  993.             case 'D': {
  994.                 /* Selects the full duplex or half-duplex conversation   */
  995.                 /* modes.  This has the multiple code sequence:          */
  996.                 /*   ESC D x where x = F full duplex mode; H half duplex */
  997.                 int n = tviinc();
  998.  
  999.                 if ( debses )
  1000.                     break;
  1001.                 switch ( n ) {
  1002.                 case 'F':
  1003.                     if ( duplex_sav < 0 )
  1004.                         duplex_sav = duplex ;
  1005.                     duplex = FALSE ;
  1006.                     break;
  1007.                 case 'H':
  1008.                     if ( duplex_sav < 0 )
  1009.                         duplex_sav = duplex ;
  1010.                     duplex = TRUE ;
  1011.                     break;
  1012.                 }
  1013.                 break;
  1014.             }
  1015.             case 'E':
  1016.                 /* Inserts a row of spaces */
  1017.                 if ( debses )
  1018.                     break;
  1019.                 if ( ISTVI925(tt_type_mode) ||
  1020.                      ISTVI950(tt_type_mode) ) {
  1021.                     if ( !protect )
  1022.                         VscrnScroll(VTERM, DOWNWARD, wherey[VTERM] - 1,
  1023.                                      marginbot - 1, 1, FALSE, SP);
  1024.                 }
  1025.                 break;
  1026.             case 'F':
  1027.                 if ( debses )
  1028.                     break;
  1029.                 if ( ISTVI910(tt_type_mode) ) {
  1030.                     /* Display control character */
  1031.                     int n = tviinc() ;
  1032.                 }
  1033.                 else {
  1034.                     /* TVI 955 */
  1035.                     /* 0 - Attributes occupy a space */
  1036.                     /* 1 - Attributes do not occupy a space */
  1037.                     int n = tviinc() ;
  1038.                     switch ( n ) {
  1039.                     case '0':
  1040.                         tt_hidattr = FALSE ;
  1041.                         break;
  1042.                     case '1':
  1043.                         tt_hidattr = TRUE ;
  1044.                         break;
  1045.                     default:
  1046.                         break;
  1047.                     }
  1048.                 }
  1049.                 break;
  1050.             case 'G': {
  1051.                 /* Sets a video attribute within the application display  */
  1052.                 /* area.  The attribute occupies a space.  This has a     */
  1053.                 /* multiple code sequence of:   ESC G ATTR where:         */
  1054.                 /*    ATTR = attribute code.                              */
  1055.                 /*
  1056.                 950: Designating an embedded attribute when the cursor
  1057.                 is in a protected field changes the attribute at the cursor
  1058.                 position and destroys the character in that position.
  1059.  
  1060.                 955: Designating an embedded attribute when the cursor
  1061.                 is in a protected field moves the cursor to the next
  1062.                 unprotected position and then changes the attribute.
  1063.                 */
  1064.  
  1065.                 int n = tviinc() ;
  1066.  
  1067.                 if ( debses )
  1068.                     break;
  1069.                 switch ( n ) {
  1070.                 case SP:
  1071.                     wrtch(SP) ;
  1072.                     break;
  1073.                 case '0':
  1074.                 case '1':
  1075.                 case '2':
  1076.                 case '3':
  1077.                 case '4':
  1078.                 case '5':
  1079.                 case '6':
  1080.                 case '7':
  1081.                 case '8':
  1082.                 case '9':
  1083.                 case ':':
  1084.                 case ';':
  1085.                 case '<':
  1086.                 case '=':
  1087.                 case '>':
  1088.                 case '?':
  1089.                 case 'p':
  1090.                 case 'q':
  1091.                 case 'r':
  1092.                 case 's':
  1093.                 case 't':
  1094.                 case 'u':
  1095.                 case 'v':
  1096.                 case 'w':
  1097.                 case 'x':
  1098.                 case 'y':
  1099.                 case 'z':
  1100.                 case '{':
  1101.                 case '|':
  1102.                 case '}':
  1103.                 case '~':{
  1104.                     attr = wysecharattr( n ) ;
  1105.                     if ( attrmode == ATTR_PAGE_MODE ) {
  1106.                         int x = wherex[VTERM];
  1107.                         int y = wherey[VTERM];
  1108.                         if ( !tt_hidattr )
  1109.                             wrtch(tt_sac) ;
  1110.                         ApplyPageAttribute( VTERM, x, y, attr ) ;
  1111.                     }
  1112.                     else if ( attrmode == ATTR_LINE_MODE ) {
  1113.                         int x = wherex[VTERM];
  1114.                         int y = wherey[VTERM];
  1115.                         if ( !tt_hidattr )
  1116.                             wrtch(tt_sac) ;
  1117.                         ApplyLineAttribute( VTERM, x, y, attr ) ;
  1118.                     }
  1119.                     else        /* Character Mode */
  1120.                         attrib = attr ;
  1121.                 }
  1122.                 }
  1123.                 break;
  1124.             }
  1125.             case 'H': {
  1126.                 if ( ISTVI910(tt_type_mode) ) {
  1127.                     /* Auto scroll on/off */
  1128.                     ;
  1129.                 }
  1130.                 else /* if ( ISTVI925(tt_type_mode) ) */ {
  1131.                     /* Draw a box - 955 feature */
  1132.                     int w,h;
  1133.                     w = tviinc();
  1134.                     if ( w == '~' ) {
  1135.                         w = tviinc() - 31 + 80;
  1136.                         h = tviinc() - 31 ;
  1137.                     }
  1138.                     else {
  1139.                         w -= 31 ;
  1140.                         h = tviinc() - 31;
  1141.                     }
  1142.                     if ( debses )
  1143.                         break;
  1144.                     boxrect_escape( VTERM, wherey[VTERM]+h,
  1145.                                     wherex[VTERM]+w ) ;
  1146.                 }
  1147.                 break;
  1148.             }
  1149.             case 'I':
  1150.                 /* Moves the cursor left to the previous tab stop */
  1151.                 if ( debses )
  1152.                     break;
  1153.                 wyse_backtab();
  1154.                 break;
  1155.             case 'J':
  1156.                 /* Display previous page */
  1157.                 break;
  1158.             case 'K':
  1159.                 /* Display next page */
  1160.                 break;
  1161.             case 'L':
  1162.                 /* Sends all characters unformatted to the auxiliary port. */
  1163.                 /* Attribute codes are sent as spaces.  Row-end            */
  1164.                 /* sequences are not sent.                                 */
  1165.                 /* TVI950  */
  1166.                 break;
  1167.             case 'M':
  1168.                 if ( debses )
  1169.                     break;
  1170.                 if ( ISTVI910(tt_type_mode) ) {
  1171.                     /* Send current cursor character to the host */
  1172.                     break;
  1173.                 }
  1174.                 else {
  1175.                     /* Reports the terminal identification to the */
  1176.                     /* Host computer */
  1177.                     sendchars( tt_info[tt_type].x_id,
  1178.                                strlen(tt_info[tt_type].x_id) ) ;
  1179.                     /* 955 sends "955 R.0,m\r" in 955 mode */
  1180.                     /* and "R.0,m\r" when in 950 mode.     */
  1181.                 }
  1182.                 break;
  1183.             case 'N':
  1184.                 /* TVI950 - Page edit mode on */
  1185.                 break;
  1186.             case 'O':
  1187.                 /* TVI950 - Page edit mode off (default) */
  1188.                 break;
  1189.             case 'P':
  1190.                 /* Sends all protected and unprotected characters to the  */
  1191.                 /* auxiliary port, regardless of the mode setting.        */
  1192.                 /* Send ACK when done */
  1193.                 /* 925, 950 */
  1194.                 /* 914, 924 use an extra parameter to choose various modes */
  1195.                 if ( debses )
  1196.                     break;
  1197.  
  1198.                 if ( ISTVI925(tt_type_mode) || ISTVI950(tt_type_mode) ) {
  1199.                     int x;
  1200.                     x = xprintff; xprintff = 0; /*   Print/Dump current screen */
  1201.                     prtscreen(VTERM,1,VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0));
  1202.                     xprintff = x;
  1203.                     ttoc(ACK);
  1204.                 }
  1205.                 break;
  1206.             case 'Q':
  1207.                 /* Inserts a space. */
  1208.                 if ( debses )
  1209.                     break;
  1210.                 if ( ISTVI925(tt_type_mode) ||
  1211.                      ISTVI950(tt_type_mode) ) {
  1212.                     blankvcell.c = SP;
  1213.                     blankvcell.a = geterasecolor(VTERM);
  1214.                     VscrnScrollRt(VTERM, wherey[VTERM] - 1,
  1215.                                wherex[VTERM] - 1, wherey[VTERM] - 1,
  1216.                                VscrnGetWidth(VTERM) - 1, 1, blankvcell);
  1217.                 }
  1218.                 break;
  1219.             case 'R':
  1220.                 /* Deletes a row. */
  1221.                 if ( debses )
  1222.                     break;
  1223.                 if ( (ISTVI925(tt_type_mode) ||
  1224.                      ISTVI950(tt_type_mode)) &&
  1225.                      !protect ) {
  1226.                     VscrnScroll(VTERM,
  1227.                              UPWARD,
  1228.                              wherey[VTERM] - 1,
  1229.                              marginbot - 1,
  1230.                              1,
  1231.                              FALSE,
  1232.                              SP);
  1233.                 }
  1234.                 break;
  1235.             case 'S': {
  1236.                 /* TVI950 - Sends a message unprotected */
  1237.                 /* FIX THIS --- this is code from Wyse, modify for TVI */
  1238.                 if ( ISTVI950(tt_type_mode) ) {
  1239.                     int x,y,ch,
  1240.                     w=VscrnGetWidth(VTERM),
  1241.                     h=VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0),
  1242.                     xs=-1,
  1243.                     ys=-1,
  1244.                     xe=w-1,
  1245.                     ye=h-1,
  1246.                     curx=0,
  1247.                     cury=0,
  1248.                     fs=1 ;
  1249.  
  1250.                     debug(F110,"TVI Escape","Send a message unprotected",0);
  1251.                     if ( debses )
  1252.                         break;
  1253.  
  1254.                     /* First figure out if we have markers, STX then ETX */
  1255.                     for ( y=0;y<h;y++ )
  1256.                         for ( x=0;x<w;x++ ) {
  1257.                             ch = VscrnGetCell( VTERM, x, y )->c ;
  1258.                             if ( ch == STX && xs < 0 && ys < 0 ) {
  1259.                                 xs = x+1 ;
  1260.                                 ys = y ;
  1261.                             }
  1262.                             else if ( ch == ETX && xs >= 0 && ys >= 0 ) {
  1263.                                 curx = xe = x-1 ;
  1264.                                 cury = ye = y ;
  1265.                                 break;
  1266.                             }
  1267.                         }
  1268.                     if ( xs < 0 || ys < 0 ) {
  1269.                         xs = 0 ;
  1270.                         ys = 0 ;
  1271.                     }
  1272.  
  1273.                     /* Now send the data */
  1274.                     for ( y=ys;y<=ye; y++ ) {
  1275.                         for ( x=(y==ys)?xs:0 ; x <= (y==ye?xe:w-1) ; x++ )
  1276.                             if ( !VscrnGetVtCharAttr(VTERM, x, y).unerasable ) {
  1277.                                 ch = VscrnGetCell( VTERM, x, y )->c;
  1278.                                 if ( ch || !wy_nullsuppress ) {
  1279.                                     if ( tt_senddata ) {
  1280.                                         unsigned char * bytes;
  1281.                                         int nbytes;
  1282.                                         if ( isunicode() )
  1283.                                             nbytes = utorxlat(ch,&bytes);
  1284.                                         else
  1285.                                             nbytes = utorxlat(ch,&bytes);
  1286.                                         while ( nbytes-- > 0 )
  1287.                                             sendchar(*bytes++) ;
  1288.                                     } else
  1289.                                         sendchar(SP);
  1290.                                 }
  1291.                                 fs = 0 ;
  1292.                             }
  1293.                             else if ( !fs ) {
  1294.                                 /* Send field delimeter */
  1295.                                 if ( tvi_send_field[0] )
  1296.                                     sendchars(tvi_send_field,strlen(tvi_send_field));
  1297.                                 fs = 1 ;
  1298.                             }
  1299.                         if ( y < ye ) {
  1300.                             /* Send End of Line delimeter */
  1301.                             if ( tvi_send_field[0] )
  1302.                                 sendchars(tvi_send_line,strlen(tvi_send_line));
  1303.                         }
  1304.                     }
  1305.                     /* Send End of Text delimeter */
  1306.                     if ( tvi_send_end_of_text[0] )
  1307.                         sendchars(tvi_send_end_of_text,strlen(tvi_send_end_of_text));
  1308.  
  1309.                     lgotoxy(VTERM,curx+1,cury+1);   /* Reposition cursor */
  1310.                 }
  1311. #ifdef COMMENT
  1312.                 else if ( ISTVI924() ) {
  1313.                     int n = tviinc();
  1314.                     if ( debses || !tt_senddata )
  1315.                         break;
  1316.                     switch ( n ) {
  1317.                     case '1':
  1318.                     case '2':
  1319.                     case '3':
  1320.                     case '5':
  1321.                     case '6':
  1322.                     case '7':
  1323.                     case '9':
  1324.                     case ':':
  1325.                     case ';':
  1326.                     case '?':
  1327.                         ;
  1328.                     }
  1329.                 }
  1330. #endif /* COMMENT */
  1331.                 break;
  1332.             }
  1333.             case 'T':
  1334.                 /* clrtoeol with insert character */
  1335.                 if ( debses )
  1336.                     break;
  1337.                 selclrtoeoln( VTERM, tvi_ic );
  1338.                 break;
  1339.             case 'U':
  1340.                 /* Turns the monitor submode on */
  1341.                 if ( debses || wy_monitor )
  1342.                     break;
  1343.                 setdebses(TRUE);
  1344.                 wy_monitor = TRUE ;
  1345.                 break;
  1346.             case 'V':
  1347.                 if ( debses )
  1348.                     break;
  1349.                     /* Start self test */
  1350.                     ;
  1351. #ifdef COMMENT
  1352.                 /* This code is from the Wyse terminals documentation   */
  1353.                 /* But it appears to be completely wrong.  The sequence */
  1354.                 /* appears in the EFS, Inc. logs, but I can't figure    */
  1355.                 /* out what it is supposed to do.                       */
  1356.  
  1357.                 /* According to the Televideo 955 manual, this sequence */
  1358.                 /* is defined as start self-test for all TVI teminals.  */
  1359.                 else
  1360.                 {
  1361.                     /* Clear cursor column */
  1362.                     viocell cell = {SP,geterasecolor(VTERM)};
  1363.                     int ys = VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0);
  1364.                     vtattrib vta = attrib;
  1365.                     x  = wherex[VTERM]-1 ;
  1366.                     vta.unerasable = TRUE ;
  1367.                     for ( y=wherey[VTERM]-1 ; y<ys ; y++ )
  1368.                         VscrnWrtCell( VTERM, cell, vta, y, x ) ;
  1369.                     cursorright(0);
  1370.                 }
  1371. #endif /* COMMENT */
  1372.                 break;
  1373.             case 'W':
  1374.                 /* Deletes a character */
  1375.                 if ( debses )
  1376.                     break;
  1377.                 if ( ISTVI925(tt_type_mode) ||
  1378.                      ISTVI950(tt_type_mode) ) {
  1379.                     blankvcell.c = SP;
  1380.                     blankvcell.a = geterasecolor(VTERM);
  1381.                     VscrnScrollLf(VTERM, wherey[VTERM] - 1,
  1382.                                wherex[VTERM] - 1,
  1383.                                wherey[VTERM] - 1,
  1384.                                VscrnGetWidth(VTERM) - 1,
  1385.                                1, blankvcell) ;
  1386.                 }
  1387.                 break;
  1388.             case 'X':
  1389.                 /* Turns the monitor submode off */
  1390.                 if ( !wy_monitor )
  1391.                     break;
  1392.                 setdebses(FALSE);
  1393.                 wy_monitor = FALSE ;
  1394.                 break;
  1395.             case 'Y':
  1396.                 if ( debses )
  1397.                     break;
  1398.                 {
  1399.                     /* clear unprotected page to space characters */
  1400.                     /* from cursor */
  1401.                     if ( ISTVI950(tt_type_mode) )
  1402.                         selclreoscr_escape( VTERM, tvi_ic ) ;
  1403.                     else {
  1404.                         clreoscr_escape( VTERM, tvi_ic ) ;
  1405.                     }
  1406.                 }
  1407.                 break;
  1408.             case 'Z': {
  1409.                 /* When n = 0, transmit user line to host */
  1410.                 /* When n = 1, transmit status line to host */
  1411.                 /* 950 */
  1412.                 int n = tviinc() ;
  1413.  
  1414.                 /* The EFS logs contain a sequence ESC Z b 3       */
  1415.                 /* which results in the '3' being printed to the   */
  1416.                 /* screen in our emulation but not in the Wyse 60  */
  1417.                 /* tvi emulations.                                 */
  1418.                 /* It also has ESC Z @ 0 and ESC Z @ 1 so I think  */
  1419.                 /* the 925 has an extended family of commands here */
  1420.                 switch ( n ) {
  1421.                 case 0: /* Transmit User line to host */
  1422.                     if ( ISTVI950(tt_type_mode) )
  1423.                         ;
  1424.                     break;
  1425.                 case 1: /* Transmit Status line to host */
  1426.                     if ( ISTVI950(tt_type_mode) )
  1427.                         ;
  1428.                     break;
  1429.                 case '@': {     /* Change width? */
  1430.                     /* This is not defined for any TVI terminal according  */
  1431.                     /* to the TVI 965 manual Appendix C.  However, we will */
  1432.                     /* leave it in until someone tells us that it gets in  */
  1433.                     /* the way.                                            */
  1434.                     int m = tviinc() ;
  1435.                     switch ( m ) {
  1436.                     case '0':   /* 80 cols; turn off write protect ?? */
  1437.                         /* writeprotect = FALSE ; */
  1438.                         RequestScreenMutex(SEM_INDEFINITE_WAIT);
  1439.                         killcursor(VTERM);
  1440.                         Set80Cols(VTERM);
  1441. #ifdef TCPSOCKET
  1442. #ifdef CK_NAWS
  1443.                         if (ttmdm < 0 && TELOPT_ME(TELOPT_NAWS)) {
  1444.                             tn_snaws();
  1445. #ifdef RLOGCODE
  1446.                             rlog_naws();
  1447. #endif /* RLOGCODE */
  1448. #ifdef SSHBUILTIN
  1449.                             ssh_snaws();
  1450. #endif /* SSHBUILTIN */
  1451.                         }
  1452. #endif /* CK_NAWS */
  1453. #endif /* TCPSOCKET */
  1454.                         setborder();
  1455.                         newcursor(VTERM);
  1456.                         ipadl25();
  1457.                         ReleaseScreenMutex();
  1458.                     break;
  1459.                     case '1':   /* 132 cols; turn off write protect ?? */
  1460.                         /* writeprotect = FALSE ; */
  1461.                         RequestScreenMutex(SEM_INDEFINITE_WAIT);
  1462.                         killcursor(VTERM);
  1463.                         Set132Cols(VTERM);
  1464. #ifdef TCPSOCKET
  1465. #ifdef CK_NAWS
  1466.                         if (ttmdm < 0 && TELOPT_ME(TELOPT_NAWS)) {
  1467.                             tn_snaws();
  1468. #ifdef RLOGCODE
  1469.                             rlog_naws();
  1470. #endif /* RLOGCODE */
  1471. #ifdef SSHBUILTIN
  1472.                             ssh_snaws();
  1473. #endif /* SSHBUILTIN */
  1474.                         }
  1475. #endif /* CK_NAWS */
  1476. #endif /* TCPSOCKET */
  1477.                         setborder();
  1478.                         newcursor(VTERM);
  1479.                         ipadl25();
  1480.                         ReleaseScreenMutex();
  1481.                         break;
  1482.                     }
  1483.                     break;
  1484.                 }
  1485. #ifdef COMMENT
  1486.                 case 'b': /* Have no idea */
  1487.                     /* This case comes from the EFS, Inc. logs but is not  */
  1488.                     /* defined for any Televideo terminal according to the */
  1489.                     /* TVI 965 manual Appendix C.                          */
  1490.                     if ( ISTVI925(tt_type_mode) )
  1491.                         n == tviinc() ;
  1492.                     break;
  1493. #endif /* COMMENT */
  1494.                 }
  1495.                 break;
  1496.             }
  1497.             case '[':
  1498.                 if ( ISTVI950(tt_type_mode) ) {
  1499.                     /* TVI950 - Address cursor to row */
  1500.                     int row = tviinc() ;
  1501.  
  1502.                     if ( debses )
  1503.                         break;
  1504.                     lgotoxy(VTERM,wherex[VTERM],row-31);
  1505.                 }
  1506.                 else {
  1507.                     /* 955 - Command sequence introducer (ANSI format) */
  1508.                     ;
  1509.                 }
  1510.                 break;
  1511.             case '\\': {
  1512.                 /* Set page size */
  1513.                 int n = tviinc() ;
  1514.                 switch ( n ) {
  1515.                 case '1':
  1516.                     /* 24 lines */
  1517.                     break;
  1518.                 case '2':
  1519.                     /* 48 lines */
  1520.                     break;
  1521.                 case '3':
  1522.                     /* 96 lines */
  1523.                     break;
  1524.                 }
  1525.                 break;
  1526.             }
  1527.             case ']':
  1528.                 if ( ISTVI950(tt_type_mode) ) {
  1529.                     /* TVI950 - Address cursor to column */
  1530.                     int col = tviinc() ;
  1531.  
  1532.                     if ( debses )
  1533.                         break;
  1534.                     lgotoxy(VTERM,col-31,wherey[VTERM]);
  1535.                 }
  1536.                 else {
  1537.                     /* 955 - Reprogram all editing keys */
  1538.                     ;
  1539.                 }
  1540.                 break;
  1541.             case '^': {
  1542.                 char msg[17];
  1543.                 int  ch2, n=0 ;
  1544.                 ch2 = tviinc() ;
  1545.  
  1546.                 switch ( ch2 ) {
  1547.                 case '0':
  1548.                     if (tt_answer)
  1549.                         sendchars(answerback,strlen(answerback)) ;
  1550.                     break;
  1551.                 case '1': {
  1552.                     /* Program the Answerback message (not allowed) */
  1553.                     for ( n=0; n<16 ; n++ ) {
  1554.                         msg[n] = tviinc() ;
  1555.                         if ( msg[n] == DLE ) { /* Quote next */
  1556.                             msg[n] = tviinc() ;
  1557.                         }
  1558.                         if ( msg[n] == XEM ) {
  1559.                             msg[n] = NUL ;
  1560.                             break;
  1561.                         }
  1562.                     }
  1563.                     break;
  1564.                 }
  1565.                 }
  1566.             }
  1567.             case '_':
  1568.                 break;
  1569.             case '`': {
  1570.                 /* Transparent print on */
  1571.                 if ( debses )
  1572.                     break;
  1573.                 xprint = TRUE ;
  1574.                 if ( !printon )
  1575.                     printeron() ;
  1576.                 break;
  1577.             }
  1578.             case 'a':
  1579.                 /* Turn transparent print mode off */
  1580.                 if ( debses )
  1581.                     break;
  1582.                 xprint = FALSE ;
  1583.                 if ( !cprint && !uprint && !xprint && !aprint && printon )
  1584.                     printeroff();
  1585.                 break;
  1586.             case 'b':
  1587.                 /* Reverse Background */
  1588.                 if ( debses )
  1589.                     break;
  1590.                 if (decscnm) /* Already reverse */
  1591.                     break;
  1592.                 else {
  1593.                     flipscreen(VTERM);
  1594.                     VscrnIsDirty(VTERM) ;
  1595.                 }
  1596.                 break;
  1597.             case 'c':
  1598.                 /* TVI925,TVI910+ - Block mode on */
  1599.                 /* TVI950         - Set Local Mode */
  1600.                 break;
  1601.             case 'd':
  1602.                 /* Normal background */
  1603.                 if ( debses )
  1604.                     break;
  1605.                 if (!decscnm) /* Already normal? */
  1606.                     break;
  1607.                 else {
  1608.                     flipscreen(VTERM);
  1609.                     VscrnIsDirty(VTERM);
  1610.                 }
  1611.                 break;
  1612.             case 'e':
  1613.                 if ( debses )
  1614.                     break;
  1615.                 if ( ISTVI950(tt_type_mode) ) {
  1616.                     int n = tviinc() ;
  1617.                     tvi_ic = n ;
  1618.                 }
  1619.                 break;
  1620.             case 'f': {
  1621.                 /* TVI 925 */
  1622.                 /* TVI 950 */
  1623.                 /* Load user line with upto 80 characters */
  1624.                 int i=0,
  1625.                 w = VscrnGetWidth(VTERM);
  1626.  
  1627.                 if ( ISTVI925(tt_type_mode) ||
  1628.                      ISTVI950(tt_type_mode) ) {
  1629.                     if (debses) {
  1630.                         while ( i < w &&
  1631.                                 tviinc() != CR ) {
  1632.                             i++;
  1633.                         }
  1634.                     }
  1635.                     else {
  1636.                         while ( i < w &&
  1637.                                 (tviuserline[i]=tviinc()) != CR ) {
  1638.                             i++;
  1639.                         }
  1640.                         while ( i < MAXTERMCOL )
  1641.                             tviuserline[i++] = SP ;
  1642.                         tviuserline[i]=NUL ;
  1643.                         if ( decssdt == SSDT_HOST_WRITABLE ) {
  1644.                             VscrnSetWidth(VSTATUS,VscrnGetWidth(VTERM));
  1645.                             VscrnWrtCharStrAtt( VSTATUS, tviuserline, strlen(tviuserline),
  1646.                                                 1, 1, &colorstatus ) ;
  1647.                         }
  1648.                     }
  1649.                 }
  1650.                 break;
  1651.             }
  1652.             case 'g':
  1653.                 if ( debses )
  1654.                     break;
  1655.                 /* 925/950 - Turn on user line on line 25 */
  1656.                 if ( ISTVI925(tt_type_mode) || ISTVI950(tt_type_mode) ) {
  1657.                     setdecssdt(SSDT_HOST_WRITABLE);
  1658.                     VscrnSetWidth(VSTATUS,VscrnGetWidth(VTERM));
  1659.                     VscrnWrtCharStrAtt( VSTATUS, tviuserline, strlen(tviuserline),
  1660.                                         1, 1, &colorstatus ) ;
  1661.                 }
  1662.                 break;
  1663.             case 'h':
  1664.                 if ( debses )
  1665.                     break;
  1666.                 /* 925/950 - Turn on status line on line 25 */
  1667.                 if ( ISTVI925(tt_type_mode) || ISTVI950(tt_type_mode) )
  1668.                     setdecssdt(SSDT_INDICATOR);
  1669.                 break;
  1670.             case 'i':
  1671.                 /* Moves the cursor to the next tab stop on the right.    */
  1672.                 /* Same as Horizontal Tab control character               */
  1673.                 wyse_tab();
  1674.                 break;
  1675.             case 'j':
  1676.                 /* Moves the cursor up one row and begins scrolling at    */
  1677.                 /* top row.                                               */
  1678.                 if ( debses )
  1679.                     break;
  1680.                 cursorup(0) ;
  1681.                 break;
  1682.             case 'k':
  1683.                 /* Turns the local edit submode on; duplex off */
  1684.                 /* Not the same as ECHO mode */
  1685.                 break;
  1686.             case 'l':
  1687.                 /* Turns the duplex edit submode on; local off */
  1688.                 /* Not the same as ECHO mode */
  1689.                 break;
  1690.             case 'm':
  1691.                 /* 955 - Enable optional graphics firmware */
  1692.                 break;
  1693.             case 'n':
  1694.                 /* Turn on screen display */
  1695.                 if ( debses )
  1696.                     break;
  1697.                 screenon = TRUE ;
  1698.                 break;
  1699.             case 'o':
  1700.                 /* Turn off screen display */
  1701.                 if ( debses )
  1702.                     break;
  1703.                 screenon = FALSE ;
  1704.                 break;
  1705.             case 'p':
  1706.                 /* 955 - Ps define the page print terminator */
  1707.                 break;
  1708.             case 'q':
  1709.                 /* TVI950 - Turns the insert submode on; replace off */
  1710.                 if ( debses )
  1711.                     break;
  1712.                 if ( ISTVI950(tt_type_mode) )
  1713.                     insertmode = TRUE ;
  1714.                 break;
  1715.             case 'r':
  1716.                 /* TVI950 - Turns the insert submode off; replace on */
  1717.                 if ( debses )
  1718.                     break;
  1719.                 if ( ISTVI950(tt_type_mode) )
  1720.                     insertmode = FALSE ;
  1721.                 break;
  1722.             case 's': {
  1723.                 /* TVI950 - Sends a message (entire block) */
  1724.                 if ( ISTVI950(tt_type_mode) ) {
  1725.                     int x,y,ch,
  1726.                     w=VscrnGetWidth(VTERM),
  1727.                     h=VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0),
  1728.                     xs=-1,
  1729.                     ys=-1,
  1730.                     xe=w-1,
  1731.                     ye=h-1,
  1732.                     curx=0,
  1733.                     cury=0,
  1734.                     fs=0 ;
  1735.  
  1736.                     debug(F110,"TVI Escape","Send a message (entire block)",0);
  1737.                     if ( debses )
  1738.                         break;
  1739.  
  1740.                     /* First figure out if we have markers, STX then ETX */
  1741.                     for ( y=0;y<h;y++ )
  1742.                         for ( x=0;x<w;x++ ) {
  1743.                             ch = VscrnGetCell( VTERM, x, y )->c ;
  1744.                             if ( ch == STX && xs < 0 && ys < 0 ) {
  1745.                                 xs = x+1 ;
  1746.                                 ys = y ;
  1747.                             }
  1748.                             else if ( ch == ETX && xs >= 0 && ys >= 0 ) {
  1749.                                 curx = xe = x-1 ;
  1750.                                 cury = ye = y ;
  1751.                                 break;
  1752.                             }
  1753.                         }
  1754.                     if ( xs < 0 || ys < 0 ) {
  1755.                         xs = 0 ;
  1756.                         ys = 0 ;
  1757.                     }
  1758.  
  1759.                     /* Now send the data */
  1760.                     for ( y=ys;y<=ye; y++ ) {
  1761.                         for ( x=(y==ys)?xs:0 ; x <= (y==ye?xe:w-1) ; x++ ) {
  1762.                             if ( !VscrnGetVtCharAttr(VTERM, x, y).unerasable ) {
  1763.                                 if ( fs ) {
  1764.                                     if ( tvi_send_end_protected_field[0] )
  1765.                                         sendchars(tvi_send_end_protected_field,
  1766.                                                    strlen(tvi_send_end_protected_field));
  1767.                                     fs = 0;
  1768.                                 }
  1769.                             }
  1770.                             else if ( !fs ) {
  1771.                                 if ( tvi_send_start_protected_field[0] )
  1772.                                     sendchars(tvi_send_start_protected_field,
  1773.                                                strlen(tvi_send_start_protected_field));
  1774.                                 fs = 1 ;
  1775.                             }
  1776.                             ch = VscrnGetCell( VTERM, x, y )->c;
  1777.                             if ( ch || !wy_nullsuppress ) {
  1778.                                 if ( tt_senddata ) {
  1779.                                     unsigned char * bytes;
  1780.                                     int nbytes;
  1781.                                     if ( isunicode() )
  1782.                                         nbytes = utorxlat(ch,&bytes);
  1783.                                     else
  1784.                                         nbytes = utorxlat(ch,&bytes);
  1785.                                     while ( nbytes-- > 0 )
  1786.                                         sendchar(*bytes++) ;
  1787.                                 } else
  1788.                                     sendchar(SP);
  1789.                             }
  1790.                         }
  1791.                         if ( y < ye ) {
  1792.                             /* Send End of Line delimeter */
  1793.                             if ( tvi_send_field[0] )
  1794.                                 sendchars(tvi_send_line,strlen(tvi_send_line));
  1795.                         }
  1796.                     }
  1797.                     /* Send End of Text delimeter */
  1798.                     if ( tvi_send_end_of_text[0] )
  1799.                         sendchars(tvi_send_end_of_text,strlen(tvi_send_end_of_text));
  1800.  
  1801.                     lgotoxy(VTERM,curx+1,cury+1);   /* Reposition cursor */
  1802.                 }
  1803. #ifdef COMMENT
  1804.                 else if ( ISTVI924 ) {
  1805.                     int n = tviinc();
  1806.                     if ( debses || !tt_senddata )
  1807.                         break;
  1808.                     switch ( n ) {
  1809.                     case '1':
  1810.                     case '2':
  1811.                     case '3':
  1812.                     case '5':
  1813.                     case '6':
  1814.                     case '7':
  1815.                     case '9':
  1816.                     case ':':
  1817.                     case ';':
  1818.                     case '?':
  1819.                         ;
  1820.                     }
  1821.                 }
  1822. #endif /* COMMENT */
  1823.                 break;
  1824.             }
  1825.             case 't':
  1826.                 /* Erases all (unprotected) characters from the current   */
  1827.                 /* cursor location to the end of the row and replaces     */
  1828.                 /* them with nulls.                                       */
  1829.                 if ( debses )
  1830.                     break;
  1831.                 if ( protect )
  1832.                     selclrtoeoln( VTERM, NUL ) ;
  1833.                 else
  1834.                     clrtoeoln( VTERM, NUL );
  1835.                 break;
  1836.             case 'u':
  1837.                 /* Turns the monitor submode off.                         */
  1838.                 if ( !wy_monitor )
  1839.                     break;
  1840.                 setdebses(FALSE);
  1841.                 wy_monitor = FALSE ;
  1842.                 break;
  1843.             case 'v':
  1844.                 /* Turn on autopage mode */
  1845.                 if ( debses )
  1846.                     break;
  1847.                 wy_autopage = TRUE ;
  1848.                 break;
  1849.             case 'w':
  1850.                 /* Turn off autopage mode */
  1851.                 if ( debses )
  1852.                     break;
  1853.                 wy_autopage = FALSE ;
  1854.                 break;
  1855.             case 'x': {
  1856.                 /* TVI950 - Define SEND delimiters (12-33) */
  1857.                 /* ESC x Dlmtr Char1 Char2            */
  1858.                 int n, p1, p2 ;
  1859.                 if ((n = tviinc()) < 0)
  1860.                     break;
  1861.                 if ((p1 = tviinc()) < 0 )
  1862.                     break;
  1863.                 if ((p2 = tviinc()) < 0)
  1864.                     break;
  1865.                 if ( debses )
  1866.                     break;
  1867.                 switch ( n ) {
  1868.                 case '0':
  1869.                     tvi_send_field[0] = (CHAR)(p1 & 0xFF);
  1870.                     tvi_send_field[1] = (CHAR)(p2 & 0xFF);
  1871.                     break;
  1872.                 case '1':
  1873.                     tvi_send_line[0] = (CHAR)(p1 & 0xFF);
  1874.                     tvi_send_line[1] = (CHAR)(p2 & 0xFF);
  1875.                     break;
  1876.                 case '2':
  1877.                     tvi_send_start_protected_field[0] = (CHAR)(p1 & 0xFF);
  1878.                     tvi_send_start_protected_field[1] = (CHAR)(p2 & 0xFF);
  1879.                     break;
  1880.                 case '3':
  1881.                     tvi_send_end_protected_field[0] = (CHAR)(p1 & 0xFF);
  1882.                     tvi_send_end_protected_field[1] = (CHAR)(p2 & 0xFF);
  1883.                     break;
  1884.                 case '4':
  1885.                     tvi_send_end_of_text[0] = (CHAR)(p1 & 0xFF);
  1886.                     tvi_send_end_of_text[1] = (CHAR)(p2 & 0xFF);
  1887.                     break;
  1888.                 }
  1889.                 break;
  1890.             }
  1891.             case 'y':
  1892.                 /* Erases all characters from the current cursor location   */
  1893.                 /* to the end of the active segment and replaces them with  */
  1894.                 /* nulls. (unprotected)                                     */
  1895.                 if ( debses )
  1896.                     break;
  1897.                 if ( ISTVI950(tt_type_mode) && protect )
  1898.                     selclreoscr_escape( VTERM, NUL ) ;
  1899.                 else
  1900.                     clreoscr_escape( VTERM, NUL ) ;
  1901.                 break;
  1902.             case 'z':
  1903.                 /* 950 - Execute User PROM program */
  1904.                 break;
  1905.             case '{': {
  1906.                 /* TVI950 - Set Comm1 parameters */
  1907.                 /* Baud Stop Parity Word */
  1908.                 int baud, stop, parity, word ;
  1909.                 baud = tviinc() ;
  1910.                 stop = tviinc() ;
  1911.                 parity = tviinc() ;
  1912.                 word = tviinc() ;
  1913.                 if ( debses )
  1914.                     break;
  1915.                 break;
  1916.             }
  1917.             case '|': {
  1918.                 /* TVI 950 */
  1919.                 /* ESC | key dir sequence Ctrl-Y =            */
  1920.                 /*    Program key direction and definition    */
  1921.                 /* The 955 uses different values for <key>    */
  1922.                 /* in 955 and 950 modes.                      */
  1923.                 char keydef[256] = "" ;
  1924.                 int key = tviinc() ;
  1925.                 int dir = tviinc() ;
  1926.                 int i = 0 ;
  1927.                 int ctrlp = 0 ;
  1928.  
  1929.                 while ( (keydef[i]=tviinc()) != XEM && !ctrlp )
  1930.                     if ( keydef[i] != DLE || ctrlp ) {
  1931.                         i++;
  1932.                         ctrlp = 0 ;
  1933.                     }
  1934.                     else {
  1935.                         ctrlp = 1 ;
  1936.                     }
  1937.                 keydef[i] = NUL ;
  1938.  
  1939.                 if ( debses )
  1940.                         break;
  1941.                 /* we only allow redefinition of function keys */
  1942.                 if ( key >= '1' && key <= ';' ) {
  1943.                     if ( udkfkeys[key-'1'] ) {
  1944.                         free( udkfkeys[key-'1'] ) ;
  1945.                         udkfkeys[key-'1']=NULL;
  1946.                     }
  1947.                     if ( strlen(keydef) )
  1948.                         udkfkeys[key-'1'] = strdup( keydef ) ;
  1949.                 }
  1950.                 else if ( key >= '<' && key <= 'F' ) {
  1951.                     if ( udkfkeys[key-'<'+16] ) {
  1952.                         free( udkfkeys[key-'<'+16] ) ;
  1953.                         udkfkeys[key-'<'+16]=NULL;
  1954.                     }
  1955.                     if ( strlen(keydef) )
  1956.                         udkfkeys[key-'<'+16] = strdup( keydef ) ;
  1957.                 }
  1958.                 break;
  1959.             }
  1960.             case '}': {
  1961.                 /* TVI950 - Set Comm2 parameters */
  1962.                 /* Baud Stop Parity Word */
  1963.                 int baud, stop, parity, word ;
  1964.                 baud = tviinc() ;
  1965.                 stop = tviinc() ;
  1966.                 parity = tviinc() ;
  1967.                 word = tviinc() ;
  1968.                 if ( debses )
  1969.                     break;
  1970.                 break;
  1971.             }
  1972.             case '~': {
  1973.                 int n = tviinc() ;
  1974.                 if ( debses )
  1975.                     break;
  1976.                 switch ( n ) {
  1977.                 case '0':
  1978.                     /* 955 - Reset terminal to factory defaults */
  1979.                     break;
  1980.                 case '1':
  1981.                     /* 955 - Reset terminal to non-volatile memory defaults */
  1982.                     break;
  1983.                 case '2':
  1984.                     /* 955 - Reset function keys to factory defaults */
  1985.                     break;
  1986.                 case '3':
  1987.                     /* 955 - Reset editing keys to factory defaults */
  1988.                     break;
  1989.                 }
  1990.             }
  1991.                 break;
  1992.             case DEL:
  1993.                 break;
  1994.             }
  1995.             }
  1996.             else { /* xprint */
  1997.                 switch ( ch ) {
  1998.                 case 'a':
  1999.                     /* Turn transparent print mode off */
  2000.                     if ( debses )
  2001.                         break;
  2002.                     xprint = FALSE ;
  2003.                     if ( !cprint && !uprint && !xprint && !aprint && printon )
  2004.                         printeroff();
  2005.                     break;
  2006.                 }
  2007.             }
  2008.             escstate = ES_NORMAL ;      /* Done parsing escstate sequence */
  2009.         }
  2010.     }
  2011.     else                /* Handle as a normal character */
  2012.     {
  2013.         if ( ch < SP )
  2014.             tvictrl(ch) ;
  2015.         else if ( !debses && !xprint ) {
  2016.             if ( tvigraphics )
  2017.                 ch = xltvigrph( ch ) ;
  2018.  
  2019.             /* Display the character */
  2020.             if ( !tt_hidattr &&
  2021.                  (attrmode == ATTR_PAGE_MODE || attrmode == ATTR_LINE_MODE) ) {
  2022.                 vtattrib vta = VscrnGetVtCharAttr( VTERM, wherex[VTERM]-1, wherey[VTERM]-1 ) ;
  2023.                 if ( vta.wyseattr ) {
  2024.                     int x=wherex[VTERM]-1 ;
  2025.                     int y=wherey[VTERM]-1 ;
  2026.                     /* we are about to overwrite an attribute */
  2027.                     /* this results in the previous attribute being used for the entire */
  2028.                     /* this and subsequent cells */
  2029.                     vta.wyseattr = FALSE ;
  2030.                     VscrnSetVtCharAttr( VTERM, x, y, vta ) ;
  2031.  
  2032.                     /* now find previous attribute */
  2033.                     while ( !vta.wyseattr ) {
  2034.                         if ( --x < 0 ) {
  2035.                             if ( --y >= 0 )
  2036.                                 x = VscrnGetWidth(VTERM) ;
  2037.                             else {
  2038.                                 x = y = 0 ;
  2039.                                 break;  /* nowhere left to go */
  2040.                             }
  2041.                         }
  2042.                         vta = VscrnGetVtCharAttr( VTERM, x, y ) ;
  2043.                     }
  2044.  
  2045.                     if ( attrmode == ATTR_PAGE_MODE )
  2046.                         ApplyPageAttribute( VTERM, x+1, y+1, vta ) ;
  2047.                     else
  2048.                         ApplyLineAttribute( VTERM, x+1, y+1, vta ) ;
  2049.                 }
  2050.             }
  2051.             if ( ch != DEL )
  2052.                 wrtch(ch);
  2053.         }
  2054.     }
  2055.     VscrnIsDirty(VTERM) ;
  2056. }
  2057.  
  2058.  
  2059. #ifdef COMMENT
  2060. Article 3037 of comp.terminals:
  2061. Path: utkcs2!darwin.sura.net!europa.asd.contel.com!uunet!comp.vuw.ac.nz
  2062. !canterbury.ac.nz!phys169
  2063. From: phys169@csc.canterbury.ac.nz
  2064. Newsgroups: comp.terminals
  2065. Subject: Televideo control code table (was Re: TVI950)
  2066. Message-ID: <1992Apr23.112004.4789@csc.canterbury.ac.nz>
  2067. Date: 23 Apr 92 11:20:03 +1200
  2068. References: <1992Apr18.060736.29498@noose.ecn.purdue.edu>
  2069.             <1992Apr22.174647.4783@csc.canterbury.ac.nz>
  2070. Summary: Control codes/Escape sequences for TVI905 to TVI950
  2071. Keywords: Programming TVI950, TVI910, TVI912, TVI920, TVI914, TVI924, TVI925
  2072. Expires: 22 May 92 11:23:06 +1200
  2073. Organization: University of Canterbury, Christchurch, New Zealand
  2074. Lines: 224
  2075.  
  2076. In article <1992Apr22.174647.4783@csc.canterbury.ac.nz>,
  2077.  phys169@csc.canterbury.ac.nz writes:
  2078. >
  2079. > Hope the following is useful... NOTE that the 914/924 columns are NOT complete,
  2080. > they take a heck of a lot of typing, but there's probably enough there to get
  2081. > the magnitude of the difference.  I might follow up with a more complete table
  2082. > some day.
  2083.  
  2084. Well, there were a few mistakes in it (like ESC B), as well as the 914 & 924
  2085. columns not being finished.  Here's an updated version, but I don't have good
  2086. references for the TVI925 & 905, so if anyone can post corrections that would
  2087. be very nice.  The only Televideo source for the 925 I had was a little glossy
  2088. titled "The Value Leaders", which seems *very* wrong in places.
  2089.  
  2090. I still might follow with tables for other popular terminals, like the Wyse and
  2091. Qume and DG series.  The VT series has already been done by others, of course,
  2092. but I might post my collection (including differences betweem other ANSI
  2093. implementations, such as Heath/Zenith, TVI970 and Data General).
  2094.  
  2095. If anyone wants to cut out the following and stick it on some anonymous ftp
  2096. site, that is fine with me, but please keep my e-mail address on it so I can
  2097. be told of any errors or omissions.
  2098.  
  2099. *** CONTROL CODES FOR:          TVI950  910  912  920  914  924  925  905
  2100.  
  2101. ^E       ENQ (Send ID msg)                                   y
  2102. ^G       Beep                       y    y    y    y    y    y    y    y
  2103. ^H       Cursor Left                y    y    y    y    y    y    y    y
  2104. ^I       Tab                        y    y    y    y    y    y    y    y
  2105. ^J       Line Feed                  y    y    y    y    y    y    y    y
  2106. ^K       Cursor Up                  y    y    y    y    y    y    y    y
  2107. ^L       Cursor Right               y    y    y    y    y    y    y    y
  2108. ^M       Carriage Return            y    y    y    y    y    y    y    y
  2109. ^N       Disable ^S/^Q              y         y    y    y    y
  2110. ^O       Enable ^S/^Q               y         y    y    y    y
  2111. ^R       Enable P3<->P4             y    y              y    y
  2112. ^T       Disable P3<->P4            y    y              y    y
  2113. ^V       Cursor Down                y                   y    y    y
  2114. ^X       Clear unprot field                             y    y
  2115. ^Z       Clear Unprot.              y    y    y    y    y    y    y    y
  2116. ^^       Home                       y    y    y    y    y    y    y    y
  2117. ^_       NewLine                    y    y    y    y    y    y    y    y
  2118.  
  2119. ESC ^B   insert Ctrl-B (STX)                            y    y
  2120. ESC ^C   insert Ctrl-C (ETX)                            y    y
  2121. ESC ESC  Display "EC" symbol        y
  2122. ESC ! 1  Linelock this line         y
  2123. ESC ! 2  Clear all locks            y
  2124. ESC "    Unlock keyboard            y    y    y    y    y    y    y    y
  2125. ESC #    Lock keyboard              y    y    y    y    y    y    y    y
  2126. ESC $    Graphics mode on           y                   y    y
  2127. ESC %    Graphics mode off          y                   y    y
  2128. ESC &    Protect mode on            y         y    y    y    y    y    y
  2129. ESC '    Protect mode off           y         y    y    y    y    y    y
  2130. ESC (    W-Prot off & dim           y    dim  y    y    y    y    y    y
  2131. ESC )    W-Prot on & bold           y    bold y    y    y    y    y    y
  2132. ESC *    Clear all to nulls         y    y    y    y              y    ?
  2133. ESC * 0  Clear all to nulls                             y    y
  2134. ESC * 1  Clear all to spaces                            y    y
  2135. ESC * 2  Clear unprot to nulls                          y    y
  2136. ESC * 3  Clear unprot to spaces                         y    y
  2137. ESC +    Clear unprot to ic*        y    y    y    y
  2138. ESC ,    Clear all to dim sp        y         y    y
  2139. ESC -    Move to page/row/col       y                        y    y
  2140. ESC .    Toggle cursor on/off            y    y    y
  2141. ESC . 0  Invisible cursor           y                   y    y
  2142. ESC . 1  Blinking block cursor      y                   y    y
  2143. ESC . 2  Steady block cursor        y         y    y    y    y
  2144. ESC . 3  Blinking underline         y         y    y    y    y
  2145. ESC . 4  Steady underline           y         y    y    y    y
  2146. ESC /    Report Cursor p/r/c        y                        y    y
  2147. ESC 0 0  Program Shift-Send key     y
  2148. ESC 0 1  Program Send key           y
  2149. ESC 0 @  Program Home key                                    y
  2150. ESC 0 P  Program Send key                               y    y
  2151. ESC 0 p  Program shift-Send key                         y    y
  2152. ESC 0 s  Program shift-ENTER key                             y
  2153. ESC 1    Set tab stop               y    y    y    y
  2154. ESC 2    Clear tab stop             y    y    y    y
  2155. ESC 3    Clear all tab stops        y    y    y    y
  2156. ESC 4    Send unprot from BOL       y         y    y
  2157. ESC 5    Send unprot from BOP       y         y    y
  2158. ESC 6    Send all from BOL          y         y    y
  2159. ESC 7    Send all from BOP          y         y    y
  2160. ESC 8    Smooth scroll mode on      y
  2161. ESC 8 0  Jump scroll mode on                                 y
  2162. ESC 8 1  Smooth scroll mode on                               y
  2163. ESC 9    Jump scroll mode on        y
  2164. ESC :    Clear unprot to null       y                             ?    ?
  2165. ESC ;    Clear unprot to ic*        y         y    y              ?    ?
  2166. ESC <    Keyclick off               y                             y
  2167. ESC < 0  Keyclick off                                   y    y
  2168. ESC < 1  Keyclick on                                    y    y
  2169. ESC >    Keyclick on                y                             y
  2170. ESC =    Move to row/column         y    y    y    y    y    y    y    y
  2171. ESC ?    Report row/column          y    y    y    y    y    y    y    y
  2172. ESC @    Copy-print mode on         y    y              y    y    y
  2173. ESC A    Copy-print mode off        y    y              y    y    y
  2174. ESC B    Block mode on/conv off     y                   y    y    y
  2175. ESC C    Conversation mode on       y                   y    y    y
  2176. ESC D H  Half duplex, Block off     y                   y    y
  2177. ESC D F  Full duplex, Block off     y                   y    y
  2178. ESC E    Insert a line              y        y     y    y    y    y    y
  2179. ESC F    Display control char            y
  2180. ESC F    Define block of attr.                               y
  2181. ESC F    Load status msg            ?
  2182. ESC G 0  Reset video attributes     y    y              y    y    y    y
  2183. ESC G 1  Blank video attribute      y    y              y    y    y    y
  2184. ESC G 2  Blank video attribute      y    y              y    y    y    y
  2185. ESC G 4  Blank video attribute      y    y              y    y    y    y
  2186. ESC G 8  Blank video attribute      y    y              y    y    y    y
  2187. ESC H    Auto scroll on/off              y
  2188. ESC H    Define block graph. area                            y
  2189. ESC I    Back tab                   y    y              ?    ?    y    y
  2190. ESC J    Back page                  y                        y    y
  2191. ESC K    Next page                  y                        y    y
  2192. ESC L    Unformatted Print Page     y
  2193. ESC L    Send data to hidden cursor                          y
  2194. ESC M    Transmit terminal ID       y                   y    y
  2195. ESC N    PageEdit mode on           y
  2196. ESC N 0  PageEdit mode off                                   y
  2197. ESC N 1  PageEdit mode on                                    y
  2198. ESC O    PageEdit mode off          y
  2199. ESC P    Print page, show next      y                             y
  2200. ESC P 0  Print formatted page                           y    y
  2201. ESC P 1  Print form. unprot. page                       y    y
  2202. ESC P 3  Print formatted page                           y    y
  2203. ESC P 4  Print unformatted page                         y    y
  2204. ESC P 5  Print unform. unprot. page                     y    y
  2205. ESC P 7  Print unformatted page                         y    y
  2206. ESC Q    Insert a character         y         y    y    y    y    y    y
  2207. ESC R    Delete the line            y         y    y    y    y    y    y
  2208. ESC S    Send unprot message        y         y    y              y    y
  2209. ESC S 1  Send unprot from BOL                           y    y
  2210. ESC S 3  Send all from BOL                              y    y
  2211. ESC S 5  Send unprot from BOP                           y    y
  2212. ESC S 7  Send all from BOP                              y    y
  2213. ESC S 9  Send unprot text STX->ETX                      y    y
  2214. ESC S ;  Send text from STX to ETX                      y    y
  2215. ESC S ?  Send form                                      y    y
  2216. ESC T    Erase to EOL with ic*      y    y              y    y    y    y
  2217. ESC U    Monitor mode on            y    y    y    y    y    y    y    y
  2218. ESC V    Start self test                 y    y    y    y    y
  2219. ESC W    Delete a character         y         y    y    y    y    y    y
  2220. ESC X    Monitor mode off           y    y    y    y    y    y    y    y
  2221. ESC Y    Clear to EOP with ic*      y    y    y    y    y    y    ?
  2222. ESC Z 0  Report User line           y                   y    y    y
  2223. ESC Z 1  Report Status line         y                   y    y    y
  2224. ESC Z 2  Report Setup lines                                  y
  2225. ESC [    Move to row                     y
  2226. ESC ]    Move to column                  y
  2227. ESC ] 0  Program unshift. edit keys                          y
  2228. ESC ] 1  Program shifted edit keys                           y
  2229. ESC \ 1  24 lines/logical page      y                        y
  2230. ESC \ 2  48 lines/logical page      y                        y
  2231. ESC \ 3  96 lines/logical page      y                        y
  2232. ESC ^    Program answerback msg                              y
  2233. ESC ^    Start blink attribute                y    y
  2234. ESC _    Define scrolling region                             y
  2235. ESC _    Start blank attribute                y    y
  2236. ESC `    Buffered print mode on     y         y    y    y    y    ?
  2237. ESC a    Buffered print off         y         y    y    y    y    ?
  2238. ESC b    Screen black on white      y                   y    y
  2239. ESC d    Screen white on black      y                   y    y
  2240. ESC e    Load insert character      y
  2241. ESC f    Load user line             y                        y
  2242. ESC g    25th line is User line     y
  2243. ESC g    Assign log. attr. to field                          y
  2244. ESC h    25th line is Status        y
  2245. ESC i    Field tab                  y         y    y    y    y    ?
  2246. ESC j    Reverse linefeed           y
  2247. ESC j    Reverse video attr.                  y    y
  2248. ESC k    Normal background attr.              y    y
  2249. ESC k    Local edit mode            y         y    y
  2250. ESC k 0  Duplex edit mode                               y    y
  2251. ESC k 1  Local edit mode                                y    y
  2252. ESC l    Duplex Edit mode           y         y    y
  2253. ESC l    Start underline attr.                y    y
  2254. ESC m    End underline attr.                  y    y
  2255. ESC n 0  Screen On                                      y    y
  2256. ESC n 1  Screen Off                                     y    y
  2257. ESC o 0  Logical attribute mode on                           y
  2258. ESC o 1  Logical attribute mode on                           y
  2259. ESC p    Report NVRAM contents                               y
  2260. ESC q    End blink/blank                      y    y
  2261. ESC q    Insert mode on             y
  2262. ESC r    Insert mode off            y
  2263. ESC s    Send message all           y         y    y              y    y
  2264. ESC s    Define 25th line                                    y
  2265. ESC t    Erase to EOL, nulls        y         y    y    y    y    y    ?
  2266. ESC u    Monitor mode off           y         y    y              y    ?
  2267. ESC v    Autopage on                y                             y
  2268. ESC v 0  Autopage off                                        y
  2269. ESC v 1  Autopage on                                         y
  2270. ESC w    Autopage off               y                             y
  2271. ESC x 0  Set field delimiter        y                        y    ?
  2272. ESC x 1  Set line delimiter         y         y    y         y    ?
  2273. ESC x 2  Set start prot delim.      y                        y    ?
  2274. ESC x 3  Set end prot delimiter     y                        y    ?
  2275. ESC x 4  Set screen delimiter       y         y    y         y    ?
  2276. ESC y    Erase to EOP, nulls        y         y    y    y    y    ?    ?
  2277. ESC z    Call User PROM             y
  2278. ESC {    Set main (P3) port         y                             ?
  2279. ESC { 0  Set main (comp) port                                y
  2280. ESC { 1  Set printer port baud etc                           y
  2281. ESC |    Program function keys      y                   y    y
  2282. ESC }    Set printer (P4) port      y                        ?    ?
  2283. ESC ~ 0  Reset terminal                                 y    y
  2284. ESC ~ 1  Reset to factory def.                          y    y
  2285.  
  2286. Notes:
  2287. The TVI925 and 905 columns probably have a lot of mistakes, the other columns
  2288.       might have a few too! (hopefully not too many)
  2289. ESC G sets video attributes based on flags, so ESC G 6 would be reverse blink;
  2290.       on most oldish ADM/Wyse/TVI/QVT terminals this attribute takes up one
  2291.       character position on the screen; this is optional on some (e.g. ADM 12)
  2292.       On the TVI914/924 they never take a space. The 914/924 allows dim to be
  2293.       set (e.g. ESC G space is DIM, ESC G " is blink dim).
  2294. BOL = Beginning of line
  2295. BOP = Beginning of page
  2296. EOL = End of line
  2297. ic* = whatever insert character is set to, space by default. A TVI950 lets you
  2298.       define what the space charecter is, on most other terminals it is always
  2299.       a space (ASCII 32).
  2300.  
  2301. Mark Aitchison, University of Canterbury, New Zealand.
  2302. (usual disclaimers apply, plus a big E & O E).
  2303.  
  2304.  
  2305. TVI950.CHT
  2306.  
  2307.               Summary of TeleVideo, Inc. Model 950 ESC sequences
  2308.               ==================================================
  2309.  
  2310. +------------+------------+------------+------------+------------+------------+
  2311. |SPC         |0           |@           |P           |`           |p           |
  2312. |            |Load Send   |Extention   |Formatted   |Buff transp |            |
  2313. |            |key  ++     |print on    |page prnt on|print on    |            |
  2314. +------------+------------+------------+------------+------------+------------+
  2315. |!           |1           |A           |Q           |a           |q           |
  2316. |Line lock   |Set typwritr|Extention   |Character   |Buff transp |Insert      |
  2317. |1=on, 2=off |column tab  |print off   |insert      |print off   |mode on     |
  2318. +------------+------------+------------+------------+------------+------------+
  2319. |"           |2           |B           |R           |b           |r           |
  2320. |Keyboard    |Clear type- |Block       |Line        |Set reverse |Edit mode   |
  2321. |unlock      |writer tab  |mode on     |delete      |background  |(replace) on|
  2322. +------------+------------+------------+------------+------------+------------+
  2323. |#           |3           |C           |S           |c           |s           |
  2324. |Keyboard    |Clear all   |Ret to prev |Send unprot |Local       |Send whole  |
  2325. |lock        |tabs        |duplex mode |message  ++ |mode on     |msg w/prot++|
  2326. +------------+------------+------------+------------+------------+------------+
  2327. |$           |4           |D           |T           |d           |t           |
  2328. |Graphics    |Send unprot |Dplx mode on|Clear to EOL|Set normal  |Clear to EOL|
  2329. |mode on     |line to crsr|H=half F=ful|w/ insrt chr|background  |with nulls  |
  2330. +------------+------------+------------+------------+------------+------------+
  2331. |%           |5           |E           |U           |e           |u           |
  2332. |Graphics    |Send unprot |Line        |Monitor     |Load insert |Monitor     |
  2333. |mode off    |page to crsr|insert      |mode on     |character   |mode exit   |
  2334. +------------+------------+------------+------------+------------+------------+
  2335. |&           |6           |F           |V           |f           |v           |
  2336. |Protected   |Send all lin|            |            |Load user   |Auto page   |
  2337. |mode on     |to curs/prot|            |            |line        |on          |
  2338. +------------+------------+------------+------------+------------+------------+
  2339. |'           |7           |G <d>       |W           |g           |w           |
  2340. |Protected   |Send all pag|Set screen  |Character   |Display     |Auto page   |
  2341. |mode off    |to curs/prot|attrib  **  |delete      |user line   |off         |
  2342. +------------+------------+------------+------------+------------+------------+
  2343. |(           |8           |H           |X           |h           |x           |
  2344. |Half intens-|Smooth      |            |Monitor     |Display     |Set send    |
  2345. |ity off     |scroll on   |            |mode off    |status line |delimters++ |
  2346. +------------+------------+------------+------------+------------+------------+
  2347. |)           |9           |I           |Y           |i           |y           |
  2348. |Half intens-|Smooth      |Back        |Clr end page|Field       |Clr to end  |
  2349. |ity on      |scroll off  |tab         |w/ insrt chr|tab         |of page/null|
  2350. +------------+------------+------------+------------+------------+------------+
  2351. |*           |:           |J           |Z           |j           |z           |
  2352. |Clear page  |Clear unprot|Prev screen |Send line   |Rev line    |Execute user|
  2353. |to nulls    |page to null|page        |0=usr,1=stat|feed        |ROM program |
  2354. +------------+------------+------------+------------+------------+------------+
  2355. |+           |;           |K           |[           |k           |{           |
  2356. |Clear unprot|Clear unprot|Next screen |            |Edit keys   |Configure   |
  2357. |page/ins chr|page/ins chr|page        |            |local       |comp port ++|
  2358. +------------+------------+------------+------------+------------+------------+
  2359. |,           |<           |L           |\ <d>       |l           ||           |
  2360. |Clear page  |Keyclick    |Unformatted |Set page    |Edit keys   |Program     |
  2361. |to half int |off         |page prnt on|length  *** |duplex      |func key  ++|
  2362. +------------+------------+------------+------------+------------+------------+
  2363. |-           |=           |M           |]           |m           |}           |
  2364. |Pos cursor  |Pos cursor  |Send trminal|            |            |Configure   |
  2365. |page row col|row col     |ID string   |            |            |prtr port ++|
  2366. +------------+------------+------------+------------+------------+------------+
  2367. |. <d>       |>           |N           |^           |n           |~           |
  2368. |Set cursor  |Keyclick    |Page        |            |Screen      |            |
  2369. |attrib  *   |on          |mode on     |            |on          |            |
  2370. +------------+------------+------------+------------+------------+------------+
  2371. |/           |?           |O           |_           |o           |DEL         |
  2372. |Read cursor |Read cursor |Line        |            |Screen      |            |
  2373. |page row col|row col     |mode on     |            |off         |            |
  2374. +------------+------------+------------+------------+------------+------------+
  2375.  
  2376.  
  2377.   *  '0' =off, '1' =blink block, '2' =block, '3' =blink undrln, '4' =undrlin
  2378.  
  2379.  **  '0' to '?', if bit 0 set =blank, 1 =blink, 2 =reverse, 3 =underline
  2380.  
  2381. ***  '1' =24 lines, '2' =48 lines, '3' =96 lines
  2382.  
  2383.  ++  See manual for additional details
  2384.  
  2385.  
  2386.                     TVI 950 Switch Setting Reference Charts
  2387.                     =======================================
  2388.  
  2389.  
  2390.                                     TABLE 1:
  2391.  
  2392.      S1     1     2     3     4     5     6     7     8     9    10
  2393.          +-----------------------+-----+-----+-----------------------+
  2394.          | Computer Baud Rate    |Data |Stop | Printer Baud Rate     |
  2395.          |                       |Bits |Bits |                       |
  2396.   +------+-----------------------+-----+-----+-----------------------+
  2397.   |  Up  |        See            |  7  |  2  |        See            |
  2398.   +------+-----------------------+-----+-----+-----------------------+
  2399.   | Down |      TABLE 2          |  8  |  1  |      TABLE 2          |
  2400.   +------+-----------------------+-----+-----+-----------------------+
  2401.  
  2402.  
  2403.      S2     1     2     3     4     5     6     7     8     9    10
  2404.          +-----+-----+-----------------+-----+-----------+-----+-----+
  2405.          |Edit |Cursr|    Parity       |Video|Transmiss'n| Hz  |Click|
  2406.   +------+-----+-----+-----------------+-----+-----------+-----+-----+
  2407.   |  Up  | Dplx|Blink|      See        |GonBk|   See     | 60  | Off |
  2408.   +------+-----+-----+-----------------+-----+-----------+-----+-----+
  2409.   | Down |Local|St'dy|    TABLE 3      |BkonG|  CHART    | 50  | On  |
  2410.   +------+-----+-----+-----------------+-----+-----------+-----+-----+
  2411.  
  2412.  
  2413.                                    TABLE 2:
  2414.  
  2415.             +-----------+-----+-----+-----+-----+-----------+
  2416.             | Display   |  1  |  2  |  3  |  4  |   Baud    |
  2417.             +-----------+-----+-----+-----+-----+           |
  2418.             | Printer   |  7  |  8  |  9  | 10  |   Rate    |
  2419.             +-----------+-----+-----+-----+-----+-----------+
  2420.                         |  D  |  D  |  D  |  D  |   9600    |
  2421.                         |  U  |  D  |  D  |  D  |     50    |
  2422.                         |  D  |  U  |  D  |  D  |     75    |
  2423.                         |  U  |  U  |  D  |  D  |    110    |
  2424.                         |  D  |  D  |  U  |  D  |    135    |
  2425.                         |  U  |  D  |  U  |  D  |    150    |
  2426.                         |  D  |  U  |  U  |  D  |    300    |
  2427.                         |  U  |  U  |  U  |  D  |    600    |
  2428.                         |  D  |  D  |  D  |  U  |   1200    |
  2429.                         |  U  |  D  |  D  |  U  |   1800    |
  2430.                         |  D  |  U  |  D  |  U  |   2400    |
  2431.                         |  U  |  U  |  D  |  U  |   3600    |
  2432.                         |  D  |  D  |  U  |  U  |   4800    |
  2433.                         |  U  |  D  |  U  |  U  |   7200    |
  2434.                         |  D  |  U  |  U  |  U  |   9600    |
  2435.                         |  U  |  U  |  U  |  U  |  19200    |
  2436.                         +-----+-----+-----+-----+-----------+
  2437.  
  2438.  
  2439.  
  2440.  
  2441.                                    TABLE 3:
  2442.  
  2443.                         +-----+-----+-----+-----------+
  2444.                         |  3  |  4  |  5  |   Parity  |
  2445.                         +-----+-----+-----+-----------+
  2446.                         |  X  |  X  |  D  |    None   |
  2447.                         |  D  |  D  |  U  |     Odd   |
  2448.                         |  D  |  U  |  U  |    Even   |
  2449.                         |  U  |  D  |  U  |    Mark   |
  2450.                         |  U  |  U  |  U  |   Space   |
  2451.                         +-----+-----+-----+-----------+
  2452.  
  2453.                                 X = don't care
  2454.  
  2455.  
  2456.  
  2457.  
  2458.                                     CHART:
  2459.  
  2460.                         +-----+-----+-----------------+
  2461.                         |  7  |  8  | Communication   |
  2462.                         +-----+-----+-----------------+
  2463.                         |  D  |  D  |  Half Duplex    |
  2464.                         |  D  |  U  |  Full Duplex    |
  2465.                         |  U  |  D  |     Block       |
  2466.                         |  U  |  U  |     Local       |
  2467.                         +-----+-----+-----------------+
  2468.  
  2469.  
  2470. ------------------------------------------------------------------------------
  2471.  
  2472. #endif /* COMMENT */
  2473. #endif /* NOTERM */
  2474.