home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 4.ddi / C / SCSCROLL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-05  |  2.6 KB  |  75 lines

  1. /**
  2. *
  3. * Name        scscroll -- Vertically scroll lines of text on the active
  4. *                display page using BIOS
  5. *
  6. * Synopsis    iret = scscroll(num_lines,attrib,u_row,u_col,l_row,l_col,dir);
  7. *
  8. *        int iret      0 is always returned.
  9. *        int num_lines      Number of lines to scroll.  A value of
  10. *                  0 specifies that all lines within the
  11. *                  window should be scrolled (thus
  12. *                  clearing the window)
  13. *        int attrib      The attribute to be used on the vacant
  14. *                  lines.  It has the background attribute
  15. *                  in the high order four bits of the low
  16. *                  order byte, and the foreground in the
  17. *                  low order nybble.
  18. *        int u_row,u_col   Upper left corner of window.
  19. *        int l_row,l_col   Lower right corner of window.
  20. *        int dir       Scrolling direction (SCR_UP or SCR_DOWN).
  21. *
  22. * Description    This function moves lines of characters within a defined
  23. *        window up or down.  The vacant lines are filled with
  24. *        blanks and a specified attribute.  The active display
  25. *        page is scrolled.  (Use SCPSCROL to scroll the current
  26. *        display page regardless of whether it is active.)
  27. *
  28. *        When the screen is in graphics mode, an attribute of 0
  29. *        is used on the vacant lines regardless of the value of
  30. *        attrib.  This prevents the vertical "pinstripes" seen on
  31. *        the IBM Color/Graphics Adapter when it is scrolled in
  32. *        graphics mode with a nonzero attribute.
  33. *
  34. * Returns    iret          Always returned as zero.
  35. *
  36. * Version    3.0    (C)Copyright Blaise Computing Inc. 1983, 1984, 1986
  37. *
  38. **/
  39.  
  40. #include <bscreen.h>
  41. #include <butility.h>
  42.  
  43. int scscroll(num_lines,attrib,u_row,u_col,l_row,l_col,dir)
  44. int num_lines,attrib,u_row,u_col,l_row,l_col,dir;
  45. {
  46.     int ax,bx,cx,dx,flags;           /* General registers           */
  47.     int mode,columns,apage;           /* Values returned by scmode    */
  48.     int last_row;
  49.  
  50.     scmode(&mode,&columns,&apage);
  51.     last_row = scrows() - 1;
  52.  
  53.     utbound(u_row,0,last_row)          /* Force reasonable values      */
  54.     utbound(u_col,0,columns - 1)
  55.     utbound(l_row,u_row,last_row)
  56.     utbound(l_col,u_col,columns - 1)
  57.     if (num_lines > (l_row - u_row) || num_lines < 0)
  58.     num_lines = 0;              /* Do not scroll more lines     */
  59.                       /* than there are in the window.*/
  60.     if ((mode > 3) && (mode != 7))    /* Force attribute for graphics */
  61.     attrib = 0;              /* (nonzero attribute creates   */
  62.                       /* pinstripes)              */
  63.  
  64.     /* Set up the registers and then call BIOS.               */
  65.  
  66.     ax = utbyword(dir == SCR_UP ? 6 : 7,num_lines);
  67.     bx = utbyword(attrib,0);
  68.     cx = utbyword(u_row,u_col);
  69.     dx = utbyword(l_row,l_col);
  70.  
  71.     bios(16,&ax,&bx,&cx,&dx,&flags);
  72.  
  73.     return(0);
  74. }
  75.