home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
DESQC21.ZIP
/
DESQDEMO.C
< prev
next >
Wrap
Text File
|
1989-07-06
|
5KB
|
137 lines
/*==========================================================================*\
| DESQDEMO.C ver 2.1, 07-06-89 |
| |
| Demo for DESQview interface routines |
| |
| It is assumed that you are an operator of DESQview and that you are |
| familiar with its operation. |
| |
| TO TEST: |
| 1. Build the project file DESQDEMO.PRJ. |
| 2. Build the project file DESQLOOP.PRJ. |
| 3. Add these programs to DV with Direct video = "N". |
| 4. Run DESQloop in one or more windows, say 1 and 2. |
| 5. Run this program in another one, say 3. |
| 6. Observe results. |
| |
| TO USE: |
| 1. Follow instruction provided by DESQview. |
| 2. For high speed buffer writing to a DESQview window, use |
| QWIKC21.ARC. |
| |
| by James H. LeMay |
| |
| converted to Turbo C by |
| Jordan Gallagher |
| for Eagle Performance Software |
| TC Products |
| P.O. Box 292786 |
| Lewisville, TX 75029-2786 |
| |
| Conversion to Turbo C by Jordan Gallagher / Wisdom Research |
\*==========================================================================*/
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <dos.h>
#include <process.h>
#ifndef __TURBOC__
#include <graph.h>
#endif
#include "desqc21.h"
#define LO_CHAR(v) (v & 0x0f)
#define HI_CHAR(v) (v >> 4)
#define LO_INT(v) (v & 0xff)
#define HI_INT(v) (v >> 8)
unsigned videoseg;
int dv_version;
char str[30];
char _z;
#define tclock (*(long far *)(0x46CL+_z))
#define videomode (*(long far *)(0x449L+_z))
/********************************| htoa |************************************\
Converts a long to a string. The target string contains the long in
hexadecimal form, i.e. "21CF89A5".
The parameter hcnt specifies the amount of characters the target
string should contain.
The return value is a pointer to the target string.
\****************************************************************************/
char *htoa( long val, char hcnt, char *string )
{
if(hcnt > 4)
sprintf( string, "0x%*lX", hcnt, val );
else
if(hcnt > 2)
sprintf( string, "0x%0*X", hcnt, (int) val );
else
if(hcnt <= 2)
sprintf( string, "0x%0*hX", hcnt, (unsigned char) val );
return(string);
}
void suspend(unsigned ms)
{
long st=tclock;
while(tclock-st < 18*(ms/1000));
}
void main()
{
#ifdef __TURBOC__
directvideo=0; /* use BIOS writes */
#endif
if(videomode == 7) { /* set to mono or color segment */
videoseg=0xB000;
} else {
videoseg=0xB800;
}
videoseg=dv_get_video_buffer( videoseg );
dv_version=dv_get_version(); /* Optional */
#ifdef __TURBOC__
clrscr();
#else
_clearscreen(_GCLEARSCREEN);
#endif
if(!in_dv) {
printf( "DESQview not active\n" );
} else {
sprintf( str, "%4.2f", (float) (HI_INT(dv_version) +
(float) LO_INT(dv_version) / 100 ) );
printf( "DESQview version = %s\n", str );
printf( "Video Segment = %s\n", htoa( (long) videoseg, 4, str ) );
printf( "First character in row 1 is = %c\n",
*((unsigned char far *)(((unsigned long)videoseg)<<16)) );
printf( "All windows should now freeze for 3 seconds\n" );
#ifdef __TURBOC__
delay(1000);
#else
suspend(1000);
#endif
dv_begin_critical();
#ifdef __TURBOC__
delay(3000);
#else
suspend(3000);
#endif
dv_end_critical();
printf( "Now all windows will continue.\n" );
printf( "Test completed. Scroll back to see row 1." );
}
return;
}