home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / SCRNMACS.H < prev    next >
C/C++ Source or Header  |  1997-07-05  |  3KB  |  143 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  Macros for managing direct video writes by Jerry Houston
  5. **
  6. **  prototypes for SCROLL.C and VIDPORT.C functions added by Bob Stout
  7. */
  8.  
  9. #ifndef SCRNMACS__H
  10. #define SCRNMACS__H
  11.  
  12. #include "sniptype.h"
  13. #include "extkword.h"
  14.  
  15. #if !defined(COLORMODE)
  16.  #define COLORMODE  ((*(char FAR *)0x0449L) != 7)
  17.  #define EXT_KBD    (*(char FAR *)0x0496L & 16)
  18.  #define VIDPAGE    (*((unsigned char far *)0x0462L))
  19.  #define ROWSIZE    (*(int FAR *)0x044AL)
  20.  #define SCANLINES  ((int)*(char FAR*)0x0461L)
  21.  #define SCRBUFF    ((unsigned FAR *)((COLORMODE)?0xB8000000L:0xB0000000L))
  22.  #define SCREENSEG  ((unsigned)((COLORMODE)?0xB800:0xB000))
  23.  #define SCRNBYTES  (*(int FAR *)0x44CL)
  24.  #define SCRNPIXELS (SCRNBYTES >> 1)
  25.  #define SCREENCOLS (*(int FAR *)0x044AL)
  26.  #define SCREENROWS ((*(char FAR *)0x0484L) ? 1 + (*(char FAR *)0x0484L): 25)
  27. #endif
  28.  
  29. /*
  30.      COLORMODE  = true/false, are we using color?
  31.      EXT_KBD    = true/false, extended keyboard in use?
  32.      VIDPAGE    = current video page in use
  33.      SCANLINES  = number of scan lines in a character.
  34.      SCRBUFF    = returns B800:0000 if using color, B000:0000 if mono.
  35.      SCREENSEG  = when you just need the segment portion.
  36.      SCRNBYTES  = number of bytes required to save screen.
  37.      SCRNPIXELS = number of (2-byte) pixels required to save screen.
  38.      SCREENCOLS = number of columns, often 80.
  39.      SCREENROWS = number of rows, usually defaults to 25.
  40. */
  41.  
  42. /*
  43. ** video attributes
  44. */
  45.  
  46. #define BLINKING 0x87
  47. #define REVERSE 0x70
  48. #define REVBLINK 0xf0
  49. #define NORMAL 0x07
  50. #define HIGHLITE 0x0f
  51. #define HIGHBLINK 0x8f
  52. #define BLINKBIT 0x80   /* OR in to cause blink */
  53. #define HILTBIT 0x08    /* OR in to cause highlight */
  54.  
  55. /*
  56. ** colors -- Use as is for foreground colors
  57. **           For background, shift left by 4 and OR with
  58. **           foreground and possible video attributes
  59. */
  60.  
  61. #define BLACK_ 0
  62. #define BLUE_ 1
  63. #define GREEN_ 2
  64. #define CYAN_ 3
  65. #define RED_ 4
  66. #define MAGENTA_ 5
  67. #define BROWN_ 6
  68. #define WHITE_ 7
  69. #define GRAY_ 8
  70. #define LTBLUE_ 9
  71. #define LTGREEN_ 10
  72. #define LTCYAN_ 11
  73. #define LTRED_ 12
  74. #define LTMAGENTA_ 13
  75. #define YELLOW_ 14
  76. #define HIWHITE_ 15     /* hi-intensity white */
  77.  
  78. #define BG_(a) (((a) & 0x7f) << 4)
  79.  
  80. /*
  81. ** e.g. blue background with yellow characters
  82. **
  83. ** video_attribute = BG_(BLUE_)+YELLOW_
  84. */ 
  85.  
  86. /*
  87. **  File: SCROLL.C
  88. */
  89.  
  90. #define SCROLL_UP 0
  91. #define SCROLL_DN 1
  92.  
  93. void scroll(int direction,
  94.             int num_lines,
  95.             int vattrib,
  96.             int ulrow,
  97.             int ulcomumn,
  98.             int lrrow,
  99.             int lrcolumn);
  100.  
  101. /*
  102. **  File: VIDPORT.C
  103. */
  104.  
  105. void GotoXY(int col, int row);
  106. void ClrScrn(int vattrib);
  107. void GetCurPos(int *col, int *row);
  108. int  GetCurAtr(void);
  109. void ClrEol(void);
  110. void ClrEop(void);
  111. void Repaint(int vattrib);
  112.  
  113.  
  114. /*
  115. **  File: SCNRSAVE.C
  116. */
  117.  
  118. struct SCREEN {
  119.       unsigned short *vbuf;
  120.       int             curX,
  121.                       curY;
  122. };
  123.  
  124. struct SCREEN *SaveScrn(void);
  125. void RestoreScrn(struct SCREEN *screen);
  126. void FreeScrnBuf(struct SCREEN *screen);
  127.  
  128.  
  129. /*
  130. **  File: FSCRNSAVE.C
  131. */
  132.  
  133. Boolean_T fSaveScrn(const char *fname);
  134. Boolean_T fRestoreScrn(const char *fname);
  135.  
  136. /*
  137. **  File: ATR2ANSI.C
  138. */
  139.  
  140. char *make_ansi(int vatr);
  141.  
  142. #endif /* SCRNMACS__H */
  143.