🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.rt
Article #1998

IBM 8514 source code (part 6 of 6) for X11 Release 4

#1998
From: Mark S. Lewis
Date: Mon, 12 Mar 1990 23:22
950 lines
30366 bytes
Subject: IBM 8514 source code (part 6 of 6) for X11 Release 4
Index: ../mit/server/ddx/ibm/ibm8514

Description:	
IBM has decided to provide X11 source code for the 8514 display
adapter.  This is the same code used to build the object files
included in the X11 Release 4 distribution.  This code supports
servers for both AIX and IBM/4.3 on their respective platforms.

	V1.32_kit.1	59,103 Bytes
	V1.32_kit.2	61,796 Bytes
	V1.32_kit.3	60,982 Bytes
	V1.32_kit.4	62,729 Bytes
	V1.32_kit.5	54,871 Bytes
	V1.32_kit.6	29,170 Bytes

Installation:	
This code is provided in a 6-part shell archive.  Before you
install it, you should save your current code.  You should save
the Imakefile in the ibm server directory.  You also should save
the entire ibm8514 directory by moving and remaking it.

	cd ../mit/server/ddx/ibm
	cp Imakefile Imakefile.orig
	mv ibm8514 ibm8514.orig
	mkdir ibm8514
	
Next, edit this header from each part, and feed the rest to
/bin/sh.  Proceed to make the server as instructed in the
X11 release notes.

	sh < V1.32_kit.6

=====-----     Mark S. Lewis, IBM AWD Palo Alto    -----======
inet: mlewis%ibmsupt@uunet.uu.net		(415) 855-4486
uucp: uunet!ibmsupt!mlewis              IBM Tie Line: 465-4486

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
#
#	ibm8514/brcTile.c
#	ibm8514/brcUtils.c
#	ibm8514/ibm8514reg.h
#	ibm8514/x8514.h
#
echo x - ibm8514/brcTile.c
sed 's/^X//' >ibm8514/brcTile.c << 'END-of-ibm8514/brcTile.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcTile.c,v 6.3
89/05/07 15:09:49 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcTile.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcTile.c,v 6.3
89/05/07 15:09:49 paul Exp $" ;
X#endif
X
X/* Tile an area with a pixmap image.
X *
X */
X#include "X.h"
X#include "misc.h"
X#include "gcstruct.h"
X#include "pixmapstr.h"
X
X#include "OScompiler.h"
X
X#include "x8514.h"
X
X#include "ibmTrace.h"
X
Xextern int ibm8514cursorSemaphore ;
X
Xvoid
Xibm8514RotateTile( w, h, dx, dy )
Xint w, h, dx, dy ;
X{
X	register int rx, ry ;
X
X	/*THIS IS COMPLETELY OFFSCREEN, SO DISABLE CURSORCHECKING */
X	ibm8514cursorSemaphore++ ;
X
X	rx = w - dx ;
X	ry = h - dy ;
X
X	/* DO BOTTOM RIGHT */
X	/* You definitely want to do this, even if dx==dy==0.
X	   This is to force *something* into the RotatedTile location */
X	ibm8514Bitblt( GXcopy, ibm8514ALLPLANES, ibm8514ALLPLANES,
X			TILE_X + dx, TILE_Y + dy,
X			ROTTILE_X, ROTTILE_Y,
X			rx, ry ) ;
X
X	/* DO TOP RIGHT */
X	if (dy)
X		ibm8514Bitblt( GXcopy, ibm8514ALLPLANES, ibm8514ALLPLANES,
X			TILE_X + dx, TILE_Y,
X			ROTTILE_X, ROTTILE_Y + ry,
X			rx, dy ) ;
X
X	/* DO BOTTOM LEFT */
X	if (dx)
X		{
X		ibm8514Bitblt( GXcopy, ibm8514ALLPLANES, ibm8514ALLPLANES,
X			TILE_X , TILE_Y+dy,
X			ROTTILE_X+rx, ROTTILE_Y,
X			dx, ry ) ;
X
X	/* DO TOP LEFT */
X		if (dy)
X		ibm8514Bitblt( GXcopy,  ibm8514ALLPLANES, ibm8514ALLPLANES,
X			TILE_X , TILE_Y,
X			ROTTILE_X+rx, ROTTILE_Y+ry,
X			dx, dy ) ;
X		}
X
X	/* set things back the way you found them */
X	ibm8514cursorSemaphore-- ;
X
X	return ;
X}
X
Xvoid
Xibm8514TileRect( pTile, merge, planes, x, y, w, h, xSrc, ySrc )
XPixmapPtr pTile ;
Xint merge ;
Xunsigned long int planes ;
Xint x ;
Xint y ;
Xint w ;
Xint h ;
Xint xSrc ;
Xint ySrc ;
X{
Xint htarget, tlx, tly ;
Xint maxhite, maxwid ;
Xint CursorIsSaved ;
Xint tmp_w, tw, th, hoffset, voffset ;
X
XTRACE( (
"ibm8514TileRect(pTile=x%x,merge=x%x,planes=x%02x,x=%d,y=%d,w=%d,h=%d,xS
rc=%d,ySrc=%d\n",
X	pTile, merge, planes, x, y, w, h, xSrc, ySrc ) ) ;
X
Xx = MAX(0,x) ;
Xy = MAX(0,y) ;
Xw = MIN(_8514_SCREENWIDTH-x,w) ;
Xh = MIN(_8514_SCREENHEIGHT-y,h) ;
X
Xif ( (w <= 0) || (h <= 0) )
X	return ;
X
X/* trap the trivial cases.  Use ppcrep if you can.  Fall thru to do the hard
X   cases if you have to. */
X
Xswitch ( merge ) {
X		ibm8514DrawRectangle( ibm8514ALLPLANES, merge, planes,
X				      x, y, w, h ) ;
X		return ;
X		ppcTileRect( pTile, merge, planes, x, y, w, h, xSrc, ySrc ) ;
X		return ;
X		tlx = pTile->drawable.width ;
X		tly = pTile->drawable.height ;
X		if ( ( tlx > MAXTILESIZE ) || ( tly > MAXTILESIZE ) ) {
X			ppcTileRect( pTile, merge, planes,
X				     x, y, w, h, xSrc, ySrc ) ;
X			return ;
X		}
X		break ;
X}
X
XCursorIsSaved = !ibm8514cursorSemaphore && ibm8514CheckCursor( x, y, w, h ) ;
Xibm8514cursorSemaphore++ ;
X
X/* ALAS, ALACK, we are going to have to actually draw the silly thing N
X   times.  I won't bother rotating it, I'll just draw to the origin points
X   clipped to the desired box.  It's not clear when this is a win.
X*/
Xibm8514DrawColorImage( TILE_X, TILE_Y, tlx, tly,
X		       pTile->devPrivate.ptr,
X		       pTile->devKind,
X		       GXcopy, ibm8514ALLPLANES ) ;
X
X/*expand the tile to largest available size */
Xmaxwid = MIN( MAXTILESIZE, w ) ;
Xwhile ( tlx << 1 <= maxwid ) {
X	ibm8514Bitblt( GXcopy, ibm8514ALLPLANES, ibm8514ALLPLANES,
X		       TILE_X, TILE_Y, tlx + TILE_X, TILE_Y, tlx, tly ) ;
X	tlx <<= 1 ;
X}
Xmaxhite = MIN( MAXTILESIZE, h ) ;
Xwhile ( tly << 1 <= maxhite ) {
X	ibm8514Bitblt( GXcopy, ibm8514ALLPLANES, ibm8514ALLPLANES,
X		       TILE_X, TILE_Y, TILE_X, TILE_Y + tly, tlx, tly ) ;
X	tly <<= 1 ;
X}
X
Xif ( ( hoffset = ( x - xSrc ) % tlx ) < 0 )
X	hoffset += tlx ;
Xif ( ( voffset = ( y - ySrc ) % tly ) < 0 )
X	voffset += tly ;
X
Xibm8514RotateTile( tlx, tly, hoffset, voffset ) ;
X
Xfor ( ; h ; h -= th, y += th ) {
X	th = MIN( h, tly ) ;
X	for ( htarget = x, tmp_w = w ; tmp_w ; tmp_w -= tw, htarget += tlx )
X		ibm8514Bitblt( merge, ibm8514ALLPLANES, planes,
X			       ROTTILE_X, ROTTILE_Y,
X			       htarget, y,
X			       tw = MIN( tmp_w, tlx ), th ) ;
X}
X
Xif ( !--ibm8514cursorSemaphore && CursorIsSaved )
X	ibm8514ReplaceCursor() ;
X
Xreturn ;
X}
END-of-ibm8514/brcTile.c
echo x - ibm8514/brcUtils.c
sed 's/^X//' >ibm8514/brcUtils.c << 'END-of-ibm8514/brcUtils.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcUtils.c,v 6.4
89/05/07 15:18:57 jeff Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcUtils.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcUtils.c,v 6.4
89/05/07 15:18:57 jeff Exp $" ;
X#endif
X
X#include "X.h"
X#include "cursorstr.h"
X#include "scrnintstr.h"
X#include "miscstruct.h"
X
X#include "OScompiler.h"
X
X#include "x8514.h"
X#include "ibmTrace.h"
X
Xextern int ibm8514HeadInstalled ;
X
Xint mergexlate[16] ;
X
X/**********************************************************************
********/
X
Xshort
Xibm8514QueryHead()
X{
X
Xswitch ( ibm8514HeadInstalled = ( QCTRL & 0x0070 ) >> 4 )
X	{
X		return PseudoColor ;
X		return GrayScale ;
X	case 0 : /* Temporarily 0 for the 19-inch grayscale tube */
X		return GrayScale ;
X		ErrorF("ibm8514QueryHead: No known head attached. value = %d\n",
X			ibm8514HeadInstalled ) ;
X		return -1 ; /* Ramdom Error Value */
X	}
X/*NOTREACHED*/
X}
X
X/**********************************************************************
********/
X
Xint
Xibm8514QueryPlanes()
X{
Xreturn ( QCTRL & 0x0080 ) ? 8 : 4 ;
X}
X
X/**********************************************************************
********/
X
Xvoid
Xibm8514InitializeHardwareState()
X{
X
XTRACE( ( "ibm8514InitializeHardwareState()\n" ) ) ;
X
X    ibm8514outw( ibm8514_MiscIO, 0 ) ; /* reset 'miscio' */
X    CRTCMODE( 0x0053 ) ; /* reset on */
X    ibm8514SetVideoRegisters() ;
X    CRTCMODE( 0x0033 ) ; /* reset off */
X
X    ibm8514outw( ibm8514_MiscIO,    0x0005 ) ;   /* set 'miscio' */
X    ibm8514outw( ibm8514_Control,   0x9000 ) ;    /* reset brecon */
X    ibm8514outw( ibm8514_SecDecode, 0x5006 ) ;   /* set config */
X    ibm8514outw( ibm8514_Control,   0x400F ) ;    /* set constat */
X
X    ibm8514ATRNotBusy ;
X    ibm8514CheckQueue( 7 ) ;
X    SETCOL0( 0 ) ;
X    SETCOL1( ibm8514ALLPLANES ) ;
X    PLNWENBL( ibm8514ALLPLANES ) ; /* enable all planes for write */
X    PLNRENBL( ibm8514ALLPLANES ) ; /* enable all planes for read */
X    SETFN0( FNCOLOR0, FNREPLACE ) ; /* my routines assume this is true */
X    SETFN1( FNCOLOR1, FNREPLACE ) ; /* my routines assume this is true */
X    SETMODE( M_ONES ) ; /* assumed by this set of routines */
X
X    ibm8514CheckQueue( 6 ) ;
X    SETPAT0( 0 ) ; /* currently, I am not using the Pattern registers */
X    SETPAT1( 0 ) ;
X    SETXMIN( 0 ) ; /* clip */
X    SETYMIN( 0 ) ; /* clip */
X    SETXMAX( _8514_SCREEN_WIDTH - 1 ) ; /* clip */
X    SETYMAX( 1023 ) ; /* clip */
X
X    return ;
X}
X
Xint
Xibm8514ScreenInitHW( index )	/* returns number of planes */
Xregister int index ;
X{
Xregister int planes ;
Xextern void ibm8514osdInit() ; /* defined in ibm8514osd.c */
X
XTRACE( ( "ibm8514ScreenInitHW(index=%d)\n", index ) ) ;
X
X    mergexlate[GXclear]	 	= 0x01 ;
X    mergexlate[GXand] 		= 0x0C ;
X    mergexlate[GXandReverse] 	= 0x0D ;
X    mergexlate[GXcopy] 		= 0x07 ;
X    mergexlate[GXandInverted] 	= 0x0E ;
X    mergexlate[GXnoop] 		= 0x03 ;
X    mergexlate[GXxor] 		= 0x05 ;
X    mergexlate[GXor] 		= 0x0B ;
X    mergexlate[GXnor] 		= 0x0F ;
X    mergexlate[GXequiv] 	= 0x06 ;
X    mergexlate[GXinvert] 	= 0x00 ;
X    mergexlate[GXorReverse] 	= 0x0A ;
X    mergexlate[GXcopyInverted] 	= 0x04 ;
X    mergexlate[GXorInverted] 	= 0x09 ;
X    mergexlate[GXnand] 		= 0x08 ;
X    mergexlate[GXset]	 	= 0x02 ;
X
X    /* ******************** OS-DEPENDANT CALL ******************** */
X    ibm8514osdInit( index ) ; /* defined in ibm8514osd.c */
X    /* Now is the first time the device registers may be referenced legally */
X    if ( !( planes = ibm8514QueryPlanes() ) || ( ibm8514QueryHead() < 0 ) )
X	return 0 ;
X
X    ibm8514InitializeHardwareState() ;
X
X    return planes ;
X}
X
X#if defined(ATR) && defined(BSDrt)
X
X/**********************************************************************
********/
X/*
X *			WARNING!!!!!!!!!!!
X *
X * This routine does byte swapping!!  If you've never encountered this
X * delightful consumer of your time, be careful!  And be glad you're dealing
X * with Intel processors!!!
X *
X * Need to Byte-Swap for RT processor
X */
Xunsigned short
Xibm8514inw(addr)
Xregister unsigned int addr ;
X{
Xregister unsigned long int retval ;
X
Xretval = *( (volatile unsigned long int *) ( addr | WORDADD ) ) ;
Xreturn (unsigned short) ( ((retval&0x0000ff00)>>8) |
((retval&0x000000ff)<<8) ) ;
X}
X#endif
X
X/**********************************************************************
********/
X
X#if defined(DEBUG) && !defined(NDEBUG)
X
X#include <fcntl.h>
X
Xint
Xibm8514LoadPalette(fn)
Xchar *fn ;
X{ int fh,i ;
X  unsigned char block[1024],c,r,g,b,*p ;
X  unsigned int red,green,blue ;
X
X  fh = open(fn,O_RDONLY) ;
X  if (fh<0) { ErrorF("ibm8514LoadPalette: Error opening %s\n",fn) ;
return(-1) ; }
X
X  i = read(fh,block,1024) ;
X  if (i!=1024) {ErrorF("ibm8514LoadPalette: Error reading %s\n",fn)
;return(-1) ;}
X
X  p = block ;
X  for (i=0 ; i<256 ; i++)
X         {
X         c = i ;
X         r = *p++ ;
X         b = *p++ ;  /* note that its RBG, unlike hardware, which is RGB */
X         g = *p++ ;
X         p++ ; /* dummy */
X	red   = ((int)r) ;
X	green = ((int)g) ;
X	blue  = ((int)b) ;
X	red   <<=8 ;
X	green <<=8 ; /* file contents are 8 bits per color */
X	blue  <<=8 ;
X         ibm8514SetColor(c,red,green,blue) ;
X         }
X  (void) close(fh) ;
Xreturn 0 ;
X}
X#endif
END-of-ibm8514/brcUtils.c
echo x - ibm8514/ibm8514reg.h
sed 's/^X//' >ibm8514/ibm8514reg.h << 'END-of-ibm8514/ibm8514reg.h'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *
X * Hardware interface routines for IBM 8514/A adapter for
X * X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/ibm8514reg.h,v 30.0
89/01/23 19:24:09 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/ibm8514reg.h,v $ */
X
X#if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS)
Xstatic char *rcsidibm8514reg = "$Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/ibm8514reg.h,v 30.0
89/01/23 19:24:09 paul Exp $";
X#endif
X
X/* Magic I/O port addresses */
X#define QSTATADD 	0xDAE8
X#define QCTRLADD 	0x42E8
X
X#if !defined(IBM_OS_HAS_HFT)
X#define PALMASK 	0x42EA
X#define PALREAD_ADDR 	0x42EB
X#define PALWRITE_ADDR 	0x42EC
X#define PALDATA 	0x42ED
X#else /* HFT on Danbury Kernel. Yuk. */
X#define PALMASK 	0x02EA
X#define PALREAD_ADDR 	0x02EB
X#define PALWRITE_ADDR 	0x02EC
X#define PALDATA 	0x02ED
X#endif
X
X#define VARDATA		0xE2E8
X
X/* Register Constants -- Wait on I/O busy */
X#define ibm8514WaitOnIO		0x4000	/* This Does Wait IF busy */
X#define ibm8514_Y0		( 0x82E8 | ibm8514WaitOnIO )
X#define ibm8514_X0		( 0x86E8 | ibm8514WaitOnIO )
X#define ibm8514_Y1		( 0x8AE8 | ibm8514WaitOnIO )
X#define ibm8514_X1		( 0x8EE8 | ibm8514WaitOnIO )
X#define ibm8514_K1		ibm8514_Y1
X#define ibm8514_K2		ibm8514_X1
X#define ibm8514_ErrorAcc	( 0x92E8 | ibm8514WaitOnIO )
X#define ibm8514_LX		( 0x96E8 | ibm8514WaitOnIO )
X#define ibm8514_Qstatus		( 0x9AE8 )
X#define ibm8514_CMD		( ibm8514_Qstatus | ibm8514WaitOnIO )
X#define ibm8514_ShortStroke	( 0x9EE8 | ibm8514WaitOnIO )
X#define ibm8514_Color0		( 0xA2E8 | ibm8514WaitOnIO )
X#define ibm8514_Color1		( 0xA6E8 | ibm8514WaitOnIO )
X#define ibm8514_PlaneWE		( 0xAAE8 | ibm8514WaitOnIO )
X#define ibm8514_PlaneRE		( 0xAEE8 | ibm8514WaitOnIO )
X#define ibm8514_ColorCMP	( 0xB2E8 | ibm8514WaitOnIO )
X#define ibm8514_Func0		( 0xB6E8 | ibm8514WaitOnIO )
X#define ibm8514_Func1		( 0xBAE8 | ibm8514WaitOnIO )
X#define ibm8514_SecDecode	( 0xBEE8 | ibm8514WaitOnIO )
X#define ibm8514_Control		( 0x42E8 )
X#define ibm8514_Status		ibm8514_Control
X#define ibm8514_PromPage	( 0x46E8 )
X#define ibm8514_MiscIO		( 0x4AE8 )
X
X/* Manifest Constants */
X#define IM_DEEP8 	0x01
X#define IM_DEEP4 	0x44
X#define IM_MON0  	0x13	/* clear image */
X#define IM_MON1  	0x23	/* transmorgrified, and twice as big */
X
X#define M_ONES	 	0xA000
X#define M_PATTS  	0xA040
X#define M_VAR	 	0xA080
X#define M_CPYRCT 	0xA0C0
X#define M_ACROSS 	0xA004
X#define M_DEPTH  	0xA000
X#define M_PLFILL  	0xA004
X
X#define FNCOLOR0 	0x0000
X#define FNCOLOR1 	0x0020
X#define FNVAR	 	0x0040
X#define FNCPYRCT 	0x0060
X#define FNREPLACE	0x0007
X#define FNNOP		0x0003
X#define FNAND		0x000C
X#define FNOR		0x000B
X#define FNXOR		0x0005
X#define FNMIN		0x0010
X#define FNMAX		0x0014
X
X#define CLOSE 		ibm8514outw( QCTRLADD, 0 )
X#define FULLSC(C) 	rect( C, 0, 0, 1024, 1024 )
X
X#define IBM8514MAXPLANES 8
X#define ibm8514ALLPLANES ~( ( ~0 ) << IBM8514MAXPLANES )
X
X#define WPLANE0		0x0001
X#define WPLANE1		0x0002
X#define WPLANE2		0x0004
X#define WPLANE3		0x0008
X#define WPLANE4		0x0010
X#define WPLANE5		0x0020
X#define WPLANE6		0x0040
X#define WPLANE7		0x0080
X#define WPLANES		ibm8514ALLPLANES
X
X#define RPLANE0		0x0002
X#define RPLANE1		0x0004
X#define RPLANE2		0x0008
X#define RPLANE3		0x0010
X#define RPLANE4		0x0020
X#define RPLANE5		0x0040
X#define RPLANE6		0x0080
X#define RPLANE7		0x0001
X#define RPLANES		ibm8514ALLPLANES
X
X/* ************************ COMMAND MACROS ************************ */
X#define SETMODE(M)	ibm8514outw( ibm8514_SecDecode, M )
X#define SETCOL0(C)	ibm8514outw( ibm8514_Color0, C )
X#define SETCOL1(C)	ibm8514outw( ibm8514_Color1, C )
X#define SETFN0(C, ALU)	ibm8514outw( ibm8514_Func0, ( ( C ) | ( ALU ) ) )
X#define SETFN1(C, ALU)	ibm8514outw( ibm8514_Func1, ( ( C ) | ( ALU ) ) )
X#define PLNWENBL(C)	ibm8514outw( ibm8514_PlaneWE, C )
X#define PLNRENBL(C)	ibm8514outw( ibm8514_PlaneRE, C )
X#define COLRCOMP(C)	ibm8514outw( ibm8514_ColorCMP, C )
X#define SETVAR(C)	ibm8514outw( VARDATA, C )
X#define GETVAR		ibm8514inw( VARDATA )
X
X#define CRTCMODE(C)  	outb( 0x22E8, C )
X#define MISCIO(C)   	ibm8514outw( ibm8514_MiscIO, C )
X#define SETET(C)   	ibm8514outw( ibm8514_ErrorAcc, C )
X#define SETK1(C)   	ibm8514outw( ibm8514_K1, C )
X#define SETK2(C)   	ibm8514outw( ibm8514_K2, C )
X#define SETY0(C)   	ibm8514outw( ibm8514_Y0, ((C)&0x07FF) )
X#define SETX0(C)   	ibm8514outw( ibm8514_X0, ((C)&0x07FF) )
X#define SETY1(C)   	ibm8514outw( ibm8514_Y1, ((C)&0x07FF) )
X#define SETX1(C)   	ibm8514outw( ibm8514_X1, ((C)&0x07FF) )
X#define SETLX(C)   	ibm8514outw( ibm8514_LX, C )
X#define SETLY(C)   	ibm8514outw( ibm8514_SecDecode, C )
X#define SETXMAX(C)  	ibm8514outw( ibm8514_SecDecode, (((C) & 0x0FFF)|0x4000))
X#define SETXMIN(C)  	ibm8514outw( ibm8514_SecDecode, (((C) & 0x0FFF)|0x2000))
X#define SETYMAX(C)  	ibm8514outw( ibm8514_SecDecode, (((C) & 0x0FFF)|0x3000))
X#define SETYMIN(C)  	ibm8514outw( ibm8514_SecDecode, (((C) & 0x0FFF)|0x1000))
X#define SETPAT0(C)  	ibm8514outw( ibm8514_SecDecode, (((C) & 0x001E)|0x8000))
X#define SETPAT1(C)  	ibm8514outw( ibm8514_SecDecode, (((C) & 0x001E)|0x9000))
X#define COMMAND(C)  	ibm8514outw( QSTATADD, C )
X
X/* ************************ COMMAND DEFINES ************************ */
X/* Bits 15, 14 & 13 are the command selector */
X#define ibm8514cmd_Null		0x0000
X#define ibm8514cmd_Vector	0x2000
X#define ibm8514cmd_HRect	0x4000
X#define ibm8514cmd_VRect	0x6000
X#define ibm8514cmd_FRect	0x8000
X#define ibm8514cmd_OutlDraw	0xA000
X#define ibm8514cmd_CopyRect	0xC000
X#define ibm8514cmd_ILLEGAL	0xE000
X
X/* Bit 12 selects whether the data is byte-swapped */
X#if defined(ATRIO) || defined(PCIO)
X#define ibm8514ByteOrder	0x1000
X#else
X	******** Error ********
X#endif
X
X/* Bits 10 & 11 are always 0 */
X
X/* Bit 9 selects for 8 or 16 bit data */
X#define ibm8514cmd_WordData	0x0000
X#define ibm8514cmd_ByteData	0x0200
X
X/* Bit 8 selects for Fixed or variable Data */
X#define ibm8514cmd_FData	0x0000
X#define ibm8514cmd_VData	0x0100
X
X/* Bits 7, 6 & 5 are the Coded Direction selector */
X#define ibm8514cmd_pXpYpZ	0x00E0
X#define ibm8514cmd_pXpYnZ	0x00C0
X#define ibm8514cmd_pXnYpZ	0x00A0
X#define ibm8514cmd_pXnYnZ	0x0080
X#define ibm8514cmd_nXpYpZ	0x0060
X#define ibm8514cmd_nXpYnZ	0x0040
X#define ibm8514cmd_nXnYpZ	0x0020
X#define ibm8514cmd_nXnYnZ	0x0000
X
X/* Bit 4 deterines if the does anything */
X/* if set to zero the 8514 calculates but doesn't change anything
X * Also if zero no data may be read or written */
X#define ibm8514cmd_DoAccess	0x0010
X#define ibm8514cmd_MoveOnly	0x0000
X
X/* Bit 3 selects if the Coded Direction field is used */
X#define ibm8514cmd_UseCDir	0x0008
X#define ibm8514cmd_DontUseCDir	0x0000
X
X/* Bit 2 selects if the Last Pel is accessed */
X#define ibm8514cmd_LastPelNull	0x0004
X#define ibm8514cmd_UseLastPel	0x0000
X
X/* Bit 1 selects for Actual Pel Accrual */
X#define ibm8514cmd_AccruePels	0x0002
X#define ibm8514cmd_NoAccrue	0x0000
X
X/* Bit 0 selects for Read or Write Data */
X#define ibm8514cmd_Read		0x0000
X#define ibm8514cmd_Write	0x0001
X
X/* ************ Actual COMMAND Bitpattern DEFINES ************ */
X#define ibm8514WriteZData	( ibm8514cmd_HRect \
X				| ibm8514ByteOrder \
X				| ibm8514cmd_ByteData \
X				| ibm8514cmd_VData \
X				| ibm8514cmd_pXpYpZ \
X				| ibm8514cmd_DoAccess \
X				| ibm8514cmd_DontUseCDir \
X				| ibm8514cmd_UseLastPel \
X				| ibm8514cmd_NoAccrue \
X				| ibm8514cmd_Write )
X#define ibm8514ReadZData	( ibm8514cmd_HRect \
X				| ibm8514ByteOrder \
X				| ibm8514cmd_ByteData \
X				| ibm8514cmd_VData \
X				| ibm8514cmd_pXpYpZ \
X				| ibm8514cmd_DoAccess \
X				| ibm8514cmd_DontUseCDir \
X				| ibm8514cmd_UseLastPel \
X				| ibm8514cmd_NoAccrue \
X				| ibm8514cmd_Read )
X
X#define ibm8514WriteXYData	( ibm8514cmd_HRect \
X				| ibm8514ByteOrder \
X				| ibm8514cmd_ByteData \
X				| ibm8514cmd_VData \
X				| ibm8514cmd_pXpYpZ \
X				| ibm8514cmd_DoAccess \
X				| ibm8514cmd_DontUseCDir \
X				| ibm8514cmd_UseLastPel \
X				| ibm8514cmd_AccruePels \
X				| ibm8514cmd_Write )
END-of-ibm8514/ibm8514reg.h
echo x - ibm8514/x8514.h
sed 's/^X//' >ibm8514/x8514.h << 'END-of-ibm8514/x8514.h'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *
X * Hardware interface routines for IBM 8514/A adapter for
X * X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/x8514.h,v 30.0
89/01/23 19:24:45 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/x8514.h,v $ */
X
X#if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS)
Xstatic char *rcsidx8514 = "$Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/x8514.h,v 30.0
89/01/23 19:24:45 paul Exp $";
X#endif
X
X#if !defined(i386) && !defined(iAPX386) && !defined(iAPX286)
X/* ibm 6152 */
X#ifndef ATR
X#define ATR
X#endif
X#ifndef ATRIO
X#define ATRIO
X#endif
X#ifdef PCIO
X#undef PCIO
X#endif
X
X#else
X/* ibm AIX/386 */
X#ifdef ATR
X#undef ATR
X#endif
X#ifndef PCIO
X#define PCIO
X#endif
X#ifdef ATRIO
X#undef ATRIO
X#endif
X
X#endif
X
X#if defined(ibm032) && defined(BSDrt)
X
X#define SWAP_ADJUST( x ) (x) /* Code originally written for the rt */
X
Xextern unsigned short ibm8514inw() ;
X#define ibm8514outw(port, val16) \
X	outw( port, (((val16 & 0x0000FF00)>>8) | ((val16 & 0x000000FF)<<8)) )
X
X/* The folowing are two magic addresses for the ATR kernel */
X#define BYTEADD 0xD00F0000
X#define WORDADD 0xD00E0000
X
X#else
X#if defined(i386) || defined(iAPX386) || defined(iAPX286)
X
X/* Code originally written for the rt */
X#define SWAP_ADJUST( x ) ((((x)&0xFF)<<8)|(((x)>>8)&0xFF))
X
X#define ibm8514inw( addr ) inw( (addr) )
X#define ibm8514outw(port, val16) outw( (port), (val16) )
X
X#else
X	******** ERROR ********
X#endif
X#endif
X
X/* Memory Reference Portability Macros */
X#include "ibmIOArch.h"
X
X/* Device Register Definitions */
X#include "ibm8514reg.h"
X
X/* Supported display tube types */
X#define HEAD_GRAY1024 	1
X#define HEAD_COLOR1024 	2
X#define HEAD_GRAY640 	5
X#define HEAD_COLOR640 	6
X#define HEAD_NONE 	7
X
X#define HALFQBUF	4
X
X/* Psuedo-Functions for adapter control */
X#define QSTAT ( ibm8514inw( QSTATADD ) )
X#define QCTRL ( ibm8514inw( QCTRLADD ) )
X#define QCSTAT ( ibm8514inw( 0x02E8 ) )
X
X#define ibm8514NotBusy \
X	while ( QSTAT & 0x0200 ) /* Do Nothing */ ;
X
X/* Note N must be < 9, otherwise the result is indeterminate */
X#define ibm8514ClearQueue( numSlots )	\
X	while ( ( 0x0100 >> ( numSlots ) ) & QSTAT ) ;
X
X#if defined(ATRIO) || ( defined(ibm032) && defined(BSDrt) )
X#define ibm8514CheckQueue(N)	/* Noop on 6152 !! */
X#define ibm8514ATRNotBusy 	ibm8514NotBusy
X#else
X#define ibm8514CheckQueue(N)	ibm8514ClearQueue(N)
X#define ibm8514ATRNotBusy 	/* No-op on 386 */
X#endif
X
X#define _8514_SCREENHEIGHT	768
X#define _8514_SCREENWIDTH	1024
X#define _8514_SCREEN_HEIGHT	768
X#define _8514_SCREEN_WIDTH	1024
X
X#define ibm8514MaxCursorWidth	32
X#define ibm8514MaxCursorHeight	32
X#define SAVELOCX 0
X#define SAVELOCY ( _8514_SCREENHEIGHT + 1 )
X#define CUR1LOCX ( SAVELOCX + ibm8514MaxCursorWidth )
X#define CUR1LOCY ( _8514_SCREENHEIGHT + 1 )
X#define CUR0LOCX ( CUR1LOCX + ibm8514MaxCursorWidth )
X#define CUR0LOCY ( _8514_SCREENHEIGHT + 1 )
X#define C1X 		CUR1LOCX
X#define C1Y		( _8514_SCREENHEIGHT + 1 )
X#define C0X		CUR0LOCX
X#define C0Y		( _8514_SCREENHEIGHT + 1 )
X#define SAVEX		SAVELOCX
X#define SAVEY		( _8514_SCREENHEIGHT + 1 )
X#define CURD_X		ibm8514MaxCursorWidth
X#define CURD_Y		ibm8514MaxCursorHeight
X
X#define TILE_X		96
X#define TILE_Y		( _8514_SCREENHEIGHT + 1 )
X#define ROTTILE_X	128
X#define ROTTILE_Y	( _8514_SCREENHEIGHT + 1 )
X#define MAXTILESIZE	32
X
X#define STIPX		0
X#define MAXSTIPPLEWIDTH	( _8514_SCREENWIDTH - STIPX )
X#define STIPY		802
X#define MAXSTIPPLEHEIGHT 220
X#define FILL_STAGE_WPLANE	0x02
X#define FILL_STAGE_RPLANE	0x02
X#define MONO_STAGE_SIZE		200
X#define MONO_STAGE_WPLANE	WPLANE0
X#define MONO_STAGE_RPLANE	RPLANE0
X#define MONO_STAGE_X		0
X#define MONO_STAGE_Y		803
X
X/* Default Colors */
X#define IBM8514_BLACK_PIXEL 0
X#define IBM8514_WHITE_PIXEL 1
X
X/* Name of device file for "unix" ( Not AIX ) */
X#define IBM8514_DEV_FILE "/dev/ibm8514"
X
X/* Tom's stylistic effects */
X#define then
X
X#ifndef TRUE
X#define TRUE -1
X#endif
X
X#ifndef FALSE
X#define FALSE 0
X#endif
END-of-ibm8514/x8514.h
exit
Technical Details
Message-ID: <4476@ibmpa.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ibmpa!dolphin.tcspa.ibm.com!mlewis

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ibmpa!dolphin.tcspa.ibm.com!mlewis
From: mlewis@dolphin.tcspa.ibm.com (Mark S. Lewis)
Newsgroups: comp.sys.ibm.pc.rt
Subject: IBM 8514 source code (part 6 of 6) for X11 Release 4
Keywords: V1.32_kit.6 8514 X11R4
Message-ID: <4476@ibmpa.UUCP>
Date: 12 Mar 90 23:22:50 GMT
Sender: news@ibmpa.UUCP
Reply-To: mlewis@ibmsupt.UUCP
Followup-To: comp.sys.ibm.pc.rt
Organization: IBM AWD, Palo Alto
Lines: 950