home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c220 / 7.ddi / EXAMPLES / GRAPHICS / READ.ME < prev    next >
Encoding:
Text File  |  1991-01-28  |  5.0 KB  |  129 lines

  1. GRAPHICS
  2.  
  3. Example Protected Mode Interface to Real Mode Graphics Library.
  4. ---------------------------------------------------------------------------
  5.  
  6. This directory contains example code which demonstrates the
  7. real mode server/protected mode client relationship for an application
  8. which needs to mix real and protected mode code.
  9.  
  10. In this case the real mode server provides an interface to the
  11. Microsoft C library graphics routines.  The protected mode application
  12. is able to call these routines transparently through protected mode
  13. "glue" or "thunk" routines.
  14.  
  15. Though this example is specific to the Microsoft C graphics library,
  16. the method it demonstrates can, however, be adapted to provide an
  17. interface to other real mode code without too much problem.
  18.  
  19. Our sample application is a simple graphics program that draws 1000 random
  20. lines on a CGA-compatible graphics screen.  The sample program has been
  21. compiled with the 80386 MetaWare High C compiler and executes in protected
  22. mode under 386|DOS-Extender (RUN386).
  23.  
  24. Though the sample program only uses a few of the Microsoft C run-time library
  25. graphics routines, the "glue" code provides interfaces to all the entry points
  26. in the library.  You should be able to link the glue code with other
  27. protected mode applications to provide them with Microsoft C compatible graphics
  28. routines (see below).
  29.  
  30. This program demonstrates two different ways of interfacing real mode
  31. and protected mode.  One method uses the -REALBREAK switch to force
  32. 386|DOS-Extender to load the protected mode program's real mode communications
  33. buffer in conventional memory.  The other method uses the -CALLBUFS
  34. switch to allocate a buffer in conventional memory which is available
  35. to the application by using far pointers.
  36.  
  37. The REALBREAK method does not require the protected mode program to use
  38. far pointers to access its real mode communications buffer, and is thus
  39. more efficient.  It is not, however, a DPMI compatible solution since
  40. the -REALBREAK switch cannot be supported under DPMI.
  41.  
  42. The CALLBUFS method is DPMI compatible but requires accessing the 
  43. communications buffer through far pointers.
  44.  
  45. ---------------------------------------------------------------------------
  46.  
  47. The following files are located in this directory:
  48.  
  49. gserver.h    A C header file that defines the communication protocol
  50.         between the real and protected mode code.
  51.  
  52. gdemo.c        The C source code to the example application which draws
  53.         1000 random lines on the screen.
  54.  
  55. gglue.c        Example glue routines that run in protected mode and call
  56.         through to the real mode Microsoft C graphics library.  This
  57.         code can be conditionally compiled to use either the -REALBREAK
  58.         or the -CALLBUFS communications method.
  59.  
  60. prot.asm    Assembler language utility functions used by "gglue.c".  This
  61.         code can be conditionally assembled to use either the -REALBREAK
  62.         or the -CALLBUFS communications method.
  63.  
  64. gserver.c    The graphics server that runs in real mode and is
  65.         compiled by the Microsoft C 5.1 compiler and linked with
  66.         the Microsoft C run-time and graphics libraries.
  67.  
  68. real.asm    Assembly language utility functions used by "gserver.c"
  69.         that switch from real mode back to protected mode.
  70.  
  71. gdemo_rb.exp    A .EXP file for gdemo.c built to use the -REALBREAK
  72.         communications method.
  73.  
  74. gdemo_cb.exp    A .EXP file for gdemo.c built to use the -CALLBUFS
  75.         communications method.
  76.  
  77. gserver.drv    A .EXE file for the real mode graphics server, built
  78.         from gserver.c and real.asm with Microsoft C 5.1.
  79.  
  80. blddemo.bat    A batch file that builds gdemo_rb.exp, gdemo_cb.exp
  81.         and gserver.drv.
  82.  
  83. gdemo.mak    A make file for gdemo_rb.exp and gdemo_cb.exp.
  84.  
  85. gserver.mak    A make file for gserver.drv.
  86.  
  87. ---------------------------------------------------------------------------
  88.  
  89. To run the demo, enter:
  90.  
  91.     C> run386 gdemo_rb        ; for the REALBREAK version
  92.              or
  93.     C> run386 gdemo_cb        ; for the CALLBUFS version
  94.  
  95. ---------------------------------------------------------------------------
  96.  
  97. To rebuild or extend the demo's, the following software tools are
  98. needed:
  99.  
  100.     * Version 2.0 or later of the Phar Lap 386|DOS-Extender SDK
  101.  
  102.     * Version 1.6 or later of the MetaWare High-C 386 compiler, with
  103.       the compiler driver turned on.
  104.  
  105.     * Version 5.1 or later of the Microsoft C 8086 compiler
  106.  
  107. To rebuild the executable example programs, follow these steps:
  108.  
  109.     1).  Copy graph.h from the \includes subdirectory of the
  110.          Microsoft compiler into this directory.
  111.  
  112.     2).  Edit the gdemo.mak file to set the name of the High C-386
  113.          compiler driver correctly.
  114.  
  115.     3).  Edit the gserver.mak file to set the name of the Microsoft
  116.          C compiler root directory.
  117.  
  118.     3).  Run the batch file "blddemo"
  119.  
  120. To build other protected mode applications which can interface to the
  121. Microsoft C graphics library from protected mode:
  122.  
  123.     1).  If the application includes graph.h, modify it to undefine
  124.          the cdecl and far keywords before including graph.h. (See
  125.          the comments in gdemo.c for an explanation.)
  126.  
  127.     2).  Copy gdemo.mak and modify it for the new application you
  128.          are building.
  129.