home *** CD-ROM | disk | FTP | other *** search
-
- Enhanced Graphics Adapter toolbox in TURBO pascal:
-
- Authors: Frank Guenther (compuserve 76545,666)
- Steve Olson
-
- date : Dec 2 1985
-
- Contact at "The Programmer's Toolbox"
- (301) 540-7230 (data)
-
- ************************************
- These functions and procedures are
- in the public domain.
- ************************************
-
- This file: egatool.arc, should yield three files;
-
- ega.doc : This file
- egatools.pas: Turbo pascal toolbox for the EGA;
- setpal.pas : Program that will change the EGA palette from command
- line arguments.
-
- The following procedures and functions are included in the toolbox.
-
- procedure writestr(string,col,row,color);
- Writes a string at the specified column and row coordinates in color
-
- procedure egaset(mode);
- Sets the ega card to the specified mode (16=hi res);
-
- procedure setmode(mode);
- Sets the ega card to the specified read/write mode.
-
- procedure setpalette(palette,color);
- Sets the palette to the specified color value (0-63);
-
- procedure egainfo;
- Returns information abount the ega card in th following variables:
- ega_mode : The current mode of the ega card;
- ega_mem : The amount of memory available to the ega card.
- ega_feature : The current setting of the feature bits.
- ega_switch : The current switch setting of the ega.
-
- procedure hrpixel(x,y,color);
- Sets the pixel at the x and y coordinate to color;
-
- function getpixval(x,y):integer;
- Returns the color of pixel x:y.
-
- function readpix(x,y,color):integer;
- Returns the bitmask in the high order byte and the pixel flags in the
- low order byte. Used by the testpix and findpix procedures.
-
- function testpix(x,y,color):boolean;
- Returns true if the x:y pixel is the specified color. It returns false
- if its another color.
-
- function findpix(x,y,color):integer;
- Returns zero if the x:y pixel is the specified color, returns the
- x offset if there is a pixel of the specified color in the same
- byte as the x:y pixel. Example: pixel 100:100 is blue, if you
- query pixel 96:100 for blue the returned value will be 4. Thus
- you can calculate the nearest pixel by adding the return value
- to x. It returns -99 if no pixel is found matching the color.
-
- procedure hrclear(color);
- Clears the screen to the specified color palette.
-
- procedure hrline(x,y,x2,y2,color);
- draws a line from x:y to x2:y2 inthe specified color.
-
- procedure drawbox(x,y,x2,y2,color);
- The coordinates x:y and x2:y2 define opposite corners of the box.
-
- procedure fillbox(x,y,x2,y2,color);
- Fills the defined box with the specified color.
-
- procedure xorbox(x,y,x2,y2,xorvalue);
- Inverts the color within the defined box. Succesive xor's will return
- the original screen. The variable xorvalue should be $F or $7 to get
- the best results. Used in conjuction with setpalette, you can change
- the color to anything you want.
-
- procedure xorstring(col,row,length);
- Inverts the text at the defined row and column. Length is the length
- of the text to invert.
-
- procedure drawcircle(x,y,radius,color,flags);
- Draws a circle at x:y of the specified color and radius. The flags
- variable specifies the amount of the circle to be drawn.
- $FF= full cicle
- $0F= half circle (top);
- $F0= half circle (bottom);
- $3C= half circle (left);
- $C3= half circle (right);
- $03= quarter circle (top,left);
- $08= eighth of a circle.
-
- procedure palette;
- Displays the default palette of the screen in 16 squares.
-
- procedure interact;
- Accepts the left and right arrow keys to choose a palette.
- Accepts the up and down arrow keys to alter the palette.
- Use ESC to exit the procedure.
-
- The file egatools will compile into a demostration program that displays
- the current palette and allows input of the arrow keys to choose and
- alter a palette. The palette values will then be displayed.
-
- The file setpal will compile into a program which will alter a number of
- palettes to user specified values. The format of the command line arguments
- are:
-
- setpal NN:MM .... where nn=palette number and mm=value.
- setpal 0:3 7:1 sets background to cyan and forground to blue.
-
- Further information on the ega can be found in BYTE 10(11) 1985 page 209
- or IBM Personal Computer Seminar Proceedings volume 2, number 11-1 (1985)
-
- enjoy....