home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************
- * COLOR VALUES TABLE DISPLAY PROGRAM FOR USE WITH DESQVIEW *
- * *
- * Copyright 1987, Phillip A. Kaufman. All rights, except those *
- * specifically granted herein are reserved by the author. The right *
- * to copy and distribute this material is granted without fee for *
- * any and all non-commercial use. This material specifically may *
- * not be distributed or sold for a fee nor incorporated in whole or *
- * in part into any other product that is distributed or sold for a *
- * fee without specific permission of the author. To obtain special *
- * permission or to report any difficulties with this material *
- * contact: *
- * Phillip A. Kaufman *
- * 19987 Moran Lane *
- * Saratoga, CA 95070 *
- * *
- * THIS MATERIAL IS DISTRIBUTED "as is" WITHOUT ANY EXPRESSED OR *
- * IMPLIED WARRANTY OR LIABILITY FOR DIRECT, INDIRECT OR *
- * CONSEQUENTIAL DAMAGES. *
- ************************************************************************
- * *
- * Use: ESC to exit *
- * *
- * Installation: Must be installed in Desqview environment. *
- * Requires a DV memory size of only 4k. Must set the *
- * window size to 18 high and 23 wide. *
- * *
- * Files: *
- * asciitbl.c this source file ( for MSC 4.0; *
- * compile with small model and link *
- * with stack of 150 bytes - IT IS *
- * REALLY IMPORTANT to either use linker *
- * directive to set stack or to use *
- * EXEMOD. Microsoft's default stack size*
- * is 2k and program will crash DV if *
- * loaded into a 4k segment.) *
- * asciitbl.exe compiled version of above - fits in 4k *
- * with room to spare! *
- * at-pif.dvp dv 2.0 pif file *
- * at-scrip.dvs dv 2.0 startup script for colors *
- ************************************************************************/
-
- #include <dos.h>
- char hex[] = "0123456789ABCDEF";
-
- union REGS rg; /* cpu regs */
- struct SREGS segregs;
- union {
- unsigned long l; /* long form of address */
- int far *p; /* pointer form of address */
- } addr;
-
- _setargv() /* dummy since we use no command line args */
- {
- }
- _setenvp() /* dummy since we don't use environment variables */
- {
- }
- _nullcheck() /* disable null pointer checking */
- {
- }
-
- main()
- {
- register int i, j, attr;
-
- /* Check for Desqview and use its buffer */
- rg.x.ax = 0x2B01; /* do date set as DV check */
- rg.x.cx = 0x4445; /* "DESQ"an illegal date */
- rg.x.dx = 0x5351;
- int86(0x21,&rg,&rg);
- if (rg.h.al != 0xFF){ /* we are in desqview */
- rg.h.ah = 0xFE; /* dv get buff addr */
- int86(0x10,&rg,&rg);
- segread(&segregs);
- addr.l=((unsigned long)segregs.es<<16)+(unsigned long)rg.x.di;
- }
- else {
- cputs ("\x07Program requires DESQview!\n");
- exit(1);
- }
-
- for (i=0; i <= 0x7; i++){
- for (j=0; j <=0xF; j++){
- attr = (i << 4 | j ) << 8;
- *addr.p = ' ' | attr;
- addr.p++;
- *addr.p = hex[i] | attr;
- addr.p++;
- *addr.p = hex[j] | attr;
- addr.p++;
- }
- *addr.p = ' ' | attr;
- addr.p++;
- }
-
- /* put the cursor outside the window */
- rg.h.ah = 0x2;
- rg.h.bh = 0;
- rg.x.dx = 0x154f; /* row 24 col 79*/
- int86(0x10,&rg,&rg);
-
- while (1) { /* loop, wait for ESC to exit */
- rg.h.ah = 0x07; /* kbd input, wait, no echo */
- int86(0x21,&rg,&rg);
- if (rg.h.al == 0x1B) exit (0); /* ESC */
- }
- }