home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / EGATOOLS.ZIP / EGA.DOC next >
Encoding:
Text File  |  1985-12-02  |  4.7 KB  |  123 lines

  1.  
  2. Enhanced Graphics Adapter toolbox in TURBO pascal:
  3.  
  4. Authors:  Frank Guenther   (compuserve 76545,666)
  5.           Steve Olson
  6.  
  7. date   :  Dec 2 1985
  8.  
  9. Contact at "The Programmer's Toolbox"
  10.             (301) 540-7230  (data)
  11.  
  12. ************************************
  13.   These functions and procedures are
  14.   in the public domain.
  15. ************************************
  16.  
  17. This file: egatool.arc, should yield three files; 
  18.    
  19.         ega.doc     : This file
  20.         egatools.pas: Turbo pascal toolbox for the EGA;
  21.         setpal.pas  : Program that will change the EGA palette from command
  22.                       line arguments.
  23.  
  24. The following procedures and functions are included in the toolbox.
  25.  
  26. procedure writestr(string,col,row,color);
  27.         Writes a string at the specified column and row coordinates in color
  28.  
  29. procedure egaset(mode);
  30.         Sets the ega card to the specified mode (16=hi res);
  31.  
  32. procedure setmode(mode);
  33.         Sets the ega card to the specified read/write mode.
  34.  
  35. procedure setpalette(palette,color);
  36.         Sets the palette to the specified color value (0-63);
  37.  
  38. procedure egainfo;
  39.         Returns information abount the ega card in th following variables:
  40.                 ega_mode    : The current mode of the ega card;
  41.                 ega_mem     : The amount of memory available to the ega card.
  42.                 ega_feature : The current setting of the feature bits.
  43.                 ega_switch  : The current switch setting of the ega. 
  44.  
  45. procedure hrpixel(x,y,color);
  46.         Sets the pixel at the x and y coordinate to color;
  47.  
  48. function getpixval(x,y):integer;
  49.         Returns the color of pixel x:y.
  50.  
  51. function readpix(x,y,color):integer;
  52.         Returns the bitmask in the high order byte and the pixel flags in the
  53.         low order byte.  Used by the testpix and findpix procedures. 
  54.  
  55. function testpix(x,y,color):boolean;
  56.         Returns true if the x:y pixel is the specified color. It returns false
  57.         if its another color.
  58.  
  59. function findpix(x,y,color):integer;
  60.         Returns zero if the x:y pixel is the specified color, returns the 
  61.         x offset if there is a pixel of the specified color in the same
  62.         byte as the x:y pixel.  Example: pixel 100:100 is blue, if you
  63.         query pixel 96:100 for blue the returned value will be 4. Thus 
  64.         you can calculate the nearest pixel by adding the return value
  65.         to x.  It returns -99 if no pixel is found matching the color.
  66.  
  67. procedure hrclear(color);
  68.         Clears the screen to the specified color palette.
  69.  
  70. procedure hrline(x,y,x2,y2,color);
  71.         draws a line from x:y to x2:y2 inthe specified color.
  72.  
  73. procedure drawbox(x,y,x2,y2,color);
  74.         The coordinates x:y and x2:y2 define opposite corners of the box.
  75.  
  76. procedure fillbox(x,y,x2,y2,color);
  77.         Fills the defined box with the specified color.
  78.  
  79. procedure xorbox(x,y,x2,y2,xorvalue);
  80.         Inverts the color within the defined box. Succesive xor's will return
  81.         the original screen.  The variable xorvalue should be $F or $7 to get
  82.         the best results.  Used in conjuction with setpalette, you can change
  83.         the color to anything you want.
  84.  
  85. procedure xorstring(col,row,length);
  86.         Inverts the text at the defined row and column. Length is the length 
  87.         of the text to invert.
  88.  
  89. procedure drawcircle(x,y,radius,color,flags);
  90.         Draws a circle at x:y of the specified color and radius.  The flags
  91.         variable specifies the amount of the circle to be drawn.
  92.              $FF= full cicle
  93.              $0F= half circle (top);
  94.              $F0= half circle (bottom);
  95.              $3C= half circle (left);
  96.              $C3= half circle (right);
  97.              $03= quarter circle (top,left);
  98.              $08= eighth of a circle.
  99.  
  100. procedure palette;
  101.         Displays the default palette of the screen in 16 squares.
  102.  
  103. procedure interact;
  104.         Accepts the left and right arrow keys to choose a palette.
  105.         Accepts the up and down arrow keys to alter the palette.
  106.         Use ESC to exit the procedure.
  107.  
  108. The file egatools will compile into a demostration program that displays
  109. the current palette and allows input of the arrow keys to choose and
  110. alter a palette.  The palette values will then be displayed.
  111.  
  112. The file setpal will compile into a program which will alter a number of 
  113. palettes to user specified values.  The format of the command line arguments
  114. are:
  115.  
  116.         setpal NN:MM ....    where nn=palette number and mm=value.
  117.         setpal 0:3 7:1       sets background to cyan and forground to blue.
  118.  
  119. Further information on the ega can be found in BYTE  10(11) 1985 page 209
  120. or IBM Personal Computer Seminar Proceedings volume 2, number 11-1 (1985)
  121.  
  122. enjoy....
  123.