home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / c / quikc21.zip / QWIKC21.H < prev    next >
Text File  |  1989-07-06  |  10KB  |  247 lines

  1. /*===========================================================================*\
  2. | QWIKC21.H                                                 ver 2.1, 07-06-89 |
  3. |                                                                             |
  4. | Header file for quick, direct screen writing for C                          |
  5. | Copyright (c)1988-1989 James H. LeMay, All rights reserved.                 |
  6. |                                                                             |
  7. | Conversion to C by Jordan Gallagher/Wisdom Research                         |
  8. |                                                                             |
  9. | For documentation on this file see QWIKC21.DOC and QWIKREF.DOC.             |
  10. | Only 45 bytes of global data are used.                                      |
  11. \*===========================================================================*/
  12.  
  13. #ifndef __TURBOC__
  14. #define videomode   (*(char far *)(0x449L+_z)) /* Mode: Mono=7,Color=0-3 */
  15. #define videopage   (*(char far *)(0x462L+_z)) /* Video page number */
  16. #define egarows     (*(char far *)(0x484L+_z)) /* Rows on screen (0-based) */
  17. #define egainfo     (*(char far *)(0x487L+_z)) /* EGA info.  See QWIKREF.DOC */
  18. #define egafontsize (*(int far *)(0x485L+_z))  /* Char cell height (1-based) */
  19. #define crtcolumns  (*(int far *)(0x44L+_z))   /* # of CRT columns (1-based) */
  20. #else
  21. #define videomode   (*(char far *)0x449L)    /* Video mode: Mono=7,Color=0-3 */
  22. #define videopage   (*(char far *)0x462L)    /* Video page number */
  23. #define egarows     (*(char far *)0x484L)    /* Rows on screen (0-based) */
  24. #define egainfo     (*(char far *)0x487L)    /* EGA info.  See QWIKREF.DOC */
  25. #define egafontsize (*(int far *)0x485L)     /* Char cell height (1-based) */
  26. #define crtcolumns  (*(int far *)0x44L)      /* Num of CRT columns (1-based) */
  27. #endif
  28.  
  29. extern unsigned char system_id, /* Equipment ID.  See QWIKREF.DOC */
  30. submodel_id,                    /* Equipment ID.  See QWIKREF.DOC */
  31. cpuid,                       /* Model number of Intel CPU */
  32. qvideo_mode,                 /* Video mode detected by Qwik */
  33. qvideo_page,                 /* Video page to which Qwik is writing */
  34. maxpage,                     /* Maximum possible page */
  35. cardsnow,                    /* Wait-for-retrace (snow) for video card */
  36. have_ps2,                    /* Using some type of IBM PS/2 equip */
  37. have_3270,                   /* Using IBM 3270 PC workstation hard/software */
  38. ega_switches,                /* EGA card and monitor setup */
  39. active_disp_dev,             /* Active Display Device */
  40. active_disp_dev_3270,        /* Active Display Device for IBM 3270 PC */
  41. alt_disp_dev,                /* Alternate Display Device */
  42. herc_model,                  /* Model of Hercules card. */
  43. inmultask,                   /* Set to 1 if setmultitask() called in
  44.                                 multitasking environment */
  45. _z;                          /* workaround for MicroSoft QuickC 1.0 bug */
  46. extern int page0seg;         /* Segment for page 0 for video card/buffer */
  47. extern int cardseg;          /* Segment for page 0 for video card */
  48. extern int alt_disp_dev_pcc; /* Alt Display Device for PC Convertible */
  49. extern int scroll_attr;      /* Attribute used to clear row in qeosln() */
  50.  
  51. typedef struct {
  52.     void far *vscrptr;     /* Pointer to memory writes are done to */
  53.     unsigned veosofs;      /* End Of String offset after Qwik writing */
  54.     unsigned vsize;        /* Essentially size of CRT video buffer in bytes */
  55.     unsigned char vrows;   /* Global variable of Rows/Ega rows (1-based!) */
  56.     unsigned char vcols;   /* Global variable of CRT columns (1-based) */
  57.     char vsnow;            /* Wait-for-retrace (snow) while Qwik writing */
  58. } vscr_t;
  59.  
  60. extern vscr_t qscr;
  61.  
  62. #define crt_rows qscr.vrows
  63. #define crt_cols qscr.vcols
  64. #define qsnow qscr.vsnow
  65. #define crt_size qscr.vsize
  66. #define qeosofs qscr.veosofs
  67. #define qscrofs *((unsigned *) (&qscr.vscrptr))
  68. #define qscrseg *((unsigned *) (&qscr.vscrptr)+1)
  69. #define qscrptr qscr.vscrptr
  70.  
  71. /* Constants assigned by IBM:              */
  72. enum modes {
  73.     no_display,          /* 00 through 0C, FF */
  74.     mda_mono,
  75.     cga_color,
  76.     dcc3,
  77.     ega_color,
  78.     ega_mono,
  79.     pgc_color,
  80.     vga_mono,
  81.     vga_color,
  82.     dcc9,
  83.     dcc10,
  84.     mcga_mono,
  85.     mcga_color,
  86.     unknown = 255
  87. };
  88.  
  89. /* Arbitrarily assigned constants: */
  90. enum herc {
  91.     no_herc,
  92.     hgc_mono,
  93.     hgc_plus,
  94.     herc_incolor
  95. };
  96.  
  97. enum cpu {
  98.     cpu8086,
  99.     cpu80186,
  100.     cpu80286,
  101.     cpu80386
  102. };
  103.  
  104. /* These are the foreground text colors */
  105. #if !defined(__COLORS)
  106. #define __COLORS
  107.  
  108. enum COLORS {
  109.     BLACK,
  110.     BLUE,
  111.     GREEN,
  112.     CYAN,
  113.     RED,
  114.     MAGENTA,
  115.     BROWN,
  116.     LIGHTGRAY,
  117.     DARKGRAY,
  118.     LIGHTBLUE,
  119.     LIGHTGREEN,
  120.     LIGHTCYAN,
  121.     LIGHTRED,
  122.     LIGHTMAGENTA,
  123.     YELLOW,
  124.     WHITE
  125. };
  126. #endif
  127.  
  128. /* These are the background colors */
  129. enum bgcolors {
  130.     BLACK_BG     = 0x00,
  131.     BLUE_BG      = 0x10,
  132.     GREEN_BG     = 0x20,
  133.     CYAN_BG      = 0x30,
  134.     RED_BG       = 0x40,
  135.     MAGENTA_BG   = 0x50,
  136.     BROWN_BG     = 0x60,
  137.     LIGHTGRAY_BG = 0x70
  138. };
  139.  
  140. #ifndef __VIDEO
  141. enum txtmodes {
  142.     BW40,
  143.     C40,
  144.     BW80,
  145.     C80,
  146.     MONO = 7
  147. };
  148. #endif
  149.  
  150. #define  BLINK     128   /* blink bit -- add to attribute */
  151. #define  SAMEATTR  -1    /* supresses attribute changes to the screen */
  152.  
  153. /* The following are macros used in calling setcursor() and modcursor() */
  154. #define cursor_on    0x0000  /* Turns cursor on with same shape */
  155. #define cursor_off   0x2000  /* Turns cursor off with same shape */
  156. #define cursor_blink 0x6000  /* Creates erratic blinking for many machines */
  157.  
  158. /* These cursor modes are set by qinit() as detected for the video card: */
  159. extern int cursor_initial;         /* Cursor detected at startup */
  160. extern int cursor_underline;       /* Standard underline cursor */
  161. extern int cursor_halfblock;       /* Usually used for Insert editing */
  162. extern int cursor_block;           /* For those who have to squint */
  163.  
  164. /* ----------- QINIT ----------- */
  165. void qinit( void );
  166. void qreinit( void );
  167.  
  168. /* ----------- QWRITES ----------- */
  169. void qwrite(  unsigned char row, unsigned char col, int attr,
  170.               char far *astr );
  171. void qwritec( unsigned char row, unsigned char col, unsigned char cols,
  172.               int attr, char far *astr );
  173. void qwriteeos( int attr, char far *astr );
  174.  
  175. /* ----------- QWRSUB ----------- */
  176. void qwrite_sub( unsigned char row, unsigned char col, int attr, int length,
  177.                  char far *astr );
  178. void qwriteeos_sub( int attr, int length, char far *astr );
  179.  
  180. /* ----------- QFILLS ----------- */
  181. void qfill(  unsigned char row, unsigned char col, unsigned char rows,
  182.              unsigned char cols, int attr, char ch );
  183. void qattr(  unsigned char row, unsigned char col, unsigned char rows,
  184.              unsigned char cols, int attr );
  185. void qfillc( unsigned char row, unsigned char col_l, unsigned char col_r,
  186.              unsigned char rows, unsigned char cols, int attr, char ch );
  187. void qattrc( unsigned char row, unsigned char col_l, unsigned char col_r,
  188.              unsigned char rows, unsigned char cols, int attr );
  189. void qfilleos( unsigned char rows, unsigned char cols, int attr, char ch );
  190. void qattreos( unsigned char rows, unsigned char cols, int attr );
  191.  
  192. /* ----------- QSTORES ----------- */
  193. void qstoretomem( unsigned char row, unsigned char col, unsigned char rows,
  194.                   unsigned char cols, void far *dest );
  195. void qstoretoscr( unsigned char row, unsigned char col, unsigned char rows,
  196.                   unsigned char cols, void far *src );
  197. void qscrtovscr(  unsigned char row, unsigned char col, unsigned char rows,
  198.                   unsigned char cols, unsigned char vrow, unsigned char vcol,
  199.                   unsigned char vwidth, void far *vscrptr );
  200. void qvscrtoscr(  unsigned char row, unsigned char col, unsigned char rows,
  201.                   unsigned char cols, unsigned char vrow, unsigned char vcol,
  202.                   unsigned char vwidth, void far *vscrptr );
  203.  
  204. /* ----------- QSCROLLS ----------- */
  205. void qscrollup(   unsigned char row, unsigned char col, unsigned char rows,
  206.                   unsigned char cols, int blankattr );
  207. void qscrolldown( unsigned char row, unsigned char col, unsigned char rows,
  208.                   unsigned char cols, int blankattr );
  209.  
  210. /* ----------- QPAGES ----------- */
  211. void qviewpage(  char pagenum );
  212. void qwritepage( char pagenum );
  213.  
  214. /* ----------- QREADS ----------- */
  215. void qreadstr(  char far *astr, char row, char col, char num );
  216. unsigned char qreadchar( unsigned char row, unsigned char col );
  217. unsigned char qreadattr( unsigned char row, unsigned char col );
  218.  
  219. /* ----------- QEOSLN ----------- */
  220. void qeosln( void );
  221.  
  222. /* ----------- CURSOR ----------- */
  223. int getcursor( void );
  224. void setcursor( int cursor );
  225. void modcursor( int modify );
  226. void gotorc( unsigned char row, unsigned char col );
  227. unsigned char wherer( void );
  228. unsigned char wherec( void );
  229.  
  230. /* ----------- EOS ----------- */
  231. void gotoeos( void );
  232. unsigned char eosr( void );
  233. unsigned char eosc( void );
  234. void eostorc( unsigned char row, unsigned char col );
  235. void eostorcrel( int row, int col );
  236. void eostocursor( void );
  237. void eosln( void );
  238.  
  239. /* ----------- CPUIDENT ----------- */
  240. void getcpuid( void );
  241.  
  242. /* ----------- GETSUBID ----------- */
  243. void get_submodel_id( void );           /* Read docs before using! */
  244.  
  245. /* ----------- SETMULTI ----------- */
  246. void setmultitask( void );
  247.