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 / ibm8514reg.h < prev    next >
Text File  |  1991-09-25  |  9KB  |  256 lines

  1. /*
  2.  * $Id: ibm8514reg.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. /* Magic I/O port addresses */
  38. #define QSTATADD     0xDAE8
  39. #define QCTRLADD     0x42E8
  40.  
  41. #if !defined(IBM_OS_HAS_HFT)
  42. #define PALMASK     0x42EA
  43. #define PALREAD_ADDR     0x42EB
  44. #define PALWRITE_ADDR     0x42EC
  45. #define PALDATA     0x42ED
  46. #else /* HFT on Danbury Kernel. Yuk. */
  47. #define PALMASK     0x02EA
  48. #define PALREAD_ADDR     0x02EB
  49. #define PALWRITE_ADDR     0x02EC
  50. #define PALDATA     0x02ED
  51. #endif
  52.  
  53. #define VARDATA        0xE2E8
  54.  
  55. /* Register Constants -- Wait on I/O busy */
  56. #define ibm8514WaitOnIO        0x4000    /* This Does Wait IF busy */
  57. #define ibm8514_Y0        ( 0x82E8 | ibm8514WaitOnIO )
  58. #define ibm8514_X0        ( 0x86E8 | ibm8514WaitOnIO )
  59. #define ibm8514_Y1        ( 0x8AE8 | ibm8514WaitOnIO )
  60. #define ibm8514_X1        ( 0x8EE8 | ibm8514WaitOnIO )
  61. #define ibm8514_K1        ibm8514_Y1
  62. #define ibm8514_K2        ibm8514_X1
  63. #define ibm8514_ErrorAcc    ( 0x92E8 | ibm8514WaitOnIO )
  64. #define ibm8514_LX        ( 0x96E8 | ibm8514WaitOnIO )
  65. #define ibm8514_Qstatus        ( 0x9AE8 )
  66. #define ibm8514_CMD        ( ibm8514_Qstatus | ibm8514WaitOnIO )
  67. #define ibm8514_ShortStroke    ( 0x9EE8 | ibm8514WaitOnIO )
  68. #define ibm8514_Color0        ( 0xA2E8 | ibm8514WaitOnIO )
  69. #define ibm8514_Color1        ( 0xA6E8 | ibm8514WaitOnIO )
  70. #define ibm8514_PlaneWE        ( 0xAAE8 | ibm8514WaitOnIO )
  71. #define ibm8514_PlaneRE        ( 0xAEE8 | ibm8514WaitOnIO )
  72. #define ibm8514_ColorCMP    ( 0xB2E8 | ibm8514WaitOnIO )
  73. #define ibm8514_Func0        ( 0xB6E8 | ibm8514WaitOnIO )
  74. #define ibm8514_Func1        ( 0xBAE8 | ibm8514WaitOnIO )
  75. #define ibm8514_SecDecode    ( 0xBEE8 | ibm8514WaitOnIO )
  76. #define ibm8514_Control        ( 0x42E8 )
  77. #define ibm8514_Status        ibm8514_Control
  78. #define ibm8514_PromPage    ( 0x46E8 )
  79. #define ibm8514_MiscIO        ( 0x4AE8 )
  80.  
  81. /* Manifest Constants */
  82. #define IM_DEEP8     0x01
  83. #define IM_DEEP4     0x44
  84. #define IM_MON0      0x13    /* clear image */
  85. #define IM_MON1      0x23    /* transmorgrified, and twice as big */
  86.  
  87. #define M_ONES         0xA000
  88. #define M_PATTS      0xA040
  89. #define M_VAR         0xA080
  90. #define M_CPYRCT     0xA0C0
  91. #define M_ACROSS     0xA004
  92. #define M_DEPTH      0xA000
  93. #define M_PLFILL      0xA004
  94.  
  95. #define FNCOLOR0     0x0000
  96. #define FNCOLOR1     0x0020
  97. #define FNVAR         0x0040
  98. #define FNCPYRCT     0x0060
  99. #define FNREPLACE    0x0007
  100. #define FNNOP        0x0003
  101. #define FNAND        0x000C
  102. #define FNOR        0x000B
  103. #define FNXOR        0x0005
  104. #define FNMIN        0x0010
  105. #define FNMAX        0x0014
  106.  
  107. #define CLOSE         ibm8514outw( QCTRLADD, 0 )
  108. #define FULLSC(C)     rect( C, 0, 0, 1024, 1024 )
  109.  
  110. #define IBM8514MAXPLANES 8
  111. #define ibm8514ALLPLANES ~( ( ~0 ) << IBM8514MAXPLANES )
  112.  
  113. #define WPLANE0        0x0001
  114. #define WPLANE1        0x0002
  115. #define WPLANE2        0x0004
  116. #define WPLANE3        0x0008
  117. #define WPLANE4        0x0010
  118. #define WPLANE5        0x0020
  119. #define WPLANE6        0x0040
  120. #define WPLANE7        0x0080
  121. #define WPLANES        ibm8514ALLPLANES
  122.  
  123. #define RPLANE0        0x0002
  124. #define RPLANE1        0x0004
  125. #define RPLANE2        0x0008
  126. #define RPLANE3        0x0010
  127. #define RPLANE4        0x0020
  128. #define RPLANE5        0x0040
  129. #define RPLANE6        0x0080
  130. #define RPLANE7        0x0001
  131. #define RPLANES        ibm8514ALLPLANES
  132.  
  133. /* ************************ COMMAND MACROS ************************ */
  134. #define SETMODE(M)    ibm8514outw( ibm8514_SecDecode, M )
  135. #define SETCOL0(C)    ibm8514outw( ibm8514_Color0, C )
  136. #define SETCOL1(C)    ibm8514outw( ibm8514_Color1, C )
  137. #define SETFN0(C, ALU)    ibm8514outw( ibm8514_Func0, ( ( C ) | ( ALU ) ) )
  138. #define SETFN1(C, ALU)    ibm8514outw( ibm8514_Func1, ( ( C ) | ( ALU ) ) )
  139. #define PLNWENBL(C)    ibm8514outw( ibm8514_PlaneWE, C )
  140. #define PLNRENBL(C)    ibm8514outw( ibm8514_PlaneRE, C )
  141. #define COLRCOMP(C)    ibm8514outw( ibm8514_ColorCMP, C )
  142. #define SETVAR(C)    ibm8514outw( VARDATA, C )
  143. #define GETVAR        ibm8514inw( VARDATA )
  144.  
  145. #define CRTCMODE(C)      outb( 0x22E8, C )
  146. #define MISCIO(C)       ibm8514outw( ibm8514_MiscIO, C )
  147. #define SETET(C)       ibm8514outw( ibm8514_ErrorAcc, C )
  148. #define SETK1(C)       ibm8514outw( ibm8514_K1, C )
  149. #define SETK2(C)       ibm8514outw( ibm8514_K2, C )
  150. #define SETY0(C)       ibm8514outw( ibm8514_Y0, ((C)&0x07FF) )
  151. #define SETX0(C)       ibm8514outw( ibm8514_X0, ((C)&0x07FF) )
  152. #define SETY1(C)       ibm8514outw( ibm8514_Y1, ((C)&0x07FF) )
  153. #define SETX1(C)       ibm8514outw( ibm8514_X1, ((C)&0x07FF) )
  154. #define SETLX(C)       ibm8514outw( ibm8514_LX, C )
  155. #define SETLY(C)       ibm8514outw( ibm8514_SecDecode, C )
  156. #define SETXMAX(C)      ibm8514outw( ibm8514_SecDecode, (((C) & 0x0FFF)|0x4000))
  157. #define SETXMIN(C)      ibm8514outw( ibm8514_SecDecode, (((C) & 0x0FFF)|0x2000))
  158. #define SETYMAX(C)      ibm8514outw( ibm8514_SecDecode, (((C) & 0x0FFF)|0x3000))
  159. #define SETYMIN(C)      ibm8514outw( ibm8514_SecDecode, (((C) & 0x0FFF)|0x1000))
  160. #define SETPAT0(C)      ibm8514outw( ibm8514_SecDecode, (((C) & 0x001E)|0x8000))
  161. #define SETPAT1(C)      ibm8514outw( ibm8514_SecDecode, (((C) & 0x001E)|0x9000))
  162. #define COMMAND(C)      ibm8514outw( QSTATADD, C )
  163.  
  164. /* ************************ COMMAND DEFINES ************************ */
  165. /* Bits 15, 14 & 13 are the command selector */
  166. #define ibm8514cmd_Null        0x0000
  167. #define ibm8514cmd_Vector    0x2000
  168. #define ibm8514cmd_HRect    0x4000
  169. #define ibm8514cmd_VRect    0x6000
  170. #define ibm8514cmd_FRect    0x8000
  171. #define ibm8514cmd_OutlDraw    0xA000
  172. #define ibm8514cmd_CopyRect    0xC000
  173. #define ibm8514cmd_ILLEGAL    0xE000
  174.  
  175. /* Bit 12 selects whether the data is byte-swapped */
  176. #if defined(ATRIO) || defined(PCIO)
  177. #define ibm8514ByteOrder    0x1000
  178. #else
  179.     ******** Error ********
  180. #endif
  181.  
  182. /* Bits 10 & 11 are always 0 */
  183.  
  184. /* Bit 9 selects for 8 or 16 bit data */
  185. #define ibm8514cmd_WordData    0x0000
  186. #define ibm8514cmd_ByteData    0x0200
  187.  
  188. /* Bit 8 selects for Fixed or variable Data */
  189. #define ibm8514cmd_FData    0x0000
  190. #define ibm8514cmd_VData    0x0100
  191.  
  192. /* Bits 7, 6 & 5 are the Coded Direction selector */
  193. #define ibm8514cmd_pXpYpZ    0x00E0
  194. #define ibm8514cmd_pXpYnZ    0x00C0
  195. #define ibm8514cmd_pXnYpZ    0x00A0
  196. #define ibm8514cmd_pXnYnZ    0x0080
  197. #define ibm8514cmd_nXpYpZ    0x0060
  198. #define ibm8514cmd_nXpYnZ    0x0040
  199. #define ibm8514cmd_nXnYpZ    0x0020
  200. #define ibm8514cmd_nXnYnZ    0x0000
  201.  
  202. /* Bit 4 deterines if the does anything */
  203. /* if set to zero the 8514 calculates but doesn't change anything
  204.  * Also if zero no data may be read or written */
  205. #define ibm8514cmd_DoAccess    0x0010
  206. #define ibm8514cmd_MoveOnly    0x0000
  207.  
  208. /* Bit 3 selects if the Coded Direction field is used */
  209. #define ibm8514cmd_UseCDir    0x0008
  210. #define ibm8514cmd_DontUseCDir    0x0000
  211.  
  212. /* Bit 2 selects if the Last Pel is accessed */
  213. #define ibm8514cmd_LastPelNull    0x0004
  214. #define ibm8514cmd_UseLastPel    0x0000
  215.  
  216. /* Bit 1 selects for Actual Pel Accrual */
  217. #define ibm8514cmd_AccruePels    0x0002
  218. #define ibm8514cmd_NoAccrue    0x0000
  219.  
  220. /* Bit 0 selects for Read or Write Data */
  221. #define ibm8514cmd_Read        0x0000
  222. #define ibm8514cmd_Write    0x0001
  223.  
  224. /* ************ Actual COMMAND Bitpattern DEFINES ************ */
  225. #define ibm8514WriteZData    ( ibm8514cmd_HRect \
  226.                 | ibm8514ByteOrder \
  227.                 | ibm8514cmd_ByteData \
  228.                 | ibm8514cmd_VData \
  229.                 | ibm8514cmd_pXpYpZ \
  230.                 | ibm8514cmd_DoAccess \
  231.                 | ibm8514cmd_DontUseCDir \
  232.                 | ibm8514cmd_UseLastPel \
  233.                 | ibm8514cmd_NoAccrue \
  234.                 | ibm8514cmd_Write )
  235. #define ibm8514ReadZData    ( ibm8514cmd_HRect \
  236.                 | ibm8514ByteOrder \
  237.                 | ibm8514cmd_ByteData \
  238.                 | ibm8514cmd_VData \
  239.                 | ibm8514cmd_pXpYpZ \
  240.                 | ibm8514cmd_DoAccess \
  241.                 | ibm8514cmd_DontUseCDir \
  242.                 | ibm8514cmd_UseLastPel \
  243.                 | ibm8514cmd_NoAccrue \
  244.                 | ibm8514cmd_Read )
  245.  
  246. #define ibm8514WriteXYData    ( ibm8514cmd_HRect \
  247.                 | ibm8514ByteOrder \
  248.                 | ibm8514cmd_ByteData \
  249.                 | ibm8514cmd_VData \
  250.                 | ibm8514cmd_pXpYpZ \
  251.                 | ibm8514cmd_DoAccess \
  252.                 | ibm8514cmd_DontUseCDir \
  253.                 | ibm8514cmd_UseLastPel \
  254.                 | ibm8514cmd_AccruePels \
  255.                 | ibm8514cmd_Write )
  256.