home *** CD-ROM | disk | FTP | other *** search
- Turbo Basic Hercules Graphics Card Library
- ==========================================
-
- By
- Maximillian Habibi.
-
- The Turbo Basic HGC Library is designed for use in programs requiring
- graphics output on a Hercules Monochrome Graphics Card. It requires
- that you have a genuine HGC or compatible graphics card. No VGA/EGA
- emulations allowed! The library adds a few subroutines performing
- similar TB functions on the card. The subroutines are:
-
- HGRAPH - Switches to Hercules Graphics mode using page 1.
-
- HTEXT - Switches back to text mode using page 0.
-
- HCLR - Clears the graphics screen.
-
- HPSET - Like the normal PSET command. Plots a point at specified
- location.
-
- HLINE - Draws a line between the specified points.
-
- HBOX - Draws a box of the given dimensions.
-
- HCIRCLE - Draws a circle of the given radius at the specified
- location.
-
- HPRINT - Prints text in graphics mode at the specified location.
-
- To use the subroutines in your program, HGCLIB.BAS must be in the TB
- working directory. Add the following line to the beginning of your program:
-
- $INCLUDE "HGCLIB.BAS"
-
- When compiled, your program will have the subroutines "built-in" to it.
- To call the subroutines, you need to use the CALL statment, with the
- needed parameters (if any).
-
- CALL <subroutine>(parameters)
-
- The parameters that they need are as follows:
-
- CALL HGRAPH
-
- Needs no parameters.
-
- CALL HTEXT
-
- Needs no parameters.
-
- CALL HCLR
-
- Needs no parameters.
-
- CALL HPSET(x%,y%,c%)
-
- x% is the X location (0-719), y% is the Y location (0-347) and c% is
- the colour (0=black, 1=white).
- Example:
-
- CALL HPSET(10,100,1)
-
- Plots a point at X 10 Y 100 in white.
-
- CALL HLINE(x1%,y1%,x2%,y2%,c%)
-
- x1% is the X starting location, y1% is the Y starting location, x2% is
- the X destination location, y2% is the Y destination location and c% is
- the colour, 0 or 1.
- Example:
-
- CALL HLINE(20,50,500,300,1)
-
- Draws a line from X 20 Y 50 to X 500 Y 300 in white.
-
- CALL HBOX(x1%,y1%,x2%,y2%,c%)
-
- x1% and y1% are the co-ordinates for the top left corner, x2% and y2%
- are the co-ordinates for the bottom right corner, c% is the colour, 0
- or 1.
- Example:
-
- CALL HBOX(20,20,300,300,1)
-
- Draws a box with top left corner at: X 20 Y 20 and bottom right corner
- at: X 300 Y 300 in white.
-
- CALL HCIRCLE(a%,b%,r%,e,c%)
-
- a% and b% are the co-ordinates for the circle's centre, r% is the
- radius, e is the eccentricity of the circle by changing the ratio of X
- to Y. Because the HGC's pixels are rectangular, a ratio of 1 will give
- a tall ellipse. 0.75 or 0.5 should be ok for a circle. c% is the
- colour, 0 or 1.
- Example:
-
- CALL HCIRCLE(50,50,120,.75,1)
-
- Draws a circle at X 50 Y 50 with a radius of 120 pixels. A ratio of
- 0.75, giving a rough circle and drawn in white.
-
- CALL HPRINT(r%,c%,s$)
-
- r% is the row, c% is the column and s$ is the string to print. Note
- the screen in garphics mode holds 90 columns by 34 rows.
- Example:
-
- CALL HPRINT(25,50,"Hello!")
-
- Prints Hello at location row: 25 column: 50.
-
-
- N.B. After the program has finished, or graphics is no longer needed,
- The command CALL HTEXT MUST be issued, otherwise the program will
- appear to crash the system. What is actually happening is, the text is
- going to the text screen, and you are looking at the graphics screen,
- so you don't see it!
- Also, before you use the graphics screen you must clear it with CALL
- HCLR otherwise it will be full of garbage and previous graphics,
- rendering it unusable.
-
- These Turbo Basic routines should be useful to many people, have fun!
-
- Maximillian Habibi.