home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************/
- /* */
- /* T X _ D E M O . C - Demo of HSA_TEXT Library */
- /* */
- /************************************************************************/
-
- /************************************************************************/
- /* */
- /* Copyright (c) Hardwood Software Associates 1986 */
- /* */
- /* Hardwood Software Associates */
- /* 364 Benson Road */
- /* Northbridge, Ma 01534 */
- /* */
- /************************************************************************/
-
- /*************************************************************************
- * T X _ D E M O E D I T L O G
- * $Log: D:/CRT/VCS/TX_DEMO.C_V $
- *
- * Rev 1.1 14 Feb 1988 9:30:06 R. Evans
- * Add new compiler support and mouse
- *
- * Rev 1.0 07 Nov 1987 16:10:18 R. Evans
- * Initial revision.
- ************************************************************************/
-
- /************************************************************************
- * +-------------------+
- * Author: R. Evans | F U N C T I O N S |
- * Date: October, 1986 +-------------------+
- *
- ************** TX_DEMO - HSA_TEXT Demo
- * SYNOPSIS:
- * tx_demo [B|D]
- * B - Use BIOS routine
- * D - Use direct access
- * DESCRIPTION:
- * Demo the important aspects of the HAS_TEXT library.
- *
- *************************************************************************/
- #include "stdio.h"
- #include "hsa_tx.h"
-
- #define FALSE 0
- #define TRUE 1
-
- int direct = TRUE;
- int mono;
- int save [SCREEN_WIDTH*SCREEN_LENGTH];
-
- main (argc,argv)
- int argc;
- char *argv[];
- {
- mono = (tx_state () == MONOCHROME); /* Set crt type */
-
- if (*argv[1] == 'B' || *argv[1] == 'b')
- direct = FALSE;
- else
- tx_direct ();
- introduction ();
- pause ("About to save entire screen.");
- tx_rd_blk (0,0,save,SCREEN_LENGTH,SCREEN_WIDTH);
- pause ("Screen saved.");
- description ();
- pause ("About to restore previously save screen.");
- tx_wr_blk (0,0,save,SCREEN_LENGTH,SCREEN_WIDTH);
- pause ("");
- tx_bios (); tx_loc (22,0); tx_cur_show ();
- }
-
- heading ()
- {
- tx_clr ();
- tx_str_a (0,18,"HSA_TEXT",SCR_BOLD);
- tx_str_c (" - Text Mode Screen Control \"");
- if (direct)
- tx_str_a_c ("DIRECT",(mono)?SCR_UNDER:SCR_GREEN);
- else
- tx_str_a_c ("BIOS",(mono)?SCR_UNDER:SCR_RED);
- tx_str_c ("\"");
- } /* Of heading */
-
- introduction ()
- {
- heading ();
- box (10);
- tx_str (4,5,"HSA_TEXT is a library of C functions that provide direct, fast control");
- tx_str (5,5,"over the IBM PC screen in text mode. Also included are functions to");
- tx_str (6,5,"allow mouse interfacing. The functions have been developed and tested");
- tx_str (7,5,"for the Microsoft version 5.00 and Turbo C version 1.5 by Hardwood");
- tx_str (8,5,"Software Associates.");
- tx_str (10,25,"We hope you find them useful.");
- pause ("");
- } /* Of introduction */
-
- description ()
- {
- heading ();
- box (14);
- tx_attr_set (MAKE_ATTR(SCR_WHITE|SCR_INTENSE_BIT,SCR_BLUE));
-
- tx_str (5,2,"This program is a brief demonstration of some of the capabilities of the");
- tx_str (6,2,"HSA_TEXT library. It accepts a single parameter on the command line:");
- tx_str (7,2,"B - BIOS mode; D - DIRECT mode. BIOS mode is the most portable. DIRECT");
- tx_str (8,2,"mode is much faster. ");
-
- tx_str (10,2,"HSA_TEXT is a complete set of functions for displaying and manipulating");
- tx_str (11,2,"the text mode screen on an IBM PC. In addition to functions to display text");
- tx_str (12,2,"HSA_TEXT contains functions to rapidly read and write blocks of screen data.");
- tx_str (13,2,"Functions that read text only from the screen are also included. ");
- tx_norm ();
- pause ("");
- }
- box (size)
- int size;
- {
- int i;
- tx_attr_set (MAKE_ATTR(SCR_WHITE|SCR_INTENSE_BIT,SCR_BLUE));
- tx_chr (2,0,'╔');
- tx_fill_c ('═',78);
- tx_chr_c ('╗');
- for (i=3;i<size+2;i++)
- {
- tx_chr (i,0,'║');
- tx_chr (i,79,'║');
- }
- tx_chr (size+2,0,'╚');
- tx_fill_c ('═',78);
- tx_chr_c ('╝');
- tx_norm ();
- }
- pause (msg)
- char *msg;
- {
- CRT_STATUS crt;
- tx_get_status (&crt);
- tx_cur_hide ();
- tx_str (24,0,msg);
- tx_str_c (" Press any key to continue.");
- getch ();
- tx_loc (24,0);
- tx_clr_eol ();
- tx_put_status (&crt);
- } /* Of pause */
-