home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / DESQVIEW / TECH / DVA_TCPP.ZIP / DVGETVID.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-06  |  3.4 KB  |  75 lines

  1. /***************************************************************************\
  2. *
  3. *
  4. *   PROCEDURE         - Get DESQview Video Buffer
  5. *
  6. *   PURPOSE           - From DESQview API Manual:
  7. *                       Return the address of the Logic Window buffer for the
  8. *                       current task and begins "shadowing" changes to the
  9. *                       buffer.  Programs that have been written to place
  10. *                       text directly into the display memory can be easily
  11. *                       converted to run in a small window by making this
  12. *                       call and writing into the Logical Window Buffer
  13. *                       instead.  DESQview checks periodically to see if the
  14. *                       contents of the buffer have changed and, if so,
  15. *                       updates the display accordingly.  The assumed value
  16. *                       on entry should contain the address of display memory
  17. *                       that the program would write into if running outside
  18. *                       DESQview.  If this routine is called outside DESQview
  19. *                       it does nothing but return with the assumed value.
  20. *                       You can, therefore, make this call and trust the
  21. *                       results either inside of outside DESQview.
  22. *
  23. *                       There is no need to synchronize with video retrace
  24. *                       when writing into the Logical Window Buffer.
  25. *
  26. *   GENERAL ALGORITHM - Call the DESQview (TOPview standard) video function
  27. *                       to return the video buffer address.
  28. *
  29. *   INPUT             - The assumed segment pointer of screen memory.
  30. *
  31. *   OUTPUT            - The assumed segment pointer given if not in DESQview,
  32. *                       or the DESQview video buffer segment if in DESQview.
  33. *
  34. *   SYSTEM            - Borland's Turbo C++ v1.0 on an EPSON EQUITY III+
  35. *                       running MS-DOS v4.01 & DESQview v2.26.  Should operate
  36. *                       under any MS/PC-DOS 2.x or greater & DESQview 2.x or
  37. *                       greater.
  38. *
  39. *   HISTORY:
  40. *      90-07-28       - Initiated Mark Potter
  41. *
  42. \***************************************************************************/
  43.  
  44. #include <dos.h>
  45. #include "dvaware.h"
  46.  
  47. //
  48. // Machine code to push and pop various registers.
  49. // implemented using #define instead of inline to avoid possible problems
  50. // if Options/Compiler/C++ options.../Out-of-line inline functions turned on
  51. // (or -vi isn't included in the command line compiler.
  52. //
  53. #define pushdi() __emit__( 0x57 )
  54. #define pushes() __emit__( 0x06 )
  55. #define popdi()  __emit__( 0x5F )
  56. #define popes()  __emit__( 0x07 )
  57.  
  58.  
  59. char _seg* dv_get_video_buffer(         // returns video buffer segment
  60.    char _seg* assumed                   // assumed video buffer segment
  61. ) {
  62.    pushdi();                            // save registers
  63.    pushes();                            // save registers
  64.    _ES = (unsigned int)assumed;         // get assumed segment into es
  65.    _AH = 0xFE;                          // call get buffer
  66.    geninterrupt( 0x10 );                // video BIOS call
  67.    _AX = _ES;                           // put segment into accumulator
  68.    popes();                             // restore registers
  69.    popdi();                             // restore registers
  70.    return (char _seg*)_AX;              // return segment
  71. }
  72.  
  73. // END DVGETVID.CPP
  74. 
  75.