home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-2.ZIP / GFUNC / SCREEN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-30  |  2.0 KB  |  94 lines

  1. /*
  2.  * screen.c
  3.  * contains:  screen(),napage()
  4.  *
  5.  *   Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  6.  */
  7.  
  8. #include <stdio.h>
  9. #include "gfuncts.h"
  10.  
  11. int _napage;
  12.  
  13. /*
  14.  *  void
  15.  * screen(mode,burst,apage,vpage)
  16.  *
  17.  * ARGUMENT
  18.  *  (int)    mode    -    0..2
  19.  *                 0 = text mode at current width
  20.  *                 1 = 320x200 medium res color graphics
  21.  *                 2 = 640x200 high res graphics
  22.  *  (int)    burst    -    TRUE/FALSE
  23.  *                 mode 0:  TRUE enables color, False disables
  24.  *                 mode 1:  TRUE disables color, FALSE enables
  25.  *                 mode 2:  no actions
  26.  *  (int)    apage    -    active page: valid in mode 0 only.
  27.  *                 0..7 for 40 column, 0..3 for 80 column
  28.  *  (int)    vpage    -    visual page selected for display 0..7(3)
  29.  *
  30.  * DESCRIPTION
  31.  *  This functions exactly as the BASIC SCREEN statement.  Used to select
  32.  *  video modes, active pages etc.
  33.  *
  34.  * MODIFICATIONS:
  35.  *
  36.  *  "" Fri 10-Mar-1989 09:16:11
  37.  *
  38.  *   Modified to not set the video page if video mode is less than 4.
  39.  */
  40. void GF_CONV screen(mode,burst,apage,page )
  41. int mode,burst,apage,page;
  42. {
  43.     struct GFREGS out;
  44.     unsigned ccolumns,nmode,nvpage;
  45.     int xnapage;
  46.  
  47.     vstate(&out);
  48.     xnapage=apage;
  49.     if(xnapage<0||xnapage>7)
  50.         return;
  51.     ccolumns=out.bx;
  52.     switch(mode) {
  53.         case 0:
  54.             if (burst)
  55.                 nmode=ccolumns==80?3:1;
  56.             else
  57.                 nmode=ccolumns==80?2:0;
  58.             break;
  59.         case 1:
  60.             nmode=burst?5:4;
  61.             break;
  62.         case 2:
  63.             nmode=6;
  64.             break;
  65.         default:
  66.             nmode=2;
  67.             break;
  68.     }
  69.     if(mode==0)
  70.         nvpage=page;
  71.     vmode(nmode);
  72.     if(nmode<4)
  73.         vpage(nvpage);
  74. }
  75.  
  76. /*
  77.  *  void
  78.  * napage(n)
  79.  *
  80.  * ARGUMENT
  81.  *  (int)    n    -    Number of video page to write to
  82.  *
  83.  * DESCRIPTION
  84.  *  Many functions in this library write to a specified video page.  Usually
  85.  *  this is explicitly specified;  it can also be set in a global variable
  86.  *  and specified implicitly.  This function just set's the global variable
  87.  *  _napage to the value of the parameter.
  88.  */
  89. void GF_CONV napage(page)
  90. int page;
  91. {
  92.     _napage=page;
  93. }
  94.