home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / c / pcw_c.zip / PCWPROTO.H < prev    next >
C/C++ Source or Header  |  1991-12-21  |  9KB  |  261 lines

  1. /*$no list *//*$no trace <<<pcwproto.h>>> */
  2. /***********************************************************/
  3. /* File Id.                  Pcwproto.H                    */
  4. /* Author.                   Stan Milam.                   */
  5. /*                                                         */
  6. /*          (c) Copyright 1989, 1990 by Stan Milam         */
  7. /*                                                         */
  8. /* Comments: This file contains definitions to be used int */
  9. /* the screen management library.  The library will support*/
  10. /* Microsoft C V5.10, Turbo C V2.0, Power C V1.60.         */
  11. /*                                                         */
  12. /***********************************************************/
  13.  
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17.  
  18. extern  int Vbump;
  19. extern  int mpresent;
  20. extern  int _monitor;
  21. extern  int _adaptor;
  22. extern  int _video_ram;
  23.  
  24. #ifdef MSC
  25. #   define MK_FP(seg, off) ((void far *)(((long)(seg)<<16) | (off)))
  26. #   define outportb outp
  27. #   define inportb inp
  28.     struct REGPACK {
  29.         unsigned r_ax, r_bx, r_cx, r_dx, r_bp;
  30.         unsigned r_si, r_di, r_ds, r_es, r_flags;
  31.     };
  32. #endif
  33. #ifdef __ZTC__
  34. #   define outportb outp
  35. #   define inportb inp
  36.     struct REGPACK {
  37.         unsigned r_ax, r_bx, r_cx, r_dx, r_bp;
  38.         unsigned r_si, r_di, r_ds, r_es, r_flags;
  39.     };
  40. #endif
  41.  
  42. #define ischar(c) ((int)(c) > -1 && (int)(c) < 256)
  43. #define peekc(s,o)   ((char far *)((MK_FP((s),(o))))
  44. #define peekw(a,b)   ((int  far *)((MK_FP((s),(o))))
  45. #define pokec(s,o,v) ((char far *)((MK_FP((s),(o)))) = (char) (v)
  46. #define pokew(s,o,v) ((int  far *)((MK_FP((s),(o)))) = (int)  (v)
  47.  
  48. #define MK_SCRNOFF(r,c) ((unsigned)(((r)-1)*Vbump)+(((c)-1)*2)+(page*pagesize))
  49. #define MK_ATTR(fc,bc) ((((bc) << 4) | (fc)) << 8)
  50.  
  51. #ifndef WNDPTR
  52. #  define WNDPTR void
  53. #endif
  54.  
  55. /* Define the Text Colors */
  56.  
  57. #define BLACK         0
  58. #define BLUE          1
  59. #define GREEN         2
  60. #define CYAN          3
  61. #define RED           4
  62. #define MAGENTA       5
  63. #define BROWN         6
  64. #define LIGHTGRAY     7
  65. #define DARKGRAY      8
  66. #define LIGHTBLUE     9
  67. #define LIGHTGREEN   10
  68. #define LIGHTCYAN    11
  69. #define LIGHTRED     12
  70. #define LIGHTMAGENTA 13
  71. #define YELLOW       14
  72. #define WHITE        15
  73. #define BLINK       128
  74.  
  75. /* Define the Border Types */
  76.  
  77. #define DOUBLEALL     0
  78. #define SINGLEALL     1
  79. #define SINGLESIDES   2
  80. #define DOUBLESIDES   3
  81. #define NOSIDES       4
  82.  
  83. /* Defines of Where Window Titles go */
  84.  
  85. #define TOP           0                /* Title located at top */
  86. #define BOTTOM        1                /* Title located at botton */
  87. #define LEFT          0                /* Left side of Window */
  88. #define RITE          1                /* Right side of window */
  89. #define MIDDLE        2                /* Or in the middle  */
  90.  
  91. /* Used to specify which button for the mouse */
  92.  
  93. #define LEFTM         0                /* Left Mouse Button */
  94. #define RITEM         1                /* Rite Mouse Button */
  95.  
  96. /* Defines for Reordering the Windows */
  97.  
  98. #define NORMAL        0
  99. #define POP           1                /* Do NOT USE!!!! */
  100. #define PUSH          2                /* Do NOT USE!!!! */
  101. #define HIDE          3                /* Do NOT USE!!!! */
  102. #define SHOW          4                /* Do NOT USE!!!! */
  103.  
  104. /* Define scrolling parms */
  105.  
  106. #define DOWN          0
  107. #define UP            1
  108.  
  109. /* Define values for monitor and adaptor */
  110.  
  111. #define MDA           1
  112. #define CGA           2
  113. #define EGA           3
  114. #define VGA           4
  115.  
  116. #define MONO          0
  117. #define COLOR         1
  118.  
  119. #define CGA200        0
  120. #define EGA350        1
  121. #define VGA400        2
  122. #define EGA14        14
  123. #define VGA16        16
  124.  
  125. /* Define values to initialize PCW with pcwinit() */
  126.  
  127. #define AUTOEXIT      1
  128. #define NOEXIT        0
  129.  
  130. /*  Miscellaneous Defines */
  131.  
  132. #define CENTER       99                            /* qputs & wputs */
  133. #define SPACES       32
  134.  
  135. /* Default EGA & VGA Palette */
  136.  
  137. #define DFTL_PALETTE 22
  138.  
  139. /*     Window Functions    */
  140.  
  141. WNDPTR *wpop(WNDPTR *wnd);
  142. WNDPTR *get_active_wnd(void);
  143. WNDPTR *wframe(int ur,int uc,int lr,int lc, int fclr, int bclr);
  144. WNDPTR *wpush(int urow, int ucol, int lrow, int lcol);
  145. WNDPTR *wexplode(int urow,int ucol,int lrow,int lcol,int fclr,int bclr);
  146. int    wprintf(WNDPTR *wnd, int row, int col, char *format,...);
  147. int    wputs(WNDPTR *wnd, int row, int col, char str[]);
  148. int    wprints(WNDPTR *wnd,int row,int col,int fclr,int bclr,char *str);
  149. int    wtitle(WNDPTR *wnd, int tb, int mlr, char *s);
  150. int    whide(WNDPTR *wnd);
  151. int    wshow(WNDPTR *wnd);
  152. int    wndmove(WNDPTR *wnd, int row, int col);
  153. int    w_chg_attr(WNDPTR *wnd,int row,int col,int fclr,int blclr,int cols);
  154. int    wscroll(WNDPTR *wnd, int action, int count);
  155. int    w_block_write(WNDPTR *wnd, int row, int col, char *block[]);
  156. int    clr_wnd(WNDPTR *wnd, int action);
  157. void   pcwinit(int action);
  158. void   _pcw_exit(void);
  159. void   re_order(WNDPTR *wnd, int attribute);
  160.  
  161. /*     Quick Screen Writing Routines     */
  162.  
  163. int  qputchar(int row, int col, int fcolor, int bcolor, unsigned char ch);
  164. int  qfill(int urow,int ucol,int lrow,int lcol,int fcolor,int bcolor,int ch);
  165. int  qbox(int urow, int ucol, int lrow, int lcol);
  166. int  qvchar(int row, int col, int fcolor, int bcolor, unsigned char ch, int count);
  167. int  qhchar(int row, int col, int fcolor, int bcolor, unsigned char ch, int count);
  168. int  qputs (int row, int col, int fcolor, int bcolor, char *s);
  169. int  qvputs(int row, int col, int fcolor, int bcolor, char *s);
  170. int  qprintf(int row, int col, int fcolor, int bcolor, char *format, ...);
  171. int  qvprintf(int row, int col, int fcolor, int bcolor, char *format, ...);
  172. int  q_block_write(int row,int col,int fclr,int bclr, char *block[]);
  173. int  scroll(int ur,int uc,int lr,int lc,int fg,int bg,int count);
  174. int  chg_attr(int row, int col, int fcolor, int bcolor, int count);
  175. int  getattr(int row, int col);
  176. int  getchr(int row, int col);
  177.  
  178. /* Some Miscellaneous Function related to quick writes & windows */
  179.  
  180. void titlecolor(int fcolor, int bcolor);
  181. void bordercolor(int fcolor, int bcolor);
  182. void setborder(int type);
  183. void set_wnd_attr(WNDPTR *wnd, int foreground, int background);
  184.  
  185. /* Miscellaneous Functions */
  186.  
  187. void _sound(unsigned freq);
  188. void _nosound(void);
  189. void rest(unsigned ticks);
  190. void swait(unsigned seconds);
  191. void far _delay(unsigned ms);
  192. void farcopy(void far *dest, void far *srce, unsigned count);
  193.  
  194. /* Environment functions */
  195.  
  196. int  getpage(void);                         /* Gets logical CRT page */
  197. int  getpagesize(void);                     /* Returns size of CRT page */
  198. int  setpage(int page);                     /* Sets logical CRT page */
  199. int  ispcwinit(void);                       /* Is the library intialized? */
  200. int  chk_video_state(int *rw, int *cl);     /* Returns max rows & cols */
  201. unsigned int getscrnseg(void);              /* Returns Segment of video mem */
  202.  
  203. /* BIOS dependent functions */
  204.  
  205. int  vgetattr(void);
  206. int  vgetchr(void);
  207. void get_cursor_size(int *tline, int *bline);
  208. void set_cursor_size(int tline, int bline);
  209. void get_cursor_pos(int *row, int *col);
  210. void set_cursor_pos(int row, int col);
  211. void switchpage(int page);
  212. void vcls(void);
  213. void vgetmode(int *cols, int *mode, int *activepage);
  214. void vsetmode(int mode);
  215.  
  216. /*  Mouse Functions  */
  217.  
  218. int  init_mouse(void);
  219. int  get_mpressed(int button);
  220. int  get_mreleased(int button);
  221. void show_mouse(void);
  222. void hide_mouse(void);
  223. void get_mpos(int *row, int *col, int *bstatus);
  224. void set_mpos(int  row, int  col);
  225. void mframe(int urow, int ucol, int lrow, int lcol);
  226. void set_mtype(int ctype, int arg1, int arg2);
  227. char *save_mouse_state(void);
  228. void restore_mouse_state(char *buffer);
  229.  
  230. /*  Keyboard Functions */
  231.  
  232. int  keypressed(void);                      /* Was a key pressed */
  233. int  readkey(void);                         /* Read keyboard character */
  234. int  isxkeybd(void);                        /* Extended keyboard BIOS? */
  235. int  keywait(int seconds);                  /* Wait or keypressed */
  236. int  get_chars(int rw,int cl,int fc,int bc,int len,char *buffer);
  237. int keyin(void);                           /* Read char/handles spcl keys */
  238. void keybrd_flush(void);                    /* Flush the keyboard */
  239.  
  240. /*  EGA/VGA specific functions */
  241.  
  242. int  download_rom_font(int font, char *buffer);
  243. int  load_user_font(int bpc,int blk,int nchars,int fchar,char *buffer);
  244. char *get_ega_palette(int mode);
  245. void set_palette(int preg, int color);
  246. void load_ega_palette(void);
  247. void set_load_palette(int preg, int color);
  248. void fload(int block, int font);
  249. void set_vga_scan_lines(int arg);
  250.  
  251. /* Interrupt Handlers & Such */
  252.  
  253. int  set_int24(void);
  254. int  set_int29(void);
  255. void reset_int29(void);
  256.  
  257. #ifdef __cplusplus
  258. }
  259. #endif
  260. /*$list *//*$trace <<<pcwproto.h>>> */
  261.