home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / prof_c / 05oslib / bios / scroll.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  1.0 KB  |  43 lines

  1. /*
  2.  *    scroll -- scroll a region of the "visual" screen
  3.  *    page up or down by n rows (0 = initialize region)
  4.  */
  5.  
  6. #include <dos.h>
  7. #include <local\std.h>
  8. #include <local\bioslib.h>
  9.  
  10. int
  11. scroll(t, l, b, r, n, a)
  12. int t;    /* top row of scroll region */
  13. int l;    /* left column */
  14. int b;    /* bottom row */
  15. int r;    /* right column */
  16. int n;    /* number of lines to scroll */
  17.     /* sign indicates direction to scroll */
  18.     /* 0 means scroll all lines in the region (initialize) */
  19. unsigned char a;/* attribute for new lines */
  20. {
  21.     union REGS inregs, outregs;
  22.  
  23.     if (n < 0) {
  24.         /* scroll visual page down n lines */
  25.         inregs.h.ah = SCROLL_DN;
  26.         inregs.h.al = -n;
  27.     }
  28.     else {
  29.         /* scroll visual page up n lines */
  30.         inregs.h.ah = SCROLL_UP;
  31.         inregs.h.al = n;
  32.     }
  33.     inregs.h.bh = a;    /* attribute of blank lines */
  34.     inregs.h.bl = 0;
  35.     inregs.h.ch = t;    /* upper-left of scroll region */
  36.     inregs.h.cl = l;
  37.     inregs.h.dh = b;    /* lower-right of scroll region */
  38.     inregs.h.dl = r;
  39.     int86(VIDEO_IO, &inregs, &outregs);
  40.  
  41.     return (outregs.x.cflag);
  42. }
  43.