home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 11 / 11.iso / m / m110 / 1.ddi / HLL / MSC / GRASPMSC.C next >
Encoding:
C/C++ Source or Header  |  1990-02-12  |  1.7 KB  |  50 lines

  1. /***********************************************************
  2.     Microsoft C (or Quick C) version 5.0, 5.1 program
  3.     demonstrating interface to GRASP.
  4.  
  5.     NOTE: When compiling in small or medium memory models,
  6.     this code will generate a warning message at the line
  7.     where Strlen() is called. This is because Strlen()
  8.     expects a near pointer as an argument, but the Grasp
  9.     command strings must be declared far in order to use
  10.     FP_SEG to initialize the ES register. You may safely
  11.     ignore the warning message, or eliminate it (in small
  12.     and medium models) by using the SEGREAD function to
  13.     determine the value of DS and setting ES to the same
  14.     value.
  15. ************************************************************/
  16.  
  17. #include <string.h>                     /* include string functions */
  18. #include <dos.h>                        /* include interrupt functions */
  19.  
  20. union REGS inregs, outregs;             /* register data structures */
  21. struct SREGS segregs;
  22.  
  23. #define GRASPCALL 0x10            /* we want interrupt 10h */
  24.  
  25. char far *cmds[] = {        /* array of GRASP commands */
  26.     "Pload Grasp,1",        /* must be far pointers for FP_SEG to work */
  27.     "Pfade 0,1",
  28.     "Waitkey"
  29. };
  30.  
  31. main()
  32. {
  33.     Grasp(cmds[0]);        /* load picture into buffer 1 */
  34.     Grasp(cmds[1]);        /* fade it onto the screen */
  35.     Grasp(cmds[2]);        /* wait for user keystroke */
  36. }
  37.  
  38. Grasp(command)
  39. char far *command;
  40. {
  41.     inregs.x.cx = strlen(command);        /* CX = length of command */
  42.     segregs.es = FP_SEG(command);
  43.     inregs.x.dx = FP_OFF(command);        /* ES:DX points to string */
  44.     inregs.h.ah = 'G';                /* do function 'G' */
  45.  
  46.     /* perform the interrupt */
  47.  
  48.     int86x(GRASPCALL, &inregs, &outregs, &segregs);
  49. }
  50.