home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / ibm8514 / x8514.h < prev   
C/C++ Source or Header  |  1991-09-25  |  5KB  |  178 lines

  1. /*
  2.  * $Id: x8514.h,v 1.1 1991/09/20 19:10:24 mtranle Exp $
  3.  *
  4.  * Copyright IBM Corporation 1987,1990
  5.  *
  6.  * All Rights Reserved
  7.  *
  8.  * Permission to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted,
  10.  * provided that the above copyright notice appear in all copies and that 
  11.  * both that copyright notice and this permission notice appear in
  12.  * supporting documentation, and that the name of IBM not be
  13.  * used in advertising or publicity pertaining to distribution of the
  14.  * software without specific, written prior permission.
  15.  *
  16.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
  18.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  19.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  21.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22.  * SOFTWARE.
  23.  *
  24. */
  25. /*
  26.  * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
  27.  * LICENSED MATERIALS - PROPERTY OF IBM
  28.  * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
  29.  */
  30. /*
  31.  *
  32.  * Hardware interface routines for IBM 8514/A adapter for
  33.  * X.11 server(s) on IBM equipment.
  34.  *
  35.  */
  36.  
  37. #if !defined(i386) && !defined(iAPX386) && !defined(iAPX286)
  38. /* ibm 6152 */
  39. #ifndef ATR
  40. #define ATR
  41. #endif
  42. #ifndef ATRIO
  43. #define ATRIO
  44. #endif
  45. #ifdef PCIO
  46. #undef PCIO
  47. #endif
  48.  
  49. #else
  50. /* ibm AIX/386 */
  51. #ifdef ATR
  52. #undef ATR
  53. #endif
  54. #ifndef PCIO
  55. #define PCIO
  56. #endif
  57. #ifdef ATRIO
  58. #undef ATRIO
  59. #endif
  60.  
  61. #endif
  62.  
  63. #if defined(ibm032) && defined(BSDrt)
  64.  
  65. #define SWAP_ADJUST( x ) (x) /* Code originally written for the rt */
  66.  
  67. extern unsigned short ibm8514inw() ;
  68. #define ibm8514outw(port, val16) \
  69.     outw( port, (((val16 & 0x0000FF00)>>8) | ((val16 & 0x000000FF)<<8)) )
  70.  
  71. /* The folowing are two magic addresses for the ATR kernel */
  72. #define BYTEADD 0xD00F0000
  73. #define WORDADD 0xD00E0000
  74.  
  75. #else
  76. #if defined(i386) || defined(iAPX386) || defined(iAPX286)
  77.  
  78. /* Code originally written for the rt */
  79. #define SWAP_ADJUST( x ) ((((x)&0xFF)<<8)|(((x)>>8)&0xFF))
  80.  
  81. #define ibm8514inw( addr ) inw( (addr) )
  82. #define ibm8514outw(port, val16) outw( (port), (val16) )
  83.  
  84. #else
  85.     ******** ERROR ********
  86. #endif
  87. #endif
  88.  
  89. /* Memory Reference Portability Macros */
  90. #include "ibmIOArch.h"
  91.  
  92. /* Device Register Definitions */
  93. #include "ibm8514reg.h"
  94.  
  95. /* Supported display tube types */
  96. #define HEAD_GRAY1024     1
  97. #define HEAD_COLOR1024     2
  98. #define HEAD_GRAY640     5
  99. #define HEAD_COLOR640     6
  100. #define HEAD_NONE     7
  101.  
  102. #define HALFQBUF    4
  103.  
  104. /* Psuedo-Functions for adapter control */
  105. #define QSTAT ( ibm8514inw( QSTATADD ) )
  106. #define QCTRL ( ibm8514inw( QCTRLADD ) )
  107. #define QCSTAT ( ibm8514inw( 0x02E8 ) )
  108.  
  109. #define ibm8514NotBusy \
  110.     while ( QSTAT & 0x0200 ) /* Do Nothing */ ;
  111.  
  112. /* Note N must be < 9, otherwise the result is indeterminate */
  113. #define ibm8514ClearQueue( numSlots )    \
  114.     while ( ( 0x0100 >> ( numSlots ) ) & QSTAT ) ;
  115.  
  116. #if defined(ATRIO) || ( defined(ibm032) && defined(BSDrt) )
  117. #define ibm8514CheckQueue(N)    /* Noop on 6152 !! */
  118. #define ibm8514ATRNotBusy     ibm8514NotBusy
  119. #else
  120. #define ibm8514CheckQueue(N)    ibm8514ClearQueue(N)
  121. #define ibm8514ATRNotBusy     /* No-op on 386 */
  122. #endif
  123.  
  124. #define _8514_SCREENHEIGHT    768
  125. #define _8514_SCREENWIDTH    1024
  126. #define _8514_SCREEN_HEIGHT    768
  127. #define _8514_SCREEN_WIDTH    1024
  128.  
  129. #define ibm8514MaxCursorWidth    32
  130. #define ibm8514MaxCursorHeight    32
  131. #define SAVELOCX 0
  132. #define SAVELOCY ( _8514_SCREENHEIGHT + 1 )
  133. #define CUR1LOCX ( SAVELOCX + ibm8514MaxCursorWidth )
  134. #define CUR1LOCY ( _8514_SCREENHEIGHT + 1 )
  135. #define CUR0LOCX ( CUR1LOCX + ibm8514MaxCursorWidth )
  136. #define CUR0LOCY ( _8514_SCREENHEIGHT + 1 )
  137. #define C1X         CUR1LOCX
  138. #define C1Y        ( _8514_SCREENHEIGHT + 1 )
  139. #define C0X        CUR0LOCX
  140. #define C0Y        ( _8514_SCREENHEIGHT + 1 )
  141. #define SAVEX        SAVELOCX
  142. #define SAVEY        ( _8514_SCREENHEIGHT + 1 )
  143. #define CURD_X        ibm8514MaxCursorWidth
  144. #define CURD_Y        ibm8514MaxCursorHeight
  145.  
  146. #define TILE_X        96
  147. #define TILE_Y        ( _8514_SCREENHEIGHT + 1 )
  148. #define ROTTILE_X    128
  149. #define ROTTILE_Y    ( _8514_SCREENHEIGHT + 1 )
  150. #define MAXTILESIZE    32
  151.  
  152. #define STIPX        0
  153. #define MAXSTIPPLEWIDTH    ( _8514_SCREENWIDTH - STIPX )
  154. #define STIPY        802
  155. #define MAXSTIPPLEHEIGHT 220
  156. #define FILL_STAGE_WPLANE    0x02
  157. #define FILL_STAGE_RPLANE    0x02
  158. #define MONO_STAGE_SIZE        200
  159. #define MONO_STAGE_WPLANE    WPLANE0
  160. #define MONO_STAGE_RPLANE    RPLANE0
  161. #define MONO_STAGE_X        0
  162. #define MONO_STAGE_Y        803
  163.  
  164. /* Default Colors */
  165. #define IBM8514_BLACK_PIXEL 0
  166. #define IBM8514_WHITE_PIXEL 1
  167.  
  168. /* Name of device file for "unix" ( Not AIX ) */
  169. #define IBM8514_DEV_FILE "/dev/ibm8514"
  170.  
  171. /* Tom's stylistic effects */
  172. #define then
  173.  
  174. #ifndef TRUE
  175. #define TRUE 1
  176. #define FALSE 0
  177. #endif
  178.