home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / windows / graphite / tdvideo.h < prev   
Encoding:
C/C++ Source or Header  |  1991-12-31  |  4.9 KB  |  140 lines

  1. /*[]------------------------------------------------------------[]*/
  2. /*|                                                              |*/
  3. /*|     Source code header for TDVIDEO.DLL (for TDW.EXE)         |*/
  4. /*|                                                              |*/
  5. /*|     Generic TDW API for all chip sets and modes              |*/
  6. /*|                                                              |*/
  7. /*|     Copyright (c) 1991 by Borland International              |*/
  8. /*|     All Rights Reserved.                                     |*/
  9. /*|                                                              |*/
  10. /*[]------------------------------------------------------------[]*/
  11.  
  12. /* Written by Jeffrey J. Peters */
  13. #include <stdio.h>     // for fprintf and FILE
  14.  
  15.  
  16. // _win is a macro NOT a keyword
  17. #define _win far pascal _export
  18.  
  19. /*
  20.    This is a list of prototypes for the functions that must be supported
  21.    for TDW.  You can have one DLL for every video mode mode or one DLL
  22.    for every chip set, saving the screen data differently for the
  23.    various modes.
  24. /
  25.  
  26. WORD       _win VideoInit            (void);
  27. /*
  28.    Called when TDW first loads up.  All dynamic allocation and chip and
  29.    video mode detection should be preformed here.
  30.    Return codes are:
  31.  
  32.     0 - success
  33.     1 - Incorrect video card was detected
  34.     2 - Unsupported video mode of correct card was detected
  35.     3 - Could not allocate the memory needed from Windows
  36.     4 - Regular video mode detected (TDVIDEO.DLL not required)
  37.     5 - Misc. error
  38.  
  39.    Any failure will cause TDW to unload TDVIDEO.DLL.
  40. */
  41.  
  42. WORD       _win VideoDone            (void);
  43. /*
  44.    Called when TDW exits back to Windows.  All memory allocated must be
  45.    freed by the end of this function (Don't rely on libmain and WEP).
  46.    1 means success, 0 means it failed.
  47. */
  48.  
  49. WORD       _win VideoGetTextSelector (int display);
  50. /*
  51.    Called when TDW needs the selector (protected mode segment) value of
  52.    the text mode screen requested.  If display is 0, you need to return
  53.    the selector for the address 0xB800 (color). If display is 1, you
  54.    need to return the selector for the address 0xB000 (mono).  This can
  55.    be done with the Windows pre-defined selectors: _B800H and _B000H.
  56.    In 'C' you need to take its address after it is externed properly.
  57. */
  58.  
  59. void       _win VideoSetCursor       (WORD x, WORD y);
  60. /*
  61.    Called when TDW needs to set the cursor position on the text mode
  62.    screen.  Most VGA cards can use the code that we provide (since it's
  63.    a non SuperVga register that controls the cursor position).  TDW will
  64.    call this function when it needs to make the cursor disappear (by
  65.    placing it at a non-displayable position).
  66. */
  67.  
  68. void       _win VideoDebuggerScreen  (void);
  69. /*
  70.    Called when TDW wants to switch to the text mode screen.  This
  71.    function must save the appropriate memory locations, save the VGA
  72.    palette, and switch to text mode.
  73. */
  74.  
  75. void       _win VideoWindowsScreen   (void);
  76. /*
  77.    Called when TDW wants to switch back to the Windows screen.  This
  78.    function must switch back to the original graphics mode, restore the
  79.    palette, and restore the SuperVGA graphics memory planes that were
  80.    blown away by text mode.  (This will usually be 4 to 8 K in planes 0
  81.    and 1 [for the text mode characters and attributes], and 32K in plane
  82.    2 [for the character generator data]).
  83. */
  84.  
  85. WORD       _win VideoBigSize         (void);
  86. /*
  87.    Called when TDW needs to determine if there is a higher resolution
  88.    text mode availible (usually 43 or 50 lines).  The maximum number of
  89.    lines that this you are able to support should be returned here.
  90. */
  91.  
  92. void       _win VideoSetSize         (WORD bigflag);
  93. /*
  94.    Called when TDW wants to switch the resolution of the text mode
  95.    screen.  Bigflag will be 1 if high res, 0 if low res.
  96. */
  97.  
  98. WORD       _win VideoIsColor (void);
  99. /*
  100.    Returns 1 for color, and 0 for monochrome;
  101. */
  102.  
  103. #define v_off() {_AX = 0x1201; _BL = 0x36; geninterrupt (0x10);}
  104. #define v_on()  {_AX = 0x1200; _BL = 0x36; geninterrupt (0x10);}
  105. /*
  106.    v_off() and v_on()  are macros to turn off and on the video screen
  107.    to allow maximum through-put when saving and restoring the video screen
  108. */
  109.  
  110.  
  111. int CheckVideoInfo (void);  // checks for and sets up card spacific
  112.                             // information.
  113.  
  114. extern char card_ident[];
  115. extern WORD _B800H;  // text mode screen segment (color)
  116. extern WORD _B000H;  // mono text segment
  117. extern WORD _C000H;  // video rom segment
  118. extern WORD _A000H;  // graphics mode screen segment
  119.  
  120. extern WORD oldmode;
  121. extern WORD newmode;
  122. extern int tsize;
  123. extern int tscreen;
  124. extern int vmode;
  125. extern unsigned int MaxBytesPerPage;
  126. extern int maxplanes;
  127. extern int screen;
  128. extern int savepalette;
  129. extern int disable_video;
  130. extern int debug_string;
  131. extern FILE *debug_file;
  132.  
  133. typedef struct
  134. {
  135.   HANDLE hplane[16];
  136. }v_buf_t;
  137.  
  138. extern v_buf_t v_buf;
  139.  
  140.