home *** CD-ROM | disk | FTP | other *** search
- March 19, 1987
-
-
- SCRN.ARC is a collection of MSC callable functions that provide
- fast direct screen reading and writing of chars, strings, and
- blocks of screen memory while *automatically* turning horizontal
- retrace checking on/off based on the type of video card in use.
- The scrn_init() function checks for monochrome or EGA adapters,
- and if it finds neither, assumes that a CGA card is in use and
- turns on horizontal retrace checking to prevent snow. When retrace
- checking is enabled, all screen i/o is performed one byte at a time
- to prevent even left edge snowing. You also have the option of
- playing it safe and manually setting retrace checking to on.
-
- Included are functions for real and logical cursor positioning,
- color/attribute setting, scrolling, determining various video
- types and settings, etc....And just for fun, a zoom-in window
- similar to Procomm's exploding windows. ZOOMDEMO.EXE is an
- example of most of the functions in use.
-
- IMPORTANT - Before using any scrn_xxx function, two steps must
- be taken, preferably from within main()'s source file:
-
- 1) Declare a structure of type SCRN. Example: SCRN scrn;
-
- 2) Initialize the structure. Example: scrn_init(&scrn);
-
- Without these two steps, your computer will probably freeze. Freezing
- can also be cause by passing an incorrect number of parameters,
- but the compiler will warn you about that as long as you include
- the function declarations in the video.h file. One other cause of
- freezing is incorrectly passing the structure address, like using
- the address operator (&) from inside a function you've already passed
- the structure's address to. I highly recommend using the MSC /W2
- switch to add warnings of such things during compiling.
-
-
- Most of the functions in SCRN.ARC are used in ZOOMDEMO.EXE and are
- documented in their source files. Here is a brief listing of each
- function's type declaration, it's description, and example usage.
-
- void scrn_init(SCRN *) - Initializes the screen data structure with
- information specific to the type of video adapter in use and it's
- current mode. Must be called prior to any other scrn_xxx functions.
-
- Ex: SCRN xxx;
- scrn_init(&xxx);
-
-
- void scrn_puts(char *, SCRN *) - Writes a string at the current logical
- cursor position, with the current attribute. The logical cursor is
- updated.
-
- Ex: scrn_puts("Bop 'til you drop", &xxx);
-
-
- void scrn_putca(int, SCRN *) - Writes a char at the current logical
- cursor position with the current attribute. The logical cursor
- is advanced.
-
- Ex: scrn_putca('X', &xxx);
-
-
- int scrn_getca(int *, SCRN *) - Reads the char and attribute at the
- current logical cursor position. The return value is the char.
- The attribute is contained in int* upon return. The logical
- cursor is advanced.
-
- Ex: int ch, at;
- ch = scrn_getca(&at, &xxx);
-
-
- void scrn_save(int, int, int, int, char *, SCRN *) - Saves a rectangular
- area of the screen to a user defined buffer.
-
- Ex: scrn_save(LEFT, RIGHT, TOP, BOTTOM, &buff, &xxx);
-
-
- void scrn_restore(int, int, int, int, char *, SCRN *) - Restores a user
- defined buffer to a rectangular area of the screen. Same parameters
- as scrn_save.
-
-
-
- void scrn_pos(int, int, SCRN *) - Positions the logical cursor (offset
- within the screen buffer).
-
- Ex: scrn_pos(10, 10, &xxx);
-
-
- void scrn_attrib(int, SCRN *) - Sets the attribute for subsequent writes.
- See video.h for attribute definitions.
-
- Ex: scrn_attrib(INVERSE, &xxx);
-
-
- void scrn_color(int, int, SCRN *) - Sets the foreground and background
- color attribute for subsequent writes. See video.h for colors.
-
- Ex: scrn_color(fore, back, &xxx);
-
-
- void scrn_set_cga(int, SCRN *) - Allows manual override of the automatic
- horizontal retrace checking switch. Passing 0 turns off retrace
- checking, 1 turns it on.
-
- Ex: scrn_set_cga(TRUE, &xxx);
-
-
- void scrn_border(int, int, int, int, int, SCRN *) - Draws a lined
- border at the given parameters with the current attribute.
- If TYPE = 1 a single line else a double line
-
- Ex: scrn_border(LEFT, RIGHT, TOP, BOTTOM, TYPE, &xxx);
-
-
- void scrn_hborder(int, int, int, int, SCRN *) - Draws a double lined
- half border with the current attribute. In other words, writes a
- top and bottom border with corners.
-
- Ex: scrn_hborder(LEFT, RIGHT, TOP, BOTTOM, &xxx);
-
-
- void scrn_wzoom(int, int, int, int, char *, int, SCRN *) - Draws a
- zoom-in window with the current attribute and saves the area
- used to a user defined buffer which may be restored with
- scrn_restore. Uses same type variables as scrn_border.
-
- Ex: scrn_wzoom(LEFT, RIGHT, TOP, BOTTOM, &buff, TYPE, &xxx);
-
-
-
- int vid_state(int *) - Returns the current video mode (mono, CO80, etc.)
- and places the screen column width in int*. See video.h for modes.
-
- Ex: int cols, mode;
- mode = vid_state(&cols);
-
-
-
- void vid_init(int) - Sets the desired video mode. See video.h.
-
- Ex: vid_init(CO80); /* set video to color/80 columns */
-
-
-
- void vid_page(int) - Selects the desired video page.
-
- Ex: vid_page(0); /* select page zero */
-
-
-
- void vid_set_cur(int, int) - Sets the real cursor position.
-
- Ex: vid_set_cur(10,10);
-
-
-
- void vid_get_cur(int *, int *) - Saves the real cursor position to
- two user defined integers.
-
- Ex: int row, col;
- vid_get_cur(&row, &col); /* must pass address */
-
-
-
- void vid_cur_right(int) - Moves the real cursor right n times.
-
- Ex: vid_cur_rt(15);
-
-
-
- void vid_cur_switch(int) - Turns the real cursor on/off.
-
- Ex: vid_cur_switch(OFF); /* OFF = 0, ON = 1 */
-
-
-
- void vid_up(int, int, int, int, int, int) - Scrolls a rectangular
- piece of the screen up by n positions with a given attribute.
-
- Ex: vid_up(0, LEFT, RIGHT, TOP, BOTTOM, BLUE);
- If n = 0, the area will be blanked with the given attribute,
- in this case BLUE.
-
-
- void vid_down(int, int, int, int, int, int) - Scrolls down. Same
- parameters as vid_up.
-
-
-
- int vcard_type(void) - Returns a value indicating the current video card
- in use.
- 0 = Monochrome adapter
- 1 = Color Graphics Card
- 2 = Enhanced Graphics Adapter
-
-
-
- Now the disclaimer...Although a reasonable amount of research, testing,
- and experimenting has gone into this batch of functions, I make no
- guarantees, implied or expressed, etc., etc.
-
- Also, having only recently learned MSC and MASM, I wholeheartedly
- welcome any comments or suggestions.
-
- Thanks...hope you find these useful.
-
- Tim Spencer - Compuserve [73657,1400]