home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 125_01 / libvt52.c < prev    next >
Text File  |  1985-03-10  |  3KB  |  182 lines

  1. /*   DISK CATALOG : HEADERS.DOC
  2.     
  3. C Users Group Volume Number 125 - VIDEO TERMINAL LIRARIES
  4. Cataloged By Ben Rockefeller 5/15/85    
  5.  
  6. */
  7.  
  8. /*           HEADER: CUG125.11; 
  9.  
  10.           TITLE: VIDEO TERMINAL LIBRARIES;
  11.             VERSION: 1.0;
  12.                   DATE: 5/15/85;
  13.         DESCRIPTION: "Library of video terminal routines
  14.               to use control codes for the DEC vt52";
  15.        KEYWORDS: DEC vt52, video terminal routines;
  16.              SYSTEM: DEC vt52, PDP-11, VAX;
  17.            FILENAME: LIBVT52.C;
  18.        WARNINGS: "Drives only DEC vt52; does not drive IBM PC
  19.              video";
  20.        SEE-ALSO: LIBVT52.NRO;
  21.             AUTHORS: Stephen L. Browning;
  22.           COMPILERS: BDC C;
  23. */
  24.  
  25.  
  26. /*
  27.  *    Library of routines to utilize control codes
  28.  *    for the DEC VT-52 terminal.
  29.  *
  30.  *    Stephen L. Browning
  31.  *    5723 North Parker Avenue
  32.  *    Indianapolis, Indiana 46220
  33.  */
  34.  
  35. #include "a:crt.h"
  36.  
  37. #define ESC 033
  38.  
  39. /*
  40.  *    Home the cursor and clear the screen
  41.  */
  42.  
  43. clrscrn()
  44. {
  45.     putchar(ESC);
  46.     putchar('H');
  47.     putchar(ESC);
  48.     putchar('J');
  49. }
  50.  
  51. /*
  52.  *    Erase entire line
  53.  */
  54.  
  55. eralin(_y)
  56. int _y;
  57. {
  58.     putchar(ESC);        /* setcur(0,_y) */
  59.     putchar('Y');
  60.     putchar(23-_y+' ');
  61.     putchar(' ');
  62.     putchar(ESC);        /* erteol() */
  63.     putchar('K');
  64. }
  65.  
  66. /*
  67.  *    Erase from cursor to end of line
  68.  */
  69.  
  70. erteol()
  71. {
  72.     putchar(ESC);
  73.     putchar('K');
  74. }
  75.  
  76. /*
  77.  *    Erase from cursor to end of screen
  78.  */
  79.  
  80. erteos()
  81. {
  82.     putchar(ESC);
  83.     putchar('J');
  84. }
  85.  
  86. /*
  87.  *    Set terminal in graphics mode
  88.  */
  89.  
  90. graphics()
  91. {
  92.     putchar(ESC);
  93.     putchar('F');
  94. }
  95.  
  96.  
  97. /*
  98.  *    Move cursor to home position
  99.  */
  100.  
  101. home()
  102. {
  103.     putchar(ESC);
  104.     putchar('H');
  105. }
  106.  
  107. /*
  108.  *    Move cursor to one of eight adjacent locations
  109.  */
  110.  
  111. movcur(_dir)
  112. int _dir;
  113. {
  114.     switch (_dir) {
  115.     case N:
  116.         putchar(ESC);
  117.         putchar('A');
  118.         break;
  119.     case NE:
  120.         putchar(ESC);
  121.         putchar('A');
  122.         putchar(ESC);
  123.         putchar('C');
  124.         break;
  125.     case E:
  126.         putchar(ESC);
  127.         putchar('C');
  128.         break;
  129.     case SE:
  130.         putchar(ESC);
  131.         putchar('B');
  132.         putchar(ESC);
  133.         putchar('C');
  134.         break;
  135.     case S:
  136.         putchar(ESC);
  137.         putchar('B');
  138.         break;
  139.     case SW:
  140.         putchar(ESC);
  141.         putchar('B');
  142.         putchar(ESC);
  143.         putchar('D');
  144.         break;
  145.     case W:
  146.         putchar(ESC);
  147.         putchar('D');
  148.         break;
  149.     case NW:
  150.         putchar(ESC);
  151.         putchar('A');
  152.         putchar(ESC);
  153.         putchar('D');
  154.         break;
  155.     }
  156. }
  157.  
  158. /*
  159.  *    Set terminal to its default power up mode
  160.  */
  161.  
  162. normal()
  163. {
  164.     putchar(ESC);
  165.     putchar('G');
  166. }
  167.  
  168.  
  169. /*
  170.  *    Set cursor to coordinate value.
  171.  *    0,0 is lower left corner of display
  172.  */
  173.  
  174. setcur(_x,_y)
  175. int _x, _y;
  176. {
  177.     putchar(ESC);
  178.     putchar('Y');
  179.     putchar(23-_y+' ');
  180.     putchar(_x+' ');
  181. }
  182.