home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / SNIP9404.ZIP / SCROLL.C < prev    next >
C/C++ Source or Header  |  1994-04-03  |  2KB  |  48 lines

  1. /*--------------------------[ scroll ]--------------------------*/
  2. /*      Scroll the active page up or down a number of lines     */
  3. /*              Public domain code by Jeff Dunlop:              */
  4. /*--------------------------------------------------------------*/
  5. /* input:                                                       */
  6. /*      dx = direction                                          */
  7. /*      num_lines = number of lines to scroll, 0 = clear coords */
  8. /*      attr = attribute of blank line(s)                       */
  9. /*      y1, x1, y2, x2 = corner coordinates of scroll window    */
  10. /* local:                                                       */
  11. /*      regs = register union for ISR                           */
  12. /*--------------------------------------------------------------*/
  13.  
  14. #include <dos.h>
  15. #include "scrnmacs.h"
  16.  
  17. void scroll(int direction,
  18.             int num_lines,
  19.             int vattrib,
  20.             int ulrow,
  21.             int ulcomumn,
  22.             int lrrow,
  23.             int lrcolumn)
  24. {
  25.       union REGS regs;
  26.  
  27.       /*
  28.             BH = attribute to be used on blank line
  29.             CH = row of upper left corner of scroll window
  30.             CL = column of upper left corner of scroll window
  31.             DH = row of lower right corner of scroll window
  32.             DL = column of lower right corner of scroll window
  33.       */
  34.  
  35.       regs.h.al = (unsigned char)num_lines;
  36.       regs.h.bh = (unsigned char)vattrib;
  37.       regs.h.ch = (unsigned char)ulrow;
  38.       regs.h.cl = (unsigned char)ulcomumn;
  39.       regs.h.dh = (unsigned char)lrrow;
  40.       regs.h.dl = (unsigned char)lrcolumn;
  41.  
  42.       if (direction == SCROLL_UP)
  43.             regs.h.ah = 0x06;
  44.       else  regs.h.ah = 0x07;
  45.  
  46.       int86(0x10, ®s, ®s);
  47. }
  48.