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

  1. /**
  2. *
  3. * Name        scpages -- Return the number of video display pages for
  4. *               the current video device and mode.
  5. *
  6. * Synopsis    num_pages = scpages();
  7. *
  8. *        int num_pages      The number of display pages.
  9. *
  10. * Description    This function reports the number of pages supported on
  11. *        the current video display adapter in the current mode.
  12. *        It returns 1 for modes that do not support multiple
  13. *        pages, such as mode 7 on the Monochrome Adapter.
  14. *
  15. *        Use SCAPAGE to display any given page.    Use SCPAGE to
  16. *        direct C TOOLS PLUS screen output to any page, whether
  17. *        it is currently displayed or not.
  18. *
  19. * Returns    num_pages      The number of display pages.
  20. *
  21. * Version    3.0 (C)Copyright Blaise Computing Inc.    1986
  22. *
  23. **/
  24.  
  25. #include <bscreen.h>
  26.  
  27. int scpages()
  28. {
  29.     int pages;
  30.     int mode,columns,act_page;
  31.  
  32.     if (!b_know_hw)
  33.     scequip();              /* Sense hardware present.      */
  34.  
  35.     pages = 0;                  /* In case of impossible          */
  36.                       /* conditions.              */
  37.  
  38.     if (b_ega == scmode(&mode,&columns,&act_page))
  39.     switch (mode)              /* Enhanced Graphics Adapter    */
  40.     {
  41.         case 0:
  42.         case 1:
  43.         if (scrows() == 25)
  44.             pages = 8;
  45.         else              /* Presumable 43-line mode      */
  46.             pages = ((b_mem_ega == 64) ? 4 : 8);
  47.         break;
  48.         case 2:
  49.         case 3:
  50.         if (scrows() == 25)
  51.             pages = ((b_mem_ega == 64) ? 4 : 8);
  52.         else              /* Presumable 43-line mode      */
  53.             pages = b_mem_ega >> 5;
  54.         break;
  55.         case 4:
  56.         case 5:
  57.         case 6:
  58.         case 7:
  59.         pages = 1;
  60.         break;
  61.         case 13:
  62.         pages = b_mem_ega >> 5;
  63.         break;
  64.         case 14:
  65.         pages = b_mem_ega >> 6;
  66.         break;
  67.         case 16:
  68.         pages = (b_mem_ega == 256) ? 2 : 1;
  69.         break;
  70.     }
  71.     else
  72.     switch (mode)
  73.     {
  74.         case 0:
  75.         case 1:
  76.         pages = 8;          /* Color/Graphics Adapter 40 col*/
  77.         break;
  78.         case 2:
  79.         case 3:
  80.         pages = 4;          /* Color/Graphics Adapter 80 col*/
  81.         break;
  82.         case 4:              /* CGA  medium-res graphics     */
  83.         case 5:              /* CGA  medium-res graphics     */
  84.         case 6:              /* CGA  high-res     graphics     */
  85.         case 7:              /* Monochrome Adapter          */
  86.         case 8:              /* PCjr low-res     graphics     */
  87.         case 9:              /* PCjr medium-res graphics     */
  88.         case 10:              /* PCjr high-res     graphics     */
  89.         pages = 1;
  90.         break;
  91.     }
  92.  
  93.     return pages;
  94. }
  95.