home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / GFXFX2.ZIP / UNITINT.ZIP / U_TXT.INT < prev    next >
Text File  |  1995-02-14  |  4KB  |  102 lines

  1.  
  2. (*
  3. ** General Text unit
  4. **
  5. ** - Includes low-level video-writes
  6. ** - No snow-checking is performed
  7. ** - VGA is assumed
  8. ** - All routines are zero-based
  9. ** - Autodetects current video mode and screen location
  10. **
  11. ** By Bas van Gaalen
  12. *)
  13.  
  14. unit u_txt;
  15.  
  16. interface
  17.  
  18. const
  19.   on=true;
  20.   off=false;
  21.  
  22.   black=0;
  23.   blue=1;
  24.   green=2;
  25.   cyan=3;
  26.   red=4;
  27.   magenta=5;
  28.   brown=6;
  29.   lightgray=7;
  30.   darkgray=8;
  31.   lightblue=9;
  32.   lightgreen=10;
  33.   lightcyan=11;
  34.   lightred=12;
  35.   lightmagenta=13;
  36.   yellow=14;
  37.   white=15;
  38.   blink=128;
  39.   _blue=blue shl 4;
  40.   _green=green shl 4;
  41.   _cyan=cyan shl 4;
  42.   _red=red shl 4;
  43.   _magenta=magenta shl 4;
  44.   _brown=brown shl 4;
  45.   _lightgray=lightgray shl 4;
  46.  
  47.   mda=0;
  48.   cga=1;
  49.   ega=2;
  50.   ega_mono=3;
  51.   vga=4;
  52.   vga_mono=5;
  53.   mcga=6;
  54.   mcga_mono=7;
  55.  
  56.   viderror:byte=0;
  57.  
  58. var
  59.   color:boolean;                              { True when colorcard detected }
  60.   v_columns,                                { Number of Columns. Set at Init }
  61.   v_lines,                                    { Number of Lines. Set at Init }
  62.   vidcard:byte;                                  { Code for active videocard }
  63.   v_vidseg:word;                               { Segmentaddress of video-RAM }
  64.   v_pageinmem:boolean;                          { screenpage saved in memory }
  65.  
  66. function rows:byte;                                         { Number of rows }
  67. function cols:byte;                                      { Number of Columns }
  68. procedure setcolumns;                           { updates v_columns variable }
  69. procedure setlines;                               { updates v_lines variable }
  70. procedure clrscr;           { clear current videobuffer - any txt-resolution }
  71. procedure placecursor(x,y:byte);               { a-la gotoxy, but zero-based }
  72. function getx:byte;                                     { a-la wherex, ditto }
  73. function gety:byte;                                     { a-la wherey, ditto }
  74. function getmode:word;                                      { get video mode }
  75. procedure setmode(mode:word);      { simple setvidmode - also check VGA-unit }
  76. procedure txt_lines(nr:byte);    { set number of lines: 12,14,21,25,28,43,50 }
  77. procedure setblink(state:boolean);                 { set blink-state: on/off }
  78. procedure txt_setrgb(c,r,g,b:byte);   { set rgb-intensities, text equivalent }
  79. procedure txt_getrgb(c:byte; var r,g,b:byte);          { get rgb-intensities }
  80. procedure dspat(str:string; col:integer; row,attr:byte);    { display string }
  81. procedure dsptxt(str:string; x:integer; y:byte); { display text only no attr }
  82. procedure dspchar(c:char; x,y,col:byte);             { display one char only }
  83. procedure dspmul(s:string; x:integer; y:byte);       { disp. multicolor text }
  84. procedure drawbox(xs,ys,xe,ye,attr:byte);                          { drawbox }
  85. procedure setcursorshape(shape:word);        { low-level set shape of cursor }
  86. function getcursorshape:word;                { low-level get shape of cursor }
  87. procedure linecursor;                 { set underscore-cursor any resolution }
  88. procedure halfcursor;                { set half block (insert) cursor, ditto }
  89. procedure blockcursor;                        { set full block cursor, ditto }
  90. procedure cursoroff;                                            { cursor off }
  91. procedure cursoron;                                              { cursor on }
  92. procedure setscr;                                      { save current screen }
  93. procedure getscr;                                      { restore last screen }
  94. procedure scrolly(dir:char; x1,y1,x2,y2,col:byte);         { scroll vertical }
  95. procedure scrolltexty(dir:char; x1,y1,x2,y2:byte);    { scroll text only - v }
  96. procedure filltext(dir:char; x1,y1,x2,y2,col:byte);    { fill area with char }
  97. procedure fillattr(x1,y1,x2,y2,col:byte);             { fill area with color }
  98. function getattr(x,y:word):byte;               { get attribute at coordinate }
  99.  
  100. implementation
  101.  
  102.