home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 165 / WDFMT21.ZIP / VIDEO.C < prev    next >
Text File  |  1990-03-20  |  6KB  |  210 lines

  1.  
  2. /************************************************/
  3. /*   this file contains several video routines    */
  4. /*                        */
  5. /*                        */
  6. /*                        */
  7. /*                        */
  8. /*                        */
  9. /*                        */
  10. /*                        */
  11. /*                        */
  12. /*                        */
  13. /*                        */
  14. /************************************************/
  15.  
  16.  
  17. #include <scancode.h>
  18. #include "defs.h"
  19. #include <dos.h>
  20. #include "color.h"
  21.  
  22.  
  23. int redirection;
  24. union REGS inregs, outregs;
  25.  
  26.  
  27. /*****************************************************/
  28. /* upscroll(lines,top_row,bot_row,l_col,r_col,fill) */
  29. /*                             */
  30. /*  input  :                         */
  31. /*        lines   : number of lines to scroll      */
  32. /*        top_row : top row of window          */
  33. /*        bot_row : bottom row of window         */
  34. /*        l_col   : left column of window         */
  35. /*        r_col   : right column of window         */
  36. /*        fill    : filler attribute             */
  37. /*                             */
  38. /*  output : none                     */
  39. /*                             */
  40. /* this routine will scroll a window up as meny      */
  41. /* lines as told in var lines                 */
  42. /*                             */
  43. /*****************************************************/
  44.  
  45. upscroll(lines,top_row,bot_row,l_col,r_col,fill)
  46.  
  47. char lines,top_row,bot_row,l_col,r_col,fill;
  48.  
  49. {
  50.    inregs.h.ah = 6;               /* set up registers for interrupt */
  51.    inregs.h.al = lines;
  52.    inregs.h.bh = fill;
  53.    inregs.h.ch = top_row;
  54.    inregs.h.cl = l_col;
  55.    inregs.h.dh = bot_row;
  56.    inregs.h.dl = r_col;
  57.    int86(0x10,&inregs,&outregs);
  58. }
  59.  
  60.  
  61. /*****************************************************/
  62. /* downscroll(lines,top_row,bot_row,l_col,r_col,fill) */
  63. /*                             */
  64. /*  input  :                         */
  65. /*        lines   : number of lines to scroll      */
  66. /*        top_row : top row of window          */
  67. /*        bot_row : bottom row of window         */
  68. /*        l_col   : left column of window         */
  69. /*        r_col   : right column of window         */
  70. /*        fill    : filler attribute             */
  71. /*                             */
  72. /*  output : none                     */
  73. /*                             */
  74. /* this routine will scroll a window down as meny    */
  75. /* lines as told in var lines                 */
  76. /*                             */
  77. /*****************************************************/
  78.  
  79. downscroll(lines,top_row,bot_row,l_col,r_col,fill)
  80.  
  81. char lines,top_row,bot_row,l_col,r_col,fill;
  82.  
  83. {
  84.    inregs.h.ah = 7;               /* set up registers for interrupt */
  85.    inregs.h.al = lines;
  86.    inregs.h.bh = fill;
  87.    inregs.h.ch = top_row;
  88.    inregs.h.cl = l_col;
  89.    inregs.h.dh = bot_row;
  90.    inregs.h.dl = r_col;
  91.    int86(0x10,&inregs,&outregs);
  92. }
  93.  
  94. /************************************************/
  95. /*                        */
  96. /*  cls()                    */
  97. /*                        */
  98. /*    input  : none                */
  99. /*                        */
  100. /*    output : none                */
  101. /*                        */
  102. /*  this routine will clear the whole screen    */
  103. /*                        */
  104. /************************************************/
  105.  
  106. cls()
  107.  
  108. {
  109.    inregs.h.ah = 6;               /* set up registers for interrupt */
  110.    inregs.h.al = 24;               /* lines */
  111.    inregs.h.bh = VNORMAL;           /* fill */
  112.    inregs.h.ch = 0;               /* top_row */
  113.    inregs.h.cl = 0;               /* l_col */
  114.    inregs.h.dh = 24;               /* bot_row */
  115.    inregs.h.dl = 79;               /* r_col */
  116.    int86(0x10,&inregs,&outregs);
  117. }
  118.  
  119. /*****************************************************/
  120. /*                             */
  121. /*  curs(row,col)                     */
  122. /*                             */
  123. /* input  :                         */
  124. /*        row :  row to place curser at (0 = top ) */
  125. /*        col :  column position  (0 = left)         */
  126. /*                             */
  127. /* output : none                     */
  128. /*                             */
  129. /* routine will place the cursor on screen         */
  130. /*                             */
  131. /*****************************************************/
  132.  
  133. crs(row,col)
  134.  
  135. int row,col;
  136.  
  137. {                        /* start of curs */
  138.    inregs.h.ah = 2;                /* set ah with service # */
  139.    inregs.h.bh = 0;
  140.    inregs.h.dh = (char)row;
  141.    inregs.h.dl = (char)col;
  142.    int86(16,&inregs,&outregs);            /* do that interrupt */
  143. }                        /* end of curs */
  144.  
  145.  
  146. /************************************************/
  147. /*                        */
  148. /* print_atrb(row,col,string,atbute)        */
  149. /*                        */
  150. /*  input  :                    */
  151. /*         string : string to output        */
  152. /*         atbute : attribute of string    */
  153. /*         row    : row to start at        */
  154. /*         col    : column to start at    */
  155. /*                        */
  156. /*  output : none                */
  157. /*                        */
  158. /*                        */
  159. /*                        */
  160. /************************************************/
  161.  
  162. print_atrb(row,col,string,atbute)
  163.  
  164. char row,col,*string,atbute;
  165.  
  166. {                        /* start of print_atrb */
  167.    inregs.h.ah = 9;                /* set up regs */
  168.    inregs.h.bh = 0;
  169.    inregs.h.bl = atbute;
  170.    inregs.x.cx = 1;
  171.    while(*string)
  172.    {                        /* start of while */
  173.       inregs.h.ah = 2;                /* set regs for curs pos */
  174.       inregs.h.bh = 0;
  175.       inregs.h.dh = (char)row;
  176.       inregs.h.dl = (char)col;
  177.       int86(16,&inregs,&outregs);        /* set curs position  */
  178.       col++;
  179.       inregs.h.ah = 9;                /* set up regs for print screen */
  180.       inregs.h.bh = 0;
  181.       inregs.h.bl = atbute;
  182.       inregs.x.cx = 1;
  183.       inregs.h.al = *string;
  184.       int86(0x10,&inregs,&outregs);        /* print char */
  185.       *string++;
  186.    }                        /* end of while */
  187. }                        /* end of print_atrb */
  188.  
  189. /************************************/
  190.  
  191. get_curs(row, col)
  192. char *row, *col;
  193. {
  194.     inregs.h.ah = 3;
  195.     inregs.x.bx = 0;
  196.     int86(0x10, &inregs, &outregs);
  197.     *row = (char) outregs.h.dh;
  198.     *col = (char) outregs.h.dl;
  199. }
  200. /*************************
  201. ** era_eol()
  202. ** erase to end of line
  203. **************************/
  204. era_eol()
  205. {
  206.     char row, col, window[4];
  207.     get_curs(&row, &col);
  208.     upscroll(1,row,row,col,79,VNORMAL);
  209. }
  210.