home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / SCROLL.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  2KB  |  50 lines

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