Index: trunk/src/opengl/glide/sst1/.depend
===================================================================
--- trunk/src/opengl/glide/sst1/.depend	(revision 2885)
+++ trunk/src/opengl/glide/sst1/.depend	(revision 2885)
@@ -0,0 +1,135 @@
+initterm.obj: \
+       initterm.cpp \
+       ..\..\..\..\include\os2wrap.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\..\..\..\include\odin.h \
+       ..\..\..\..\include\win32type.h \
+       ..\..\..\..\include\winconst.h \
+       ..\..\..\..\include\odinlx.h \
+       ..\..\..\..\include\misc.h
+glideres.obj: \
+       glideres.asm
+..\..\..\..\include\codepage.h: \
+       k:\toolkit\H\uconv.h
+..\..\..\..\include\comtype.h:
+..\..\..\..\include\cpuhlp.h:
+..\..\..\..\include\dcdata.h:
+..\..\..\..\include\exceptions.h: \
+       ..\..\..\..\include\win32type.h \
+       ..\..\..\..\include\misc.h
+..\..\..\..\include\excpt.h:
+..\..\..\..\include\exitlist.h:
+..\..\..\..\include\HandleManager.h: \
+       ..\..\..\..\include\winos2def.h
+..\..\..\..\include\heap.h: \
+       ..\..\..\..\include\win\winbase.h
+..\..\..\..\include\heapcode.h: \
+       ..\..\..\..\include\heapshared.h
+..\..\..\..\include\heapshared.h: \
+       k:\ibmcpp\INCLUDE\stddef.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\umalloc.h
+..\..\..\..\include\heapstring.h: \
+       ..\..\..\..\include\odin.h
+..\..\..\..\include\midimapr.h:
+..\..\..\..\include\misc.h: \
+       ..\..\..\..\include\win32type.h \
+       ..\..\..\..\include\versionos2.h \
+       ..\..\..\..\include\unicode.h
+..\..\..\..\include\nameid.h:
+..\..\..\..\include\odin.h: \
+       k:\ibmcpp\INCLUDE\builtin.h
+..\..\..\..\include\odinlx.h:
+..\..\..\..\include\odinrsrc.h:
+..\..\..\..\include\odinwrap.h: \
+       ..\..\..\..\include\os2sel.h \
+       k:\ibmcpp\INCLUDE\malloc.h
+..\..\..\..\include\os2mewrap.h: \
+       k:\toolkit\H\os2me.h
+..\..\..\..\include\os2newapi.h:
+..\..\..\..\include\os2sel.h:
+..\..\..\..\include\OS2WIN.H: \
+       ..\..\..\..\include\win32type.h \
+       ..\..\..\..\include\odin.h \
+       ..\..\..\..\include\win\windef.h \
+       ..\..\..\..\include\win\winbase.h \
+       ..\..\..\..\include\win\wingdi.h \
+       ..\..\..\..\include\win\winuser.h \
+       ..\..\..\..\include\win\winerror.h \
+       ..\..\..\..\include\win\commdlg.h \
+       ..\..\..\..\include\win\ddeml.h \
+       ..\..\..\..\include\win\mmsystem.h \
+       ..\..\..\..\include\os2sel.h \
+       ..\..\..\..\include\misc.h
+..\..\..\..\include\os2wrap.h: \
+       k:\toolkit\H\os2.h \
+       ..\..\..\..\include\os2sel.h \
+       ..\..\..\..\include\os2newapi.h
+..\..\..\..\include\pefile.h: \
+       k:\toolkit\H\os2.h \
+       ..\..\..\..\include\win32type.h \
+       ..\..\..\..\include\win\peexe.h \
+       k:\ibmcpp\INCLUDE\stdlib.h
+..\..\..\..\include\pmmenu.h:
+..\..\..\..\include\spy.h:
+..\..\..\..\include\unicode.h: \
+       ..\..\..\..\include\uniconv.h
+..\..\..\..\include\uniconv.h: \
+       k:\ibmcpp\INCLUDE\stddef.h \
+       k:\ibmcpp\INCLUDE\time.h
+..\..\..\..\include\versionos2.h:
+..\..\..\..\include\virtual.h:
+..\..\..\..\include\vmutex.h:
+..\..\..\..\include\win32type.h: \
+       ..\..\..\..\include\odin.h
+..\..\..\..\include\win32util.h:
+..\..\..\..\include\win32wnd.h:
+..\..\..\..\include\winaccel.h:
+..\..\..\..\include\winconst.h:
+..\..\..\..\include\wincursor.h:
+..\..\..\..\include\windllbase.h: \
+       ..\..\..\..\include\winimagebase.h \
+       ..\..\..\..\include\odinlx.h
+..\..\..\..\include\windlllx.h: \
+       ..\..\..\..\include\windllbase.h \
+       ..\..\..\..\include\winimagelx.h
+..\..\..\..\include\windllpe2lx.h: \
+       ..\..\..\..\include\windllbase.h \
+       ..\..\..\..\include\winimagepe2lx.h
+..\..\..\..\include\windllpeldr.h: \
+       ..\..\..\..\include\windllbase.h \
+       ..\..\..\..\include\winimagepeldr.h
+..\..\..\..\include\wineuni.h:
+..\..\..\..\include\winexebase.h: \
+       ..\..\..\..\include\winimagebase.h
+..\..\..\..\include\winexelx.h: \
+       ..\..\..\..\include\winexebase.h \
+       ..\..\..\..\include\winimagelx.h \
+       ..\..\..\..\include\odinlx.h
+..\..\..\..\include\winexepe2lx.h: \
+       ..\..\..\..\include\winexebase.h \
+       ..\..\..\..\include\winimagepe2lx.h
+..\..\..\..\include\winexepeldr.h: \
+       ..\..\..\..\include\winexebase.h \
+       ..\..\..\..\include\winimagepeldr.h
+..\..\..\..\include\winfakepeldr.h: \
+       ..\..\..\..\include\winimagepeldr.h
+..\..\..\..\include\winicon.h:
+..\..\..\..\include\winimagebase.h: \
+       ..\..\..\..\include\win\peexe.h
+..\..\..\..\include\winimagelx.h: \
+       ..\..\..\..\include\winimagebase.h
+..\..\..\..\include\winimagepe2lx.h: \
+       ..\..\..\..\include\winimagebase.h
+..\..\..\..\include\winimagepeldr.h: \
+       ..\..\..\..\include\winimagebase.h
+..\..\..\..\include\winkeyboard.h:
+..\..\..\..\include\winmenu.h:
+..\..\..\..\include\winos2def.h:
+..\..\..\..\include\winres.h:
+..\..\..\..\include\wprocess.h: \
+       ..\..\..\..\include\win\winprocess.h \
+       ..\..\..\..\include\winconst.h \
+       ..\..\..\..\include\win\thread.h
Index: trunk/src/opengl/glide/sst1/3dfx.mak
===================================================================
--- trunk/src/opengl/glide/sst1/3dfx.mak	(revision 2885)
+++ trunk/src/opengl/glide/sst1/3dfx.mak	(revision 2885)
@@ -0,0 +1,26 @@
+C3DFXFLAGS = /DGLIDE_USE_C_TRISETUP /DFX_DLL_DEFINITION /DFX_DLL_ENABLE /DGLIDE_LIB /DGLIDE_CHIP_BROADCAST=1 /DGLIDE_DEFAULT_GAMMA=1.3f /DGLIDE_BLIT_CLEAR=1 /DGLIDE_HW_TRI_SETUP=1
+CHW = /DSST1
+CFLAGS     = $(CFLAGS) /Sp1 $(C3DFXFLAGS) $(CHW)
+
+!IF "$(FX_DEBUG)" == "1"
+C3DFXFLAGS = $(C3DFXFLAGS) /DGDB_INFO_ON /Ti
+!endif
+
+!IF "$(FX_LISTING)" == "" 
+FX_LISTING = 0
+!ENDIF
+
+FX_DLL_BUILD=1
+FX_GLIDE_CTRISETUP=1
+FX_GLIDE_HW=SST1
+FX_HW_PROJECTS=GLIDE
+HAL_HW=1
+FX_NO_GEN_BOF=1
+FX_OPTIMIZE=1
+
+AT_LOADER_MG=1
+
+FX_COMPILER=IBM
+FX_TARGET=OS2
+FX_HOST=OS2
+
Index: trunk/src/opengl/glide/sst1/LICENSE.TXT
===================================================================
--- trunk/src/opengl/glide/sst1/LICENSE.TXT	(revision 2885)
+++ trunk/src/opengl/glide/sst1/LICENSE.TXT	(revision 2885)
@@ -0,0 +1,259 @@
+$Id: LICENSE.TXT,v 1.1 2000-02-25 00:31:05 sandervl Exp $
+@c This is an additional Odin license agreement.
+@c It supercedes the main Odin license, but is only valid in 
+@c the source directory and any of it's subdirectories in which it is present.
+3DFX GLIDE Source Code General Public License
+
+
+1. PREAMBLE
+
+	This license is for software that provides a 3D graphics application 
+	program interface (API).The license is intended to offer terms similar
+	to some standard General Public Licenses designed to foster open 
+	standards and unrestricted accessibility to source code. Some of these
+	licenses require that, as a condition of the license of the software, 
+	any derivative works (that is, new software which is a work containing
+	the original program or a portion of it) must be available for general
+	use, without restriction other than for a minor transfer fee, and that
+	the source code for such derivative works must likewise be made 
+	available. The only restriction is that such derivative works must be
+	subject to the same General Public License terms as the original work. 
+
+	This 3dfx GLIDE Source Code General Public License differs from the
+	standard licenses of this type in that it does not require the entire
+	derivative work to be made available under the terms of this license
+	nor is the recipient required to make available the source code for
+	the entire derivative work. Rather, the license is limited to only the
+	identifiable portion of the derivative work that is derived from the
+	licensed software. The precise terms and conditions for copying, 
+	distribution and modification follow.
+
+
+2. DEFINITIONS
+
+	2.1 This License applies to any program (or other "work") which 
+	contains a notice placed by the copyright holder saying it may be 
+	distributed under the terms of this 3dfx GLIDE Source Code General 
+	Public License. 
+
+	2.2 The term "Program" as used in this Agreement refers to 3DFX's 
+	GLIDE source code and object code and any Derivative Work.
+
+	2.3 "Derivative Work" means, for the purpose of the License, that 
+	portion of any work that contains the Program or the identifiable 
+	portion of a work that is derived from the Program, either verbatim or
+	with modifications and/or translated into another language, and that 
+	performs 3D graphics API operations. It does not include any other 
+	portions of a work.
+
+	2.4 "Modifications of the Program" means any work, which includes a
+	Derivative Work, and includes the whole of such work.
+
+	2.5 "License" means this 3dfx GLIDE Source Code General Public License.
+
+	2.6 The "Source Code" for a work means the preferred form of the work
+	for making modifications to it. For an executable work, complete source
+	code means all the source code for all modules it contains, any
+	associated interface definition files, and the scripts used to control
+	compilation and installation of the executable work.
+
+	2.7 "3dfx" means 3dfx Interactive, Inc.
+
+
+3. LICENSED ACTIVITIES
+
+	3.1 COPYING - You may copy and distribute verbatim copies of the 
+	Program's Source Code as you receive it, in any medium, subject to the
+	provision of section 3.3 and provided also that:
+
+		(a) you conspicuously and appropriately publish on each copy
+	an appropriate copyright notice (3dfx Interactive, Inc. 1999), a notice
+	that recipients who wish to copy, distribute or modify the Program can
+	only do so subject to this License, and a disclaimer of warranty as
+	set forth in section 5;
+
+		(b) keep intact all the notices that refer to this License and
+	to the absence of any warranty; and
+ 
+		(c) do not make any use of the GLIDE trademark without the prior
+	written permission of 3dfx, and 
+
+		(d) give all recipients of the Program a copy of this License
+	along with the Program or instructions on how to easily receive a copy
+	of this License.
+
+
+	3.2 MODIFICATION OF THE PROGRAM/DERIVATIVE WORKS - You may modify your
+	copy or copies of the Program or any portion of it, and copy and
+	distribute such modifications subject to the provisions of section 3.3
+	and provided that you also meet all of the following conditions: 
+
+		(a) you conspicuously and appropriately publish on each copy
+	of a Derivative Work an appropriate copyright notice, a notice that
+	recipients who wish to copy, distribute or modify the Derivative Work
+	can only do so subject to this License, and a disclaimer of warranty
+	as set forth in section 5;
+
+		(b) keep intact all the notices that refer to this License and
+	to the absence of any warranty; and
+ 
+		(c) give all recipients of the Derivative Work a copy of this
+	License along with the Derivative Work or instructions on how to easily
+	receive a copy of this License.
+
+		(d) You must cause the modified files of the Derivative Work
+	to carry prominent notices stating that you changed the files and the
+	date of any change. 
+
+		(e) You must cause any Derivative Work that you distribute or
+	publish to be licensed at no charge to all third parties under the
+	terms of this License. 
+
+		(f) You do not make any use of the GLIDE trademark without the 
+	prior written permission of 3dfx.
+		
+		(g) If the Derivative Work normally reads commands 
+	interactively when run, you must cause it, when started running for
+	such interactive use, to print or display an announcement as follows:
+
+	"COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED THIS 
+	SOFTWARE IS FREE AND PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, 
+	EITHER EXPRESSED OR IMPLIED. THERE IS NO RIGHT TO USE THE GLIDE 
+	TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX INTERACTIVE, 
+	INC. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A FULL TEXT OF THE
+	DISTRIBUTION AND NON-WARRANTY PROVISIONS (REQUEST COPY FROM 
+	INFO@3DFX.COM)."
+
+		(h) The requirements of this section 3.2 do not apply to the
+	modified work as a whole but only to the Derivative Work. It is not
+	the intent of this License to claim rights or contest your rights to
+	work written entirely by you; rather, the intent is to exercise the
+	right to control the distribution of Derivative Works. 
+
+
+	3.3 DISTRIBUTION 
+
+		(a) All copies of the Program or Derivative Works which are
+	distributed must include in the file headers the following language
+	verbatim:
+
+	"THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED 
+	ONLY PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO 
+	RIGHT TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 
+	3DFX INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM 
+	THE DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC (info@3dfx.com). 
+	THIS PROGRAM. IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+	EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+	FULL TEXT OF THE NON-WARRANTY PROVISIONS.
+
+	USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+	RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS
+	IN TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+	AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+	SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+	THE UNITED STATES.
+
+	COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED"
+
+		(b) You may distribute the Program or a Derivative Work in
+	object code or executable form under the terms of Sections 3.1 and 3.2
+	provided that you also do one of the following: 
+
+			(1) Accompany it with the complete corresponding
+	machine-readable source code, which must be distributed under the 
+	terms of Sections 3.1 and 3.2; or,
+ 
+			(2) Accompany it with a written offer, valid for at
+	least three years, to give any third party, for a charge no more than
+	your cost of physically performing source distribution, a complete
+	machine-readable copy of the corresponding source code, to be 
+	distributed under the terms of Sections 3.1 and 3.2 on a medium 
+	customarily used for software interchange; or,
+ 
+			(3) Accompany it with the information you received as
+	to the offer to distribute corresponding source code. (This alternative
+	is allowed only for noncommercial distribution and only if you received
+	the program in object code or executable form with such an offer, in
+	accord with Subsection 3.3(b)(2) above.)
+ 
+		(c) The source code distributed need not include anything
+	that is normally distributed (in either source or binary form) with
+	the major components (compiler, kernel, and so on) of the operating
+	system on which the executable runs, unless that component itself
+	accompanies the executable code.
+ 
+		(d) If distribution of executable code or object code is made
+	by offering access to copy from a designated place, then offering
+	equivalent access to copy the source code from the same place counts
+	as distribution of the source code, even though third parties are not
+	compelled to copy the source along with the object code. 
+
+		(e) Each time you redistribute the Program or any Derivative
+	Work, the recipient automatically receives a license from 3dfx and
+	successor licensors to copy, distribute or modify the Program and
+	Derivative Works subject to the terms and conditions of the License.
+	You may not impose any further restrictions on the recipients' 
+	exercise of the rights granted herein. You are not responsible for
+	enforcing compliance by third parties to this License.
+ 
+		(f) You may not make any use of the GLIDE trademark without 
+	the prior written permission of 3dfx.
+
+		(g) You may not copy, modify, sublicense, or distribute the
+	Program or any Derivative Works except as expressly provided under
+	this License. Any attempt otherwise to copy, modify, sublicense or
+	distribute the Program or any Derivative Works is void, and will
+	automatically terminate your rights under this License. However,
+	parties who have received copies, or rights, from you under this
+	License will not have their licenses terminated so long as such
+	parties remain in full compliance.
+
+ 
+4. MISCELLANEOUS
+
+	4.1 Acceptance of this License is voluntary. By using, modifying or
+	distributing the Program or any Derivative Work, you indicate your 
+	acceptance of this License to do so, and all its terms and conditions
+	for copying, distributing or modifying the Program or works based on
+	it. Nothing else grants you permission to modify or distribute the
+	Program or Derivative Works and doing so without acceptance of this
+	License is in violation of the U.S. and international copyright laws.
+
+	4.2 If the distribution and/or use of the Program or Derivative Works
+	is restricted in certain countries either by patents or by copyrighted
+	interfaces, the original copyright holder who places the Program under
+	this License may add an explicit geographical distribution limitation
+	excluding those countries, so that distribution is permitted only in
+	or among countries not thus excluded. In such case, this License
+	incorporates the limitation as if written in the body of this License.
+
+	4.3 This License is to be construed according to the laws of the 
+	State of California and you consent to personal jurisdiction in the
+	State of California in the event it is necessary to enforce the
+	provisions of this License.
+
+
+5. NO WARRANTIES
+
+	5.1 TO THE EXTENT PERMITTED BY APPLICABLE LAW, THERE IS NO WARRANTY
+	FOR THE PROGRAM. OR DERIVATIVE WORKS THE COPYRIGHT HOLDERS AND/OR
+	OTHER PARTIES PROVIDE THE PROGRAM AND ANY DERIVATIVE WORKS"AS IS"
+	WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+	BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+	FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY
+	AND PERFORMANCE OF THE PROGRAM AND ANY DERIVATIVE WORK IS WITH YOU.
+	SHOULD THE PROGRAM OR ANY DERIVATIVE WORK PROVE DEFECTIVE, YOU ASSUME
+	THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+	5.2 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL 3DFX
+	INTERACTIVE, INC., OR ANY OTHER COPYRIGHT HOLDER, OR ANY OTHER PARTY
+	WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM OR DERIVATIVE WORKS AS
+	PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
+	SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+	INABILITY TO USE THE PROGRAM OR DERIVATIVE WORKS (INCLUDING BUT NOT
+	LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES
+	SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM OR
+	DERIVATIVE WORKS TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
+	HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+	DAMAGES.
+
Index: trunk/src/opengl/glide/sst1/glide/.depend
===================================================================
--- trunk/src/opengl/glide/sst1/glide/.depend	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/.depend	(revision 2885)
@@ -0,0 +1,409 @@
+cpudetect.obj: \
+       cpudetect.c \
+       k:\ibmcpp\INCLUDE\stdio.h
+ddgump.obj: \
+       ddgump.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h \
+       .\gump.h
+diglide.obj: \
+       diglide.c \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\glidesys.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h \
+       ..\init\init.h \
+       ..\init\initvg\rcver.h
+digutex.obj: \
+       digutex.c \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+disst.obj: \
+       disst.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\glidesys.h \
+       ..\init\sst1vid.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+ditex.obj: \
+       ditex.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+fxbldno.obj: \
+       fxbldno.c \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\time.h
+fxgasm.obj: \
+       fxgasm.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\glidesys.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+g3df.obj: \
+       g3df.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h \
+       k:\ibmcpp\INCLUDE\ctype.h
+gaa.obj: \
+       gaa.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+gbanner.obj: \
+       gbanner.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\glidesys.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h \
+       .\banner.inc
+gdraw.obj: \
+       gdraw.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h \
+       k:\ibmcpp\INCLUDE\memory.h
+gerror.obj: \
+       gerror.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+gglide.obj: \
+       gglide.c \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\glidesys.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h \
+       .\fxinline.h \
+       ..\init\init.h \
+       ..\init\initvg\rcver.h
+glfb.obj: \
+       glfb.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+gmovie.obj: \
+       gmovie.c \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+gpci.obj: \
+       gpci.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\glidesys.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h \
+       ..\init\sst1vid.h \
+       ..\init\init.h \
+       ..\..\..\..\..\include\win\windows.h \
+       ..\..\..\..\..\include\win\windows.h
+gsplash.obj: \
+       gsplash.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h \
+       .\fxinline.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\splshdat.c
+gsst.obj: \
+       gsst.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\glidesys.h \
+       ..\init\sst1vid.h \
+       ..\init\init.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h \
+       ..\..\..\..\..\include\win\windows.h \
+       ..\..\..\..\..\include\win\windows.h \
+       .\gsstdef.h
+gtex.obj: \
+       gtex.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+gtexdl.obj: \
+       gtexdl.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+gu.obj: \
+       gu.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h \
+       .\fxinline.h \
+       ..\init\initvg\sst1init.h
+guclip.obj: \
+       guclip.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+gump.obj: \
+       gump.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h \
+       .\gump.h
+gutex.obj: \
+       gutex.c \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+gxdraw.obj: \
+       gxdraw.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\glidesys.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+splshdat.obj: \
+       splshdat.c
+sst96.obj: \
+       sst96.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\glidesys.h \
+       ..\init\sst1vid.h \
+       ..\..\swlibs\fxmisc\fxdll.h \
+       .\glide.h \
+       .\fxglide.h
+fxglide.h: \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\init\initvg\sst1init.h \
+       ..\incsrc\sst.h \
+       ..\init\initvg\gdebug.h \
+       ..\init\init.h \
+       k:\ibmcpp\INCLUDE\assert.h
+fxinline.h:
+glide.h: \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\glidesys.h \
+       ..\init\sst1vid.h \
+       .\glideutl.h
+glidesys.h:
+glideutl.h:
+gsstdef.h: \
+       ..\incsrc\sst.h
+gump.h:
+rcver.h:
+cpudtect.obj: \
+       cpudtect.asm
+p6fence.obj: \
+       p6fence.asm
+banner.inc:
+..\..\..\..\..\include\codepage.h: \
+       k:\toolkit\H\uconv.h
+..\..\..\..\..\include\comtype.h:
+..\..\..\..\..\include\cpuhlp.h:
+..\..\..\..\..\include\dcdata.h:
+..\..\..\..\..\include\exceptions.h: \
+       ..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\include\misc.h
+..\..\..\..\..\include\excpt.h:
+..\..\..\..\..\include\exitlist.h:
+..\..\..\..\..\include\HandleManager.h: \
+       ..\..\..\..\..\include\winos2def.h
+..\..\..\..\..\include\heap.h: \
+       ..\..\..\..\..\include\win\winbase.h
+..\..\..\..\..\include\heapcode.h: \
+       ..\..\..\..\..\include\heapshared.h
+..\..\..\..\..\include\heapshared.h: \
+       k:\ibmcpp\INCLUDE\stddef.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\umalloc.h
+..\..\..\..\..\include\heapstring.h: \
+       ..\..\..\..\..\include\odin.h
+..\..\..\..\..\include\midimapr.h:
+..\..\..\..\..\include\misc.h: \
+       ..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\include\versionos2.h \
+       ..\..\..\..\..\include\unicode.h
+..\..\..\..\..\include\nameid.h:
+..\..\..\..\..\include\odin.h: \
+       k:\ibmcpp\INCLUDE\builtin.h
+..\..\..\..\..\include\odinlx.h:
+..\..\..\..\..\include\odinrsrc.h:
+..\..\..\..\..\include\odinwrap.h: \
+       ..\..\..\..\..\include\os2sel.h \
+       k:\ibmcpp\INCLUDE\malloc.h
+..\..\..\..\..\include\os2mewrap.h: \
+       k:\toolkit\H\os2me.h
+..\..\..\..\..\include\os2newapi.h:
+..\..\..\..\..\include\os2sel.h:
+..\..\..\..\..\include\OS2WIN.H: \
+       ..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\include\odin.h \
+       ..\..\..\..\..\include\win\windef.h \
+       ..\..\..\..\..\include\win\winbase.h \
+       ..\..\..\..\..\include\win\wingdi.h \
+       ..\..\..\..\..\include\win\winuser.h \
+       ..\..\..\..\..\include\win\winerror.h \
+       ..\..\..\..\..\include\win\commdlg.h \
+       ..\..\..\..\..\include\win\ddeml.h \
+       ..\..\..\..\..\include\win\mmsystem.h \
+       ..\..\..\..\..\include\os2sel.h \
+       ..\..\..\..\..\include\misc.h
+..\..\..\..\..\include\os2wrap.h: \
+       k:\toolkit\H\os2.h \
+       ..\..\..\..\..\include\os2sel.h \
+       ..\..\..\..\..\include\os2newapi.h
+..\..\..\..\..\include\pefile.h: \
+       k:\toolkit\H\os2.h \
+       ..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\include\win\peexe.h \
+       k:\ibmcpp\INCLUDE\stdlib.h
+..\..\..\..\..\include\pmmenu.h:
+..\..\..\..\..\include\spy.h:
+..\..\..\..\..\include\unicode.h: \
+       ..\..\..\..\..\include\uniconv.h
+..\..\..\..\..\include\uniconv.h: \
+       k:\ibmcpp\INCLUDE\stddef.h \
+       k:\ibmcpp\INCLUDE\time.h
+..\..\..\..\..\include\versionos2.h:
+..\..\..\..\..\include\virtual.h:
+..\..\..\..\..\include\vmutex.h:
+..\..\..\..\..\include\win32type.h: \
+       ..\..\..\..\..\include\odin.h
+..\..\..\..\..\include\win32util.h:
+..\..\..\..\..\include\win32wnd.h:
+..\..\..\..\..\include\winaccel.h:
+..\..\..\..\..\include\winconst.h:
+..\..\..\..\..\include\wincursor.h:
+..\..\..\..\..\include\windllbase.h: \
+       ..\..\..\..\..\include\winimagebase.h \
+       ..\..\..\..\..\include\odinlx.h
+..\..\..\..\..\include\windlllx.h: \
+       ..\..\..\..\..\include\windllbase.h \
+       ..\..\..\..\..\include\winimagelx.h
+..\..\..\..\..\include\windllpe2lx.h: \
+       ..\..\..\..\..\include\windllbase.h \
+       ..\..\..\..\..\include\winimagepe2lx.h
+..\..\..\..\..\include\windllpeldr.h: \
+       ..\..\..\..\..\include\windllbase.h \
+       ..\..\..\..\..\include\winimagepeldr.h
+..\..\..\..\..\include\wineuni.h:
+..\..\..\..\..\include\winexebase.h: \
+       ..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\include\winexelx.h: \
+       ..\..\..\..\..\include\winexebase.h \
+       ..\..\..\..\..\include\winimagelx.h \
+       ..\..\..\..\..\include\odinlx.h
+..\..\..\..\..\include\winexepe2lx.h: \
+       ..\..\..\..\..\include\winexebase.h \
+       ..\..\..\..\..\include\winimagepe2lx.h
+..\..\..\..\..\include\winexepeldr.h: \
+       ..\..\..\..\..\include\winexebase.h \
+       ..\..\..\..\..\include\winimagepeldr.h
+..\..\..\..\..\include\winfakepeldr.h: \
+       ..\..\..\..\..\include\winimagepeldr.h
+..\..\..\..\..\include\winicon.h:
+..\..\..\..\..\include\winimagebase.h: \
+       ..\..\..\..\..\include\win\peexe.h
+..\..\..\..\..\include\winimagelx.h: \
+       ..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\include\winimagepe2lx.h: \
+       ..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\include\winimagepeldr.h: \
+       ..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\include\winkeyboard.h:
+..\..\..\..\..\include\winmenu.h:
+..\..\..\..\..\include\winos2def.h:
+..\..\..\..\..\include\winres.h:
+..\..\..\..\..\include\wprocess.h: \
+       ..\..\..\..\..\include\win\winprocess.h \
+       ..\..\..\..\..\include\winconst.h \
+       ..\..\..\..\..\include\win\thread.h
+..\incsrc\ncc.h:
+..\incsrc\sst.h: \
+       ..\incsrc\ncc.h \
+       ..\..\swlibs\fxmisc\fx64.h
+..\..\swlibs\fxmisc\3dfx.h:
+..\..\swlibs\fxmisc\fx64.h: \
+       ..\..\swlibs\fxmisc\3dfx.h
+..\..\swlibs\fxmisc\fxdll.h:
+..\..\swlibs\fxmisc\fxglob.h:
+..\..\swlibs\fxmisc\fximg.h:
+..\..\swlibs\fxmisc\fxmemmap.h:
+..\..\swlibs\fxmisc\fxos.h: \
+       k:\ibmcpp\INCLUDE\stdio.h
+..\..\swlibs\fxmisc\fxver.h:
+..\..\swlibs\fxmisc\linutil.h:
+..\..\swlibs\fxmisc\tsc.h:
+..\init\initvg\gdebug.h: \
+       k:\ibmcpp\INCLUDE\stdarg.h \
+       ..\..\swlibs\fxmisc\3dfx.h
+..\init\initvg\rcver.h:
+..\init\initvg\sst1init.h: \
+       ..\init\sst1vid.h \
+       ..\..\swlibs\pcilib\fxpci.h \
+       k:\ibmcpp\INCLUDE\stdio.h
+..\init\fxinit.h: \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\init\init.h \
+       ..\..\swlibs\fxmisc\fxdll.h
+..\init\init.h: \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\init\sst1vid.h \
+       ..\init\initvg\sst1init.h
+..\init\sst1vid.h:
+..\texus\texus.h: \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\stdio.h
+..\texus\texusint.h: \
+       ..\texus\texus.h
+..\..\swlibs\pcilib\fxlinux.h:
+..\..\swlibs\pcilib\fxos2.h:
+..\..\swlibs\pcilib\fxpci.h:
+..\..\swlibs\pcilib\fxphrlap.h:
+..\..\swlibs\pcilib\fxw32.h: \
+       ..\..\..\..\..\include\win\windows.h \
+       ..\..\swlibs\pcilib\pcilib.h
+..\..\swlibs\pcilib\pcilib.h:
+..\..\swlibs\pcilib\sst1_pci.h: \
+       ..\..\swlibs\pcilib\fxpci.h
Index: trunk/src/opengl/glide/sst1/glide/banner.inc
===================================================================
--- trunk/src/opengl/glide/sst1/glide/banner.inc	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/banner.inc	(revision 2885)
@@ -0,0 +1,122 @@
+/*
+ * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ * FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ *
+ * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ * TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ * THE UNITED STATES.  
+ *
+ * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+ */	
+
+
+static int banner_width  = 180;
+static int banner_height =  90;
+static unsigned short banner_data[] = {
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x10a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x18e3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x52aa, 0xad34, 0x10a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2922, 0xacee, 0x39a5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x93ea, 0xd5d0, 0x944d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9383, 0xd506, 0x8beb, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xbc63, 0xd506, 0xd58d, 0x7b6a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a82, 0xd4e4, 0xd504, 0xc54d, 0x2943, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5202, 0xd4e3, 0xd4e3, 0xd505, 0xcd6d, 0x5aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3961, 0xc483, 0xd503, 0xd504, 0xd569, 0x8baa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5268, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9364, 0xd4e2, 0xd4e2, 0xd4e2, 0xd505, 0xc54e, 0x4206, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa3e3, 0xd504, 0xd546, 0xd504, 0xd525, 0xc54d, 0x2103, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x20e1, 0x93a4, 0xcd4c, 0x20e2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xbc86, 0xd504, 0xd547, 0xd548, 0xd504, 0xd526, 0xbd2f, 0x2944, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7ae3, 0xd504, 0xd56a, 0xd634, 0xd569, 0xd525, 0xdd69, 0x8369, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x49c3, 0xb487, 0xd504, 0xd528, 0x5246, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2901, 0x6ac4, 0x1081, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x528a, 0x39e7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a22, 0xd526, 0xd548, 0xd5cf, 0xd613, 0xd527, 0xd505, 0xd548, 0xacae, 0x10a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x49a1, 0xcce5, 0xd56a, 0xde12, 0xde98, 0xddce, 0xd548, 0xdd04, 0xc52e, 0x18e3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x72c5, 0xcce7, 0xd504, 0xd503, 0xd527, 0x7b48, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x49e2, 0x9b83, 0xc4a4, 0xac23, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5247, 0xc570, 0x736a, 0x10a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9363, 0xd505, 0xd58c, 0xd634, 0xd678, 0xd5f1, 0xd548, 0xd504, 0xd58b, 0x942c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x18a1, 0xb444, 0xdd48, 0xddf0, 0xde98, 0xdeb9, 0xde55, 0xdd6b, 0xdd03, 0xdd8b, 0x7349, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2902, 0x9be6, 0xd527, 0xd524, 0xd524, 0xdd03, 0xd526, 0x9c09, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x20e1, 0x72c4, 0xac25, 0xd4e3, 0xd4e3, 0xd4e3, 0x8345, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xbc85, 0xd5cf, 0xacef, 0x4227, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xbc85, 0xd526, 0xd5f1, 0xd698, 0xd6ba, 0xd699, 0xd5cf, 0xd547, 0xd525, 0xd5ae, 0x7b6a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8b43, 0xdd04, 0xddae, 0xde76, 0xdeda, 0xdeda, 0xdeba, 0xddcf, 0xdd25, 0xdd47, 0xbd0c, 0x1081, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a04, 0xbc86, 0xdd24, 0xdd26, 0xddcf, 0xddcf, 0xdd25, 0xdd26, 0xb4ca, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x41a3, 0x8b64, 0xc4a6, 0xd503, 0xd4e3, 0xd4e3, 0xd4e3, 0xd507, 0x49e4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9362, 0xd4e3, 0xd56b, 0xcdb2, 0x83cc, 0x10a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a22, 0xd525, 0xd548, 0xd613, 0xd6b9, 0xd6ba, 0xd6ba, 0xd677, 0xddae, 0xd527, 0xdd25, 0xd58d, 0x62c8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a22, 0xd505, 0xdd68, 0xde34, 0xdeda, 0xdedb, 0xdedb, 0xdeda, 0xde33, 0xdd8a, 0xdd25, 0xdd8c, 0x6b09, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x72e5, 0xcd06, 0xdd24, 0xdd68, 0xde33, 0xdeb9, 0xde34, 0xdd46, 0xdd25, 0xcd49, 0x20c2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x18c1, 0x6aa4, 0xa404, 0xd4e4, 0xd504, 0xd549, 0xd5ae, 0xd5ad, 0xd548, 0xd505, 0xbc86, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a21, 0xd4e2, 0xd4e3, 0xd506, 0xd58c, 0xb531, 0x5248, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9363, 0xd504, 0xd5ad, 0xd655, 0xdeba, 0xdeba, 0xdeba, 0xdeba, 0xde76, 0xddae, 0xdd04, 0xdd47, 0xc54d, 0x4a06, 0x0000, 0x0000, 0x0000, 0x2921, 0xbc84, 0xdd46, 0xde11, 0xde98, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xdeb8, 0xddf0, 0xdd46, 0xdd47, 0xbcec, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2922, 0x9c07, 0xdd26, 0xdd26, 0xdd8a, 0xde55, 0xdeb9, 0xdedb, 0xde55, 0xdd8b, 0xdd25, 0xdd47, 0x5246, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3983, 0x8b65, 0xbcc8, 0xd526, 0xd526, 0xd56a, 0xd612, 0xd676, 0xd698, 0xd5f2, 0xd525, 0xd506, 0x93c7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x18a1, 0xc462, 0xd4e3, 0xd503, 0xd504, 0xd527, 0xcdd1, 0x8c0d, 0x18e3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xbc86, 0xd505, 0xd5f1, 0xde98, 0xd6ba, 0xdeda, 0xdedb, 0xdedb, 0xdeba, 0xde55, 0xdd8c, 0xdd25, 0xdd26, 0xbd2e, 0x2943, 0x0000, 0x0000, 0x9b83, 0xdd26, 0xddcd, 0xde77, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xde33, 0xdd89, 0xdd25, 0xddad, 0x6ae9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5204, 0xbca8, 0xdd46, 0xdd48, 0xddcf, 0xdeb8, 0xdeda, 0xdedb, 0xdedb, 0xde97, 0xddee, 0xdd25, 0xdd46, 0x7b68, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a44, 0xa3e6, 0xcce5, 0xd504, 0xd547, 0xd58c, 0xd633, 0xd698, 0xd6ba, 0xd6ba, 0xd678, 0xd5d0, 0xd504, 0xd527, 0x6286, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9b82, 0xd548, 0xd58b, 0xd549, 0xd4e3, 0xd505, 0xd58c, 0xbd51, 0x5aa9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a24, 0xd526, 0xd526, 0xde35, 0xdeba, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xdeb9, 0xde34, 0xdd6a, 0xdd25, 0xdd26, 0xacac, 0x1081, 0x6aa3, 0xd504, 0xdd48, 0xde76, 0xdeda, 0xdedb, 0xdedb, 0xdefb, 0xdedb, 0xdedb, 0xdeda, 0xde97, 0xddcf, 0xdd25, 0xdd47, 0xb4ee, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7b25, 0xd507, 0xdd24, 0xdd8a, 0xde32, 0xdeb9, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xde97, 0xddef, 0xdd46, 0xdd46, 0x9c2b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2922, 0x7b26, 0xbc86, 0xd525, 0xdd04, 0xd546, 0xddd0, 0xde55, 0xd699, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd634, 0xd58c, 0xd504, 0xc4e9, 0x20c2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a62, 0xd527, 0xd5d0, 0xd656, 0xd5ad, 0xd527, 0xd505, 0xd527, 0xd5b0, 0x944d, 0x2924, 0x0000, 0x0000, 0x0000, 0x0000, 0x9384, 0xd525, 0xd58a, 0xde56, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xdeb9, 0xde55, 0xdd48, 0xdd24, 0xdd24, 0xa3c3, 0xc4a4, 0xdd48, 0xde10, 0xdeb9, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdefb, 0xdedb, 0xde54, 0xdd68, 0xdd26, 0xdd8a, 0x5a87, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2922, 0xa407, 0xdd26, 0xdd45, 0xddab, 0xde55, 0xdeda, 0xdedb, 0xdefb, 0xdedb, 0xdefb, 0xdedb, 0xdeb8, 0xde32, 0xdd46, 0xdd25, 0xb4cb, 0x0000, 0x0000, 0x0000, 0x5224, 0x9be7, 0xcce7, 0xdd04, 0xdd47, 0xdd8b, 0xde11, 0xde97, 0xdeba, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdeba, 0xd6b9, 0xd612, 0xd569, 0xd504, 0xa3e5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x20e1, 0xc4c5, 0xd5af, 0xd698, 0xd698, 0xd634, 0xd58c, 0xd525, 0xd526, 0xd56a, 0xbd70, 0x62e9, 0x0000, 0x0000, 0x0000, 0xbc85, 0xd526, 0xddf0, 0xde98, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeb9, 0xde32, 0xdd48, 0xdd25, 0xdd24, 0xdd46, 0xddcd, 0xdeb8, 0xdeda, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xde97, 0xddee, 0xdd46, 0xdd46, 0xacad, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5224, 0xc4e9, 0xdd25, 0xdd47, 0xde10, 0xde97, 0xdeda, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdeda, 0xde75, 0xdd68, 0xdd25, 0xcd29, 0x3142, 0x7306, 0xb467, 0xd527, 0xdd25, 0xdd48, 0xddce, 0xde54, 0xde98, 0xdeba, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeba, 0xde98, 0xd5d0, 0xd546, 0xd526, 0x7305, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x18c2, 0x39a5, 0x10a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa3e4, 0xd56b, 0xd655, 0xd6ba, 0xd6ba, 0xd698, 0xd5f1, 0xd549, 0xd504, 0xd525, 0xd5ad, 0x9c6d, 0x3163, 0x5a23, 0xd525, 0xdd47, 0xde55, 0xdeb9, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xdeb9, 0xde32, 0xddce, 0xddcd, 0xde11, 0xde97, 0xdeda, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xded9, 0xde54, 0xdd47, 0xdd46, 0xddcd, 0x5246, 0x0000, 0x0000, 0x0000, 0x0000, 0x8347, 0xd527, 0xdd46, 0xdd8a, 0xde32, 0xded9, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdeda, 0xde97, 0xddab, 0xdd46, 0xdd24, 0xcd06, 0xdd46, 0xdd46, 0xdd8b, 0xddcd, 0xde76, 0xdeb9, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeba, 0xd654, 0xd58b, 0xd525, 0xcd4a, 0x3163, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3143, 0x5a65, 0x7b27, 0x9bc7, 0xac46, 0xc4a5, 0x93e8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x72a2, 0xd548, 0xd5f1, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6b9, 0xd656, 0xd5ae, 0xd525, 0xd504, 0xdd47, 0xc4c6, 0xb444, 0xdd26, 0xdd8a, 0xde97, 0xdeba, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefa, 0xde97, 0xddab, 0xdd46, 0xdd67, 0xa48d, 0x0000, 0x0000, 0x3163, 0xac27, 0xdd68, 0xdd45, 0xddcd, 0xde75, 0xdeda, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdeda, 0xde97, 0xddcd, 0xdd47, 0xdd24, 0xdd67, 0xddac, 0xde12, 0xde76, 0xdeda, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeba, 0xde12, 0xd569, 0xd526, 0xb468, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2103, 0x4a26, 0x7307, 0x93a6, 0xa426, 0xbca7, 0xd506, 0xd4e3, 0xd4e2, 0xd4e2, 0xd4e3, 0xb445, 0x18a1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3141, 0xcce5, 0xd5ad, 0xd6b9, 0xd6ba, 0xd6ba, 0xd6ba, 0xdeba, 0xde99, 0xd654, 0xd56a, 0xd525, 0xdd03, 0xdd03, 0xdd48, 0xddef, 0xdeb8, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xded9, 0xde52, 0xdd68, 0xdd45, 0xd5af, 0x4a05, 0x5a65, 0xc4e7, 0xdd46, 0xdd68, 0xddef, 0xde96, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdeda, 0xde76, 0xddef, 0xde31, 0xdeb8, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeba, 0xddce, 0xdd25, 0xd547, 0x8366, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x39a4, 0x62c7, 0x8388, 0x9c29, 0xb487, 0xccc5, 0xd507, 0xd504, 0xd504, 0xd505, 0xd527, 0xd528, 0xd548, 0xd505, 0xd4e2, 0xc4c6, 0x4182, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xabe2, 0xd56b, 0xd678, 0xd6ba, 0xdeba, 0xd6ba, 0xdeda, 0xdeda, 0xdeba, 0xde98, 0xd5f0, 0xddad, 0xdd8c, 0xddcf, 0xde97, 0xdeba, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xded9, 0xddab, 0xdd45, 0xdd68, 0xc4a7, 0xd548, 0xdd46, 0xdd89, 0xde32, 0xe6d9, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdeda, 0xdeda, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xde98, 0xdd8c, 0xdd04, 0xd56b, 0x4a04, 0x0000, 0x2944, 0x5a87, 0x7b48, 0x93e7, 0xac68, 0xc4ea, 0xd56a, 0xd527, 0xd525, 0xd505, 0xd526, 0xd549, 0xd58c, 0xd5d0, 0xd5f3, 0xd635, 0xd656, 0xd655, 0xd58c, 0xd506, 0xccc4, 0x6264, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7ae2, 0xd549, 0xd634, 0xd6b9, 0xdeba, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xdeda, 0xdeda, 0xdeb9, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe6fa, 0xde31, 0xdd89, 0xe546, 0xdd45, 0xe567, 0xddaa, 0xe696, 0xe6fa, 0xe71b, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xdeba, 0xde54, 0xdd6b, 0xdd03, 0xcd08, 0xa448, 0xbcc9, 0xd528, 0xd526, 0xd525, 0xd505, 0xd505, 0xd526, 0xd528, 0xd56a, 0xd5ce, 0xd633, 0xd677, 0xd699, 0xd699, 0xd6ba, 0xd6ba, 0xd6ba, 0xd677, 0xd5cf, 0xd506, 0xd505, 0x8345, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a48, 0xa48c, 0x940a, 0x734a, 0x4207, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3961, 0xd506, 0xd5cf, 0xde98, 0xdeba, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xad75, 0x39e7, 0x39e7, 0x39e7, 0x39e7, 0x8430, 0x94b2, 0xb5b6, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71b, 0xe6d9, 0xe653, 0xe5ed, 0xe5cc, 0xe631, 0xe6b8, 0xe6fb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdeda, 0xdeb9, 0xde10, 0xdd49, 0xdd03, 0xdd03, 0xdd04, 0xdd27, 0xd547, 0xd569, 0xd5ae, 0xddf1, 0xd634, 0xd676, 0xd698, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd678, 0xd5f1, 0xd506, 0xd504, 0xa427, 0x1081, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a43, 0xc4a5, 0xd505, 0xd56c, 0xbd2d, 0xa4ae, 0x83cc, 0x5ac8, 0x2124, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xb446, 0xddab, 0xde97, 0xdeba, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0x8430, 0x39e7, 0x39e7, 0x39e7, 0x39e7, 0x4208, 0x39e7, 0x4208, 0x738e, 0xa534, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71b, 0xe71b, 0xe71b, 0xe71b, 0xe71b, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdeda, 0xde75, 0xddce, 0xddcd, 0xde11, 0xde54, 0xde55, 0xde77, 0xdeba, 0xdeba, 0xdeba, 0xdeba, 0xdeba, 0xdeba, 0xdeba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd699, 0xd5f2, 0xd547, 0xd504, 0xbc85, 0x2922, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a21, 0xc482, 0xd4e3, 0xd504, 0xd505, 0xd527, 0xd56b, 0xcd90, 0xb4cd, 0x942c, 0x734b, 0x39c6, 0x0000, 0x0000, 0x0000, 0x0000, 0x8323, 0xdd47, 0xde54, 0xdeb9, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0x5aeb, 0x39e7, 0x39e7, 0x39e7, 0x4208, 0x39e7, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0xb5b6, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdeda, 0xdeda, 0xdeba, 0xdeda, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd613, 0xd56a, 0xd505, 0xcd08, 0x5204, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a21, 0xc4a3, 0xd526, 0xd569, 0xd526, 0xd505, 0xd505, 0xd504, 0xd525, 0xd548, 0xd5ae, 0xbd4e, 0xa48e, 0x838a, 0x5a45, 0x51e2, 0xd506, 0xddf0, 0xde97, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xb5b6, 0x39e7, 0x39e7, 0x39e7, 0x39e7, 0x4208, 0x39e7, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0xad55, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe71c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xd6ba, 0xd6ba, 0xd6ba, 0xd6ba, 0xd655, 0xd58d, 0xd503, 0xd549, 0x72e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a21, 0xc4c6, 0xd5ae, 0xd677, 0xd655, 0xd612, 0xd5cf, 0xd56a, 0xd525, 0xd503, 0xd503, 0xd504, 0xd526, 0xd547, 0xccc4, 0xd505, 0xddce, 0xde77, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xd6ba, 0x738e, 0x39e7, 0x39e7, 0x39e7, 0x39e7, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0xbdd7, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xd6ba, 0xdedb, 0xd6ba, 0xd677, 0xd58c, 0xd526, 0xd505, 0x93c8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a21, 0xccc6, 0xd5cd, 0xd677, 0xd699, 0xd6ba, 0xd6b9, 0xd699, 0xde77, 0xd611, 0xd58b, 0xdd47, 0xdd26, 0xdd26, 0xdd69, 0xde33, 0xdeb8, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xd69a, 0x39e7, 0x39e7, 0x39e7, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4228, 0xc638, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xa514, 0xbdd7, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xd6ba, 0xd6ba, 0xd698, 0xd5ad, 0xd526, 0xd505, 0xb48a, 0x18c2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a22, 0xccc6, 0xd5f1, 0xd677, 0xd6ba, 0xdeba, 0xd6ba, 0xdeba, 0xdeba, 0xdeb9, 0xde98, 0xde55, 0xde76, 0xde97, 0xdeb9, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xd6ba, 0x8430, 0x39e7, 0x39e7, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4228, 0x4228, 0xad55, 0xe71c, 0xe71c, 0xe71c, 0xad75, 0x4228, 0x4a49, 0x7bcf, 0xad75, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeba, 0xde98, 0xd611, 0xd527, 0xd504, 0xc52b, 0x39a3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a22, 0xccc5, 0xd5f1, 0xd698, 0xd6ba, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0x8430, 0x39e7, 0x39e7, 0x39e7, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4228, 0x4228, 0x4228, 0x7bcf, 0xe71c, 0xe71c, 0xe71c, 0x7bcf, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x8c71, 0xbdf7, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xad75, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xde98, 0xde33, 0xd547, 0xd525, 0xcd28, 0x6286, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a22, 0xcce7, 0xd5f1, 0xde98, 0xdeba, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xc638, 0xb5b6, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xb5b6, 0x9cd3, 0x4208, 0x4208, 0x4208, 0x4208, 0x4228, 0x4228, 0x4228, 0x52aa, 0xce59, 0xe71c, 0xce59, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a69, 0x4a69, 0xa514, 0xce79, 0xe73c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0x9cf3, 0x4a49, 0x4a49, 0x9cf3, 0xbdf7, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeba, 0xde34, 0xdd69, 0xdd25, 0xd569, 0x8389, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a22, 0xcce6, 0xd5f0, 0xdeb9, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xc638, 0x4208, 0x4208, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0xbdf7, 0xe73c, 0x8c71, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x7bef, 0xb596, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xce79, 0x4a69, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0xad55, 0x9cf3, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xde55, 0xddad, 0xdd04, 0xdd26, 0xb4cb, 0x3185, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a22, 0xcd09, 0xde11, 0xdeb9, 0xdeba, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xbdd7, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x9cf3, 0xce59, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x528a, 0x528a, 0x528a, 0xb5b6, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0x7bef, 0x4a69, 0x4a69, 0x632c, 0x4a49, 0x4a49, 0x528a, 0x4a49, 0x630c, 0x4228, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xdeb9, 0xddf0, 0xdd47, 0xdd04, 0xdd26, 0xd58b, 0xd5d0, 0xc56f, 0xbcee, 0xa46c, 0x940b, 0x838a, 0x6b09, 0x5247, 0x2123, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7b03, 0xdd47, 0xde32, 0xdeb9, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xbdd7, 0xbdd7, 0xbdd7, 0x9cd3, 0x4208, 0x4208, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x8c71, 0x9cf3, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x528a, 0x528a, 0x528a, 0x528a, 0x528a, 0x528a, 0x52aa, 0x52aa, 0xc638, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0x4a69, 0x7bef, 0x4a69, 0x632c, 0x4a69, 0x630c, 0x4a49, 0x7bcf, 0x4a49, 0x8c71, 0x630c, 0x4228, 0xe71c, 0xd6ba, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdeba, 0xde75, 0xddef, 0xdd69, 0xdd26, 0xdd26, 0xdd26, 0xdd05, 0xd505, 0xd525, 0xd526, 0xd526, 0xd548, 0xd549, 0xd56c, 0xc4e8, 0xb4a9, 0xa44a, 0x93eb, 0x7b6a, 0x62c8, 0x41e5, 0x18c2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5204, 0x8b86, 0xbc86, 0xd505, 0xdd26, 0xddce, 0xdeb9, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0x9492, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x4a49, 0x7bcf, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x528a, 0x528a, 0x528a, 0x528a, 0x528a, 0x528a, 0x52aa, 0x52aa, 0x52aa, 0x52aa, 0xbdd7, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef5d, 0x9492, 0xb596, 0xc618, 0x7bef, 0x4a69, 0x7bef, 0x4a49, 0x8c71, 0x4a49, 0x4a49, 0xad75, 0x4a49, 0x7bcf, 0x9cf3, 0x4228, 0x8c51, 0xce59, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xdeb9, 0xde76, 0xde54, 0xde33, 0xd611, 0xd5d0, 0xd5ae, 0xd58d, 0xd56b, 0xd549, 0xd527, 0xd525, 0xd504, 0xd4e3, 0xd4e3, 0xd504, 0xd504, 0xd506, 0xbc65, 0x4a25, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a44, 0x9385, 0xbc65, 0xd527, 0xdd26, 0xdd46, 0xddad, 0xde55, 0xdeb9, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0x630c, 0x4208, 0x4208, 0x4208, 0x4208, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x528a, 0x528a, 0x528a, 0x528a, 0x52aa, 0x52aa, 0x52aa, 0x52aa, 0x52aa, 0x52aa, 0x52aa, 0x5acb, 0xad55, 0xef7d, 0xef7d, 0xf79e, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xc638, 0xd69a, 0xef5d, 0xef5d, 0xc618, 0xc618, 0x4a69, 0x9492, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0xce79, 0x9cf3, 0x4228, 0x4228, 0x630c, 0x4228, 0x9cd3, 0xbdd7, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xdeda, 0xdeba, 0xdeba, 0xd6ba, 0xd6b9, 0xd699, 0xd698, 0xd678, 0xd677, 0xd656, 0xd5f2, 0xd548, 0xd504, 0xd4c2, 0x9bc4, 0x3121, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a44, 0x93a6, 0xbca6, 0xd525, 0xd526, 0xdd47, 0xdd8c, 0xde11, 0xde76, 0xdeb9, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xad55, 0x4208, 0x4208, 0x4208, 0x4208, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x4228, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x528a, 0x528a, 0x528a, 0x528a, 0x52aa, 0x52aa, 0x52aa, 0x52aa, 0x5acb, 0x5acb, 0x5acb, 0x5acb, 0x5acb, 0x5acb, 0xce59, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xc638, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xd69a, 0xce59, 0xef5d, 0x9492, 0x8c71, 0x4a49, 0x4a49, 0xbdf7, 0xbdf7, 0x4228, 0x4228, 0x4228, 0x73ae, 0x4228, 0x4208, 0x73ae, 0xbdd7, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeba, 0xd6ba, 0xd6ba, 0xd698, 0xd634, 0xd56a, 0xd505, 0xbc85, 0x6262, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x18c1, 0x5a65, 0x93a4, 0xc4a5, 0xd525, 0xd505, 0xd548, 0xd5ad, 0xd633, 0xde77, 0xdeb9, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0x8c51, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x39e7, 0x2165, 0x2185, 0x2186, 0x21c6, 0x2a07, 0x3228, 0x4228, 0x4a49, 0x4a49, 0x4a49, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x528a, 0x528a, 0x94b2, 0x8410, 0x52aa, 0x52aa, 0x52aa, 0x5acb, 0x5acb, 0x5acb, 0x5acb, 0x5acb, 0x5acb, 0x5aeb, 0x5aeb, 0x5aeb, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xbdd7, 0x52aa, 0x52aa, 0xa534, 0xd69a, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xc618, 0x8c71, 0x7bcf, 0x4a49, 0x4228, 0x4228, 0x8c71, 0xe73c, 0x4228, 0x630c, 0x4208, 0x8c51, 0x8c51, 0xad55, 0xe71c, 0xc638, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xd6ba, 0xdeba, 0xd656, 0xd5ce, 0xd527, 0xd4e5, 0x9ba3, 0x2901, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x18c1, 0x6264, 0x9bc5, 0xc4a5, 0xd505, 0xd525, 0xd549, 0xd5ae, 0xd634, 0xde98, 0xdeba, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0x8c51, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x1904, 0x08e3, 0x0903, 0x0944, 0x0985, 0x09c6, 0x09e6, 0x09e6, 0x21e7, 0x3a08, 0x4a49, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x528a, 0x8410, 0xef7d, 0xef7d, 0xd6ba, 0xad55, 0x8430, 0x5acb, 0x5acb, 0x5acb, 0x5aeb, 0x5aeb, 0x5aeb, 0x5aeb, 0x630c, 0x5aeb, 0xbdf7, 0xf7be, 0xf7be, 0xf7be, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0x5acb, 0x52aa, 0x52aa, 0x52aa, 0x528a, 0xd69a, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0x8c71, 0xbdf7, 0x8430, 0x7bcf, 0x8c71, 0x4228, 0x73ae, 0x4228, 0x630c, 0x4208, 0x9cd3, 0x4208, 0x4208, 0xce79, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeba, 0xd698, 0xd612, 0xd56b, 0xd504, 0xbc85, 0x5a43, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x20e1, 0x6a83, 0x9bc4, 0xc4c6, 0xd505, 0xd526, 0xd569, 0xd5cf, 0xd655, 0xd698, 0xd6b9, 0xdeba, 0xdeba, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0x8c51, 0x4208, 0x4208, 0x4208, 0x4208, 0x2986, 0x08c3, 0x08e3, 0x0903, 0x0924, 0x0965, 0x09c6, 0x09e7, 0x09e6, 0x09c6, 0x0985, 0x31c7, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x4228, 0xad75, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xbdf7, 0x8c51, 0x5aeb, 0x5aeb, 0x630c, 0x630c, 0x630c, 0x630c, 0x630c, 0x8c71, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xf79e, 0xad75, 0x5acb, 0x5acb, 0x4228, 0x3186, 0x39c7, 0xb596, 0xdefb, 0xef5d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xbdd7, 0x9492, 0x4228, 0x4228, 0x4228, 0x4228, 0x4208, 0x4208, 0x4208, 0x4208, 0x9cd3, 0xbdf7, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xdeb9, 0xde55, 0xd5ad, 0xdd27, 0xd506, 0x93a5, 0x20e1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3143, 0x9bc5, 0xc4c5, 0xd4e3, 0xd4e3, 0xd505, 0xd58c, 0xd633, 0xd698, 0xd6b9, 0xd6ba, 0xd6ba, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xb5b6, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xad55, 0x4208, 0x4208, 0x4208, 0x4208, 0x08e3, 0x08c3, 0x08c3, 0x0903, 0x0924, 0x0965, 0x09a6, 0x09e6, 0x09e7, 0x09c6, 0x0985, 0x0924, 0x4228, 0x4a69, 0x528a, 0x39e7, 0x08c2, 0x2165, 0x632c, 0x8c92, 0xb5b6, 0xd69a, 0xef7d, 0xf7be, 0xf7be, 0x9cf3, 0x630c, 0x630c, 0x630c, 0x632c, 0x632c, 0x632c, 0x632c, 0xdefb, 0xffdf, 0xffdf, 0xffdf, 0xf7be, 0xf7be, 0xdedb, 0x5aeb, 0x5acb, 0x52aa, 0x18e3, 0x0861, 0x0861, 0x4208, 0x73ae, 0x4208, 0x9cd3, 0x9492, 0xd69a, 0xdefb, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0x7bcf, 0x9cf3, 0x8c71, 0x4228, 0x4208, 0x4208, 0x4208, 0x4208, 0x9cd3, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdeba, 0xde97, 0xde11, 0xdd47, 0xd526, 0xbc86, 0x6244, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3121, 0x6a82, 0x9b82, 0xbc63, 0xd505, 0xd58b, 0xd612, 0xd677, 0xd6b9, 0xd6ba, 0xdeba, 0xdeda, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0x738e, 0x39e7, 0xc638, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0x9cf3, 0x4208, 0x4228, 0x4228, 0x1924, 0x08c3, 0x08e3, 0x0965, 0x0985, 0x09a6, 0x09e7, 0x0a28, 0x0a28, 0x09e7, 0x09a6, 0x0945, 0x31c6, 0x528a, 0x4a49, 0x0903, 0x08c2, 0x08c2, 0x08c2, 0x0903, 0x0965, 0x0965, 0x3a69, 0x73cf, 0x9d34, 0xce79, 0x9cf3, 0x632c, 0x632c, 0x6b4d, 0x6b4d, 0x6b4d, 0x6b4d, 0xb5b6, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xa514, 0x5aeb, 0x5aeb, 0x39c7, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x10a2, 0x0861, 0x0861, 0x632c, 0x4228, 0xce59, 0x7bcf, 0xa534, 0xdefb, 0xdedb, 0xe73c, 0xe73c, 0xce79, 0x4228, 0xe73c, 0xce59, 0xbdf7, 0x8c51, 0x4208, 0x4208, 0xbdd7, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdeb8, 0xde54, 0xdd8c, 0xdd25, 0xd505, 0x93a5, 0x20e1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4181, 0x7ae3, 0xa3e5, 0xc4a5, 0xd548, 0xd5cf, 0xde55, 0xde77, 0xdeb9, 0xdeba, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xbdd7, 0x39e7, 0x39e7, 0x39e7, 0x8430, 0xce59, 0xe73c, 0xe71c, 0xe73c, 0xad75, 0x4208, 0x4208, 0x4208, 0x2985, 0x08e3, 0x0985, 0x09c6, 0x0a27, 0x0a28, 0x09e7, 0x0a07, 0x0a68, 0x0aa9, 0x0a69, 0x09c6, 0x2165, 0x4a69, 0x2185, 0x08e3, 0x08c2, 0x08c2, 0x08a2, 0x0903, 0x0944, 0x0965, 0x0965, 0x0965, 0x0985, 0x0985, 0x2a28, 0x3a28, 0x52cb, 0x6b4d, 0x6b4d, 0x6b6d, 0x6b6d, 0xad55, 0xffff, 0xffff, 0xffdf, 0xffdf, 0xe71c, 0x630c, 0x630c, 0x52aa, 0x2104, 0x3186, 0x0861, 0x0861, 0x31a6, 0x0861, 0x6b4d, 0x0861, 0x39c7, 0x4a49, 0x6b4d, 0xad55, 0x0861, 0x0861, 0x4a69, 0x0861, 0x8c51, 0x7bcf, 0xbdd7, 0xc618, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xbdf7, 0xce59, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdeda, 0xde97, 0xddcf, 0xdd46, 0xdd26, 0xbc86, 0x5a43, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x18a1, 0x5202, 0x8b43, 0xac25, 0xcd07, 0xdd8c, 0xddf0, 0xde54, 0xde98, 0xdeda, 0xdeda, 0xdedb, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0x8430, 0x39e7, 0x39e7, 0x39e7, 0x4208, 0x4208, 0x4208, 0x8c51, 0x4208, 0x4208, 0x4208, 0x4228, 0x4228, 0x31c7, 0x0944, 0x09a6, 0x09a5, 0x09e7, 0x0a27, 0x0a68, 0x0a28, 0x0a07, 0x0a28, 0x0a89, 0x0a89, 0x09c6, 0x31e7, 0x0903, 0x08e3, 0x08c2, 0x08e3, 0x08c2, 0x08c3, 0x0944, 0x0965, 0x0965, 0x0965, 0x0985, 0x0985, 0x09a6, 0x0985, 0x0965, 0x3a28, 0x632c, 0x738e, 0x738e, 0x738e, 0xffff, 0xffff, 0xffff, 0xffff, 0x9492, 0x632c, 0x630c, 0x5acb, 0x39e7, 0x5acb, 0xc638, 0xc618, 0xbdd7, 0x39e7, 0x7bcf, 0x0861, 0x4208, 0x0861, 0x6b4d, 0x8c51, 0x0861, 0x2945, 0x2945, 0x8430, 0x10a2, 0x10a2, 0x10a2, 0x94b2, 0x738e, 0xdedb, 0xad75, 0xb5b6, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdeb9, 0xde32, 0xdd8a, 0xdd47, 0xd506, 0x8b86, 0x20c1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x20e1, 0x6262, 0x9384, 0xb465, 0xd548, 0xddce, 0xde33, 0xde76, 0xdeb9, 0xdeda, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0x39e7, 0x39e7, 0x39e7, 0x39e7, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4228, 0x4228, 0x4208, 0x31e7, 0x2186, 0x52ca, 0x634d, 0x1144, 0x09a6, 0x0a48, 0x0a89, 0x0a68, 0x0a48, 0x0a68, 0x0a48, 0x0965, 0x0924, 0x08e3, 0x0924, 0x0965, 0x0944, 0x0924, 0x0965, 0x09a6, 0x0985, 0x0965, 0x0965, 0x0985, 0x09a6, 0x0985, 0x0965, 0x0965, 0x1985, 0x632c, 0x73ae, 0x738e, 0xdedb, 0xffff, 0xffff, 0xb596, 0x6b4d, 0x632c, 0x4208, 0x2124, 0x31a6, 0x7bef, 0xe73c, 0xf7be, 0xef5d, 0xc618, 0x528a, 0x4228, 0x73ae, 0x7bcf, 0x8c71, 0x10a2, 0x4a49, 0x94b2, 0x3186, 0x7bcf, 0x2945, 0x4a49, 0x0861, 0x2104, 0x2945, 0x8c51, 0x0861, 0x39c7, 0xdefb, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdeda, 0xde76, 0xdd8a, 0xdd46, 0xdd25, 0xd56b, 0xac8d, 0x6b09, 0x10a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3961, 0x72c3, 0x9bc4, 0xcce6, 0xddab, 0xde33, 0xdeda, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0x8c51, 0x39e7, 0x39e7, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4228, 0x4228, 0x3186, 0x0903, 0x0924, 0x0903, 0x08e3, 0x0944, 0x0965, 0x0a68, 0x0aca, 0x0aca, 0x0aa9, 0x0a89, 0x09c6, 0x0924, 0x0903, 0x0985, 0x09c6, 0x09e7, 0x09e6, 0x09a6, 0x09c6, 0x0a27, 0x0a07, 0x09e7, 0x09e7, 0x09e6, 0x09a6, 0x0985, 0x0965, 0x0944, 0x2165, 0x6b6d, 0x7bcf, 0xffff, 0xffff, 0xffff, 0x6b6d, 0x6b4d, 0x5acb, 0x0861, 0x0861, 0x0861, 0x0861, 0xb596, 0xf7be, 0xf7be, 0xf7be, 0x7bef, 0x528a, 0x528a, 0x8410, 0xef7d, 0xdedb, 0xe73c, 0xdedb, 0x7bcf, 0x738e, 0x39c7, 0x2104, 0x0861, 0x10a2, 0x528a, 0x2104, 0x0861, 0x94b2, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdeda, 0xde75, 0xddcd, 0xdd47, 0xdd25, 0xdd47, 0xddce, 0xc56f, 0x8c2d, 0x4207, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4181, 0xbc85, 0xdd68, 0xde11, 0xdeda, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0x8c51, 0x39e7, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4228, 0x39e7, 0x08e3, 0x08e3, 0x0944, 0x0903, 0x08e3, 0x0924, 0x0965, 0x0a48, 0x0aa9, 0x0aea, 0x0b0b, 0x0aca, 0x09c6, 0x0924, 0x0985, 0x0944, 0x0965, 0x09e7, 0x09e7, 0x09e7, 0x09e7, 0x09e7, 0x09e7, 0x0a48, 0x0a89, 0x0aa9, 0x0a89, 0x0a28, 0x09c6, 0x0945, 0x0904, 0x5acb, 0x7bef, 0xc638, 0xe71c, 0xce79, 0x738e, 0x6b4d, 0x2945, 0x0861, 0x0861, 0x0861, 0x0861, 0xa514, 0xf7be, 0xf7be, 0xf7be, 0xbdd7, 0x528a, 0x528a, 0x528a, 0xd6ba, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xce59, 0x8c51, 0x94b2, 0xa534, 0xad75, 0x9cd3, 0x4a49, 0x39c7, 0xc638, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdeda, 0xde97, 0xddef, 0xdd69, 0xdd46, 0xdd25, 0xdd47, 0xd5af, 0xacce, 0x6b2a, 0x10a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x41a1, 0xc4a6, 0xdd47, 0xde11, 0xdeb8, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0x8c51, 0x39e7, 0x39e7, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4228, 0x4228, 0x4228, 0x31a6, 0x08c2, 0x08c2, 0x0924, 0x0904, 0x08e3, 0x0904, 0x09e6, 0x0a48, 0x0a89, 0x0aaa, 0x0aca, 0x0a89, 0x0924, 0x0985, 0x09e7, 0x0985, 0x0944, 0x0944, 0x0985, 0x638d, 0x4aeb, 0x09c6, 0x09c6, 0x09e7, 0x0a48, 0x0aa9, 0x0aca, 0x0aaa, 0x0a89, 0x0a28, 0x0965, 0x3a08, 0x8410, 0x7bef, 0x7bcf, 0x7bcf, 0x738e, 0x4a49, 0x0861, 0x0861, 0x0861, 0x0861, 0x4a49, 0xef5d, 0xffdf, 0xf7be, 0xf7be, 0xdefb, 0x52aa, 0x528a, 0x528a, 0xbdd7, 0xf79e, 0xef7d, 0xef7d, 0xd69a, 0xa514, 0x4208, 0x94b2, 0xd69a, 0xef5d, 0xef5d, 0xce79, 0xd69a, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdeda, 0xde98, 0xde54, 0xddce, 0xdd48, 0xdd25, 0xdd48, 0xdd8c, 0xc570, 0x942d, 0x4a27, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x49c2, 0xc4a5, 0xdd46, 0xddf0, 0xdeb7, 0xdeda, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0x8c51, 0x39e7, 0x39e7, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4208, 0x4228, 0x4228, 0x39e7, 0x08c2, 0x08c2, 0x0944, 0x0924, 0x0924, 0x0944, 0x0985, 0x09e7, 0x0a28, 0x0a68, 0x0a69, 0x09a5, 0x0944, 0x0985, 0x0985, 0x0985, 0x0965, 0x0965, 0x73cf, 0xffdf, 0xffdf, 0xa534, 0x52cb, 0x3a69, 0x19e7, 0x0a27, 0x0a69, 0x0aa9, 0x0a89, 0x0a89, 0x0a68, 0x1985, 0x7bef, 0x8410, 0x7bef, 0x7bcf, 0x632c, 0x1082, 0x0861, 0x0861, 0x0861, 0x0861, 0xc618, 0xffdf, 0xdedb, 0x9492, 0xb5b6, 0xd6ba, 0x94b2, 0x528a, 0x528a, 0x8410, 0xf79e, 0xc638, 0x9492, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4228, 0x5aeb, 0x8c71, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdeda, 0xde97, 0xddf0, 0xdd6a, 0xdd26, 0xdd26, 0xdd47, 0xd58d, 0xaccd, 0x732a, 0x18e3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x49e2, 0xc4c5, 0xdd46, 0xddef, 0xde98, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xad75, 0x8c51, 0x4208, 0x4208, 0x4208, 0x31a6, 0x31c7, 0x4208, 0x4208, 0x4228, 0x4228, 0x4228, 0x10e3, 0x0924, 0x0965, 0x0944, 0x0944, 0x0944, 0x0924, 0x0944, 0x0985, 0x09a6, 0x0944, 0x08e3, 0x09c6, 0x09a6, 0x0965, 0x0965, 0x0965, 0x21e7, 0xb5b6, 0xa514, 0x632c, 0x632c, 0x6b4d, 0x6b6d, 0x6b6d, 0x428a, 0x0a48, 0x0a89, 0x0a89, 0x0a68, 0x0a27, 0x09c6, 0x73ae, 0x8430, 0x7bef, 0x7bcf, 0x3186, 0x0861, 0x0861, 0x0861, 0x0861, 0x3186, 0xc618, 0xffff, 0xef7d, 0x2124, 0x0861, 0x0861, 0x4228, 0x4a69, 0x528a, 0x528a, 0x8410, 0x4a69, 0x4a69, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4a49, 0x4228, 0x4228, 0xb596, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xde98, 0xde34, 0xddcf, 0xdd47, 0xdd04, 0xd525, 0xd569, 0xc54e, 0x940b, 0x4a27, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5203, 0xccc5, 0xdd68, 0xde10, 0xdeb9, 0xdedb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xbdf7, 0x9cf3, 0x6b4d, 0x08e3, 0x08e3, 0x2165, 0x31c7, 0x39e7, 0x3a07, 0x7bef, 0x4249, 0x0985, 0x09c6, 0x09a6, 0x0965, 0x0985, 0x1185, 0x1965, 0x0903, 0x08e3, 0x08a2, 0x0924, 0x09c6, 0x09a6, 0x0985, 0x0985, 0x09a6, 0x3a49, 0x5aeb, 0x630c, 0x632c, 0x6b4d, 0x6b4d, 0x6b6d, 0x738e, 0x3208, 0x09e7, 0x0a89, 0x0a89, 0x0a48, 0x09c6, 0x0944, 0xad96, 0x9cd3, 0x8410, 0x52aa, 0x0861, 0x0861, 0x0861, 0x0861, 0x18c3, 0x5aeb, 0x630c, 0xffff, 0xffff, 0x9cd3, 0x0861, 0x0861, 0x0861, 0x39c7, 0x528a, 0x528a, 0x4a69, 0x4a69, 0x4a49, 0x39c7, 0x39e7, 0x4228, 0x4a49, 0x4228, 0x7bcf, 0xad55, 0xd69a, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdedb, 0xdedb, 0xdeda, 0xdeba, 0xde98, 0xde11, 0xdd6a, 0xd504, 0xd504, 0xd505, 0xd549, 0xb445, 0x7305, 0x2102, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a22, 0xcce6, 0xdd69, 0xde10, 0xded9, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0x634d, 0x08c2, 0x08e3, 0x0903, 0x0924, 0x0944, 0x0944, 0x0924, 0x08e3, 0x0944, 0x09a6, 0x09a6, 0x0985, 0x0965, 0x31c7, 0x29a6, 0x08e3, 0x08e3, 0x08c2, 0x0944, 0x0985, 0x0985, 0x0965, 0x0944, 0x21c6, 0x5acb, 0x5aeb, 0x630c, 0x632c, 0x6b4d, 0x6b4d, 0x6b6d, 0x4aaa, 0x0944, 0x0985, 0x0a69, 0x0a68, 0x0a28, 0x09a6, 0x0965, 0x3a69, 0x4228, 0x528a, 0x10a2, 0x0861, 0x0861, 0x0861, 0x0861, 0x4a69, 0x632c, 0x630c, 0xffff, 0xffff, 0xc638, 0x31a6, 0x0861, 0x0861, 0x10a2, 0x4a69, 0x4a69, 0x4208, 0x2965, 0x10a2, 0x0861, 0x0861, 0x1082, 0x39e7, 0x7bcf, 0xdefb, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdedb, 0xdeda, 0xdeda, 0xdeb9, 0xde97, 0xde54, 0xde12, 0xddcf, 0xdd6a, 0xdd25, 0xd504, 0xc4a4, 0xac04, 0x8b64, 0x6aa4, 0x2943, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a42, 0xccc5, 0xdd68, 0xde10, 0xdeb9, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xef5d, 0xe71c, 0x3a28, 0x08a2, 0x08e3, 0x08e3, 0x0924, 0x0944, 0x0965, 0x0944, 0x08e3, 0x08e3, 0x0965, 0x09a6, 0x09a6, 0x0985, 0x1185, 0x0924, 0x08e3, 0x08e3, 0x0924, 0x0924, 0x0944, 0x0965, 0x09a6, 0x11a6, 0x4a8a, 0x5aeb, 0x5aeb, 0x630c, 0x632c, 0x632c, 0x634d, 0x4289, 0x09a6, 0x0965, 0x0985, 0x0a89, 0x0a89, 0x0a27, 0x09c6, 0x0944, 0x0903, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x31a6, 0x9cf3, 0x630c, 0xa534, 0xb5b6, 0x5aeb, 0x5acb, 0x4228, 0x0861, 0x0861, 0x0861, 0x2945, 0x18e3, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0xb596, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdeda, 0xdeda, 0xdeb8, 0xde54, 0xddee, 0xdd69, 0xdd46, 0xdd26, 0xcce6, 0xb444, 0x9b83, 0x72c2, 0x49c2, 0x1081, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6242, 0xcce5, 0xdd68, 0xde32, 0xdeb9, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xef5d, 0xef5d, 0xef5d, 0x7bef, 0x08a2, 0x0924, 0x0903, 0x0924, 0x0944, 0x0944, 0x0944, 0x0903, 0x08e3, 0x0985, 0x09c6, 0x0985, 0x0965, 0x0965, 0x0924, 0x0903, 0x0924, 0x09a6, 0x09a6, 0x0965, 0x0944, 0x0965, 0x3a28, 0x5acb, 0x5aeb, 0x5aeb, 0x630c, 0x630c, 0x52aa, 0x2a28, 0x09a6, 0x09a6, 0x0985, 0x09c6, 0x0aa9, 0x0aa9, 0x0a68, 0x09e7, 0x0965, 0x08c3, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x39c7, 0x630c, 0x5aeb, 0x5aeb, 0x5acb, 0x528a, 0x18e3, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x4a49, 0x9492, 0xd6ba, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe6fb, 0xded9, 0xde96, 0xde53, 0xde10, 0xddac, 0xdd68, 0xdd45, 0xd505, 0xbc64, 0xa3c4, 0x8303, 0x5a22, 0x20c1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a62, 0xd4e6, 0xdd68, 0xde32, 0xdeb8, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xa555, 0x08a2, 0x0944, 0x0944, 0x0965, 0x0944, 0x0965, 0x0965, 0x0924, 0x0924, 0x0985, 0x0965, 0x0924, 0x0944, 0x0965, 0x0944, 0x0924, 0x0985, 0x09c6, 0x09c6, 0x09e7, 0x09a6, 0x0965, 0x21a6, 0x31e7, 0x3a28, 0x3269, 0x3248, 0x11a6, 0x0985, 0x09e6, 0x09a6, 0x0985, 0x09a6, 0x09e6, 0x0a48, 0x0a89, 0x0a68, 0x0a07, 0x3269, 0x7c10, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x5acb, 0x52aa, 0x4208, 0x2945, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x4a69, 0x94b2, 0xce59, 0xef7d, 0xf79e, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71b, 0xe6fb, 0xe6d9, 0xe674, 0xe630, 0xe5aa, 0xdd68, 0xdd47, 0xdd47, 0xccc6, 0xac25, 0x8b64, 0x6284, 0x3142, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6aa3, 0xd505, 0xdd48, 0xde54, 0xdeb9, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xce79, 0x0944, 0x0965, 0x0985, 0x0985, 0x0985, 0x0985, 0x09a6, 0x09a6, 0x0985, 0x0985, 0x0965, 0x0945, 0x0985, 0x0985, 0x0965, 0x09a6, 0x0a07, 0x0a07, 0x09e7, 0x09e7, 0x09e7, 0x0985, 0x0924, 0x0944, 0x0985, 0x0a07, 0x09e7, 0x0985, 0x0965, 0x09c6, 0x09c6, 0x0985, 0x0a27, 0x0a48, 0x0a28, 0x0a48, 0x0a48, 0x0a28, 0xa555, 0xb5b6, 0x0861, 0x0861, 0x0861, 0x0861, 0x2104, 0x2124, 0x0861, 0x0861, 0x2945, 0x4228, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x10a2, 0x3186, 0xb5b6, 0xf79e, 0xf7be, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71b, 0xe6f9, 0xe631, 0xe5cc, 0xe568, 0xe568, 0xd507, 0xb466, 0x93a5, 0x72a3, 0x4182, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x72c3, 0xd505, 0xdd69, 0xde33, 0xdeb9, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xb5b6, 0x52eb, 0x09a6, 0x0985, 0x0944, 0x0924, 0x0944, 0x0985, 0x0965, 0x0965, 0x0944, 0x636d, 0x532c, 0x0985, 0x09c6, 0x0a28, 0x0a27, 0x0a28, 0x0a07, 0x0a07, 0x09c6, 0x0965, 0x0944, 0x0944, 0x0965, 0x09e6, 0x0a07, 0x09a6, 0x0965, 0x09c6, 0x09e7, 0x09c6, 0x0a48, 0x0a89, 0x0aca, 0x0aa9, 0x0a69, 0x6c0f, 0xf7be, 0xc618, 0x0861, 0x0861, 0x0861, 0x1082, 0x5acb, 0x6b4d, 0x4228, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x18c3, 0x0861, 0x0861, 0x2104, 0x4a49, 0xad55, 0xf7be, 0xf7be, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71b, 0xe6d8, 0xe5ec, 0xe589, 0xe566, 0x9be6, 0x1081, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x72c3, 0xd4e4, 0xdd6a, 0xde32, 0xdeb9, 0xdeda, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xdefb, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef7d, 0xef7d, 0xe73c, 0xc659, 0x9d13, 0x73ef, 0x4aca, 0x4289, 0x428a, 0x5b4d, 0x8c92, 0xc638, 0xf79e, 0x9d14, 0x0985, 0x0a69, 0x0a89, 0x0a28, 0x0a07, 0x0a07, 0x0a28, 0x09e7, 0x0985, 0x0944, 0x0924, 0x0944, 0x09c6, 0x0a07, 0x09c6, 0x0965, 0x09a6, 0x0a27, 0x0a28, 0x0a48, 0x0a69, 0x0aca, 0x0aea, 0x53ef, 0xef7d, 0xffff, 0xe73c, 0x18c3, 0x0861, 0x0861, 0x0861, 0x18c3, 0x2965, 0x39c7, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x2124, 0x7bef, 0xc638, 0xc618, 0x0861, 0x0861, 0x0861, 0x39c7, 0x8410, 0xf7be, 0xf7be, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe6f9, 0xe5ee, 0xe567, 0xdd68, 0x8326, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7ae3, 0xd505, 0xdd04, 0xdd26, 0xdd48, 0xdd69, 0xdd6a, 0xdd8b, 0xdd8b, 0xddab, 0xddab, 0xddcc, 0xddee, 0xddee, 0xde0f, 0xe60f, 0xe630, 0xe674, 0xe6b7, 0xe6d7, 0xe6d8, 0xe6d7, 0xe6f9, 0xe71b, 0xe73c, 0xe73c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf7be, 0xf7be, 0xf7be, 0xc659, 0x0a07, 0x0a89, 0x0a89, 0x0a28, 0x09c6, 0x09c6, 0x0a07, 0x0a48, 0x0a27, 0x09c6, 0x0985, 0x0985, 0x09c6, 0x0a27, 0x09e6, 0x09a5, 0x09a6, 0x09c6, 0x0a07, 0x0a48, 0x0a68, 0x0a89, 0x7491, 0xef7d, 0xffff, 0xffff, 0xffff, 0x9492, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x5aeb, 0xad55, 0xb5b6, 0x9492, 0x630c, 0x52aa, 0xad55, 0xe73c, 0xffff, 0xffff, 0xffdf, 0x5acb, 0x0861, 0x0861, 0x10a2, 0x4228, 0xce59, 0x9cf3, 0x632c, 0x9492, 0xd6ba, 0xf79e, 0xf79e, 0xf79e, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe71b, 0xe6d8, 0xe60f, 0xe588, 0xdd69, 0x7b06, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3961, 0x49c2, 0x5202, 0x5a22, 0x6a62, 0x6aa3, 0x7ae3, 0x8303, 0x8b44, 0x8b64, 0x93a4, 0x9bc5, 0xa3e5, 0xac25, 0xb446, 0xb466, 0xbca6, 0xc4c7, 0xcce7, 0xcd08, 0xd528, 0xdd68, 0xe5cc, 0xe693, 0xe71b, 0xef3c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xef7d, 0xadd7, 0x84d2, 0x536d, 0x1a68, 0x0a07, 0x09c6, 0x09e6, 0x0a28, 0x0a48, 0x0a48, 0x09e7, 0x0985, 0x0965, 0x0985, 0x09a6, 0x0985, 0x0944, 0x0924, 0x0965, 0x09a6, 0x3aeb, 0xb5d7, 0xffdf, 0xffff, 0xffff, 0xffff, 0xffff, 0xf7be, 0xad55, 0x39e7, 0x0861, 0x0861, 0x0861, 0x52aa, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xb5b6, 0x0861, 0x0861, 0x0861, 0x630c, 0x9cd3, 0x3186, 0x2124, 0x31a6, 0xa534, 0xf79e, 0xf79e, 0xf79e, 0xef7d, 0xf79e, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71b, 0xe6b6, 0xe60f, 0xe567, 0xdd6a, 0x72e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2901, 0xbc86, 0xe60f, 0xe6b6, 0xe73b, 0xef3c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xe75d, 0xce79, 0xa575, 0x7c71, 0x434c, 0x0a89, 0x0a68, 0x0a28, 0x09c6, 0x0944, 0x0924, 0x0965, 0x0965, 0x0944, 0x21c6, 0x634c, 0xb5b6, 0xf79e, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xf79e, 0xce79, 0x9cf3, 0x7bcf, 0x5acb, 0xf79e, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xef7d, 0x9cf3, 0x73ae, 0x39e7, 0x630c, 0xb596, 0x0861, 0x0861, 0x39e7, 0xce59, 0xf79e, 0xf79e, 0xf79e, 0xf79d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe696, 0xe5ec, 0xe568, 0xdd48, 0x6ae6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x20c1, 0xb446, 0xe5aa, 0xe651, 0xe71b, 0xef3c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xe73c, 0xce9a, 0xb5f7, 0x9d34, 0x94b2, 0x94b2, 0x9d34, 0xad75, 0xc659, 0xef5d, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xf79e, 0xdefb, 0xe71c, 0x94b2, 0x9cf3, 0xad55, 0xf7be, 0xf7be, 0xf79e, 0xf77c, 0xf739, 0xf6f6, 0xef39, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71b, 0xe6b6, 0xe5cc, 0xe568, 0xd548, 0x62a6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa3e5, 0xe5a9, 0xe630, 0xe6f9, 0xef3c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xf79e, 0xf738, 0xf671, 0xf62e, 0xf64f, 0xf64f, 0xee91, 0xeed6, 0xef3a, 0xef5c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71b, 0xe6b7, 0xe5ab, 0xe567, 0xd549, 0x6285, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8b65, 0xe588, 0xe631, 0xe6f8, 0xef3c, 0xef3c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xf7be, 0xf7be, 0xf79d, 0xf738, 0xf670, 0xf5ea, 0xf5eb, 0xf62c, 0xee0b, 0xedeb, 0xee0c, 0xee71, 0xeeb5, 0xeef8, 0xef19, 0xef3b, 0xef3c, 0xef3c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71b, 0xe695, 0xe5cc, 0xe568, 0xd549, 0x6264, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7b05, 0xe568, 0xe60f, 0xe6d7, 0xe73c, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef5d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xef7d, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xffdf, 0xf7be, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xf7be, 0xf7be, 0xf7be, 0xf738, 0xf670, 0xf5eb, 0xd54b, 0x8bca, 0xb4ce, 0xcd6e, 0xe60d, 0xedeb, 0xedca, 0xedeb, 0xedec, 0xee2e, 0xee73, 0xeed7, 0xef1a, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe73c, 0xe71c, 0xe71b, 0xe695, 0xe5cd, 0xe546, 0xd54b, 0x5a45, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6aa3, 0xdd48, 0xe5ed, 0xe6d7, 0xe73b, 0xe73c, 0xef5d, 0xef5d, 0xef5d, 0xef3b, 0xef19, 0xeef8, 0xeeb4, 0xee71, 0xee70, 0xeed5, 0xf75a, 0xf79e, 0xf79e, 0xf79e, 0xf79e, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffd, 0xff12, 0xfed0, 0xff34, 0xffbb, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xf7be, 0xf7be, 0xf759, 0xf691, 0xf5eb, 0xcd2c, 0x0000, 0x0000, 0x0000, 0x2924, 0x62e9, 0x93ea, 0xb48a, 0xcd2b, 0xe5cc, 0xedca, 0xeda9, 0xedca, 0xe60e, 0xe674, 0xe6b6, 0xe6d8, 0xe6f9, 0xe6fa, 0xe71b, 0xe71c, 0xe71b, 0xe674, 0xe5ab, 0xe567, 0xcd29, 0x5224, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a23, 0xdd48, 0xe5cb, 0xe6b7, 0xe73b, 0xef3c, 0xef3c, 0xef3b, 0xef19, 0xeeb4, 0xee50, 0xedec, 0xedca, 0xdd69, 0xcd29, 0xedea, 0xee2d, 0xf718, 0xf79e, 0xf79e, 0xf79e, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffc, 0xff76, 0xff76, 0xfffd, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffba, 0xfed0, 0xfeae, 0xfe8e, 0xfed1, 0xff57, 0xffdd, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffde, 0xf7be, 0xf79c, 0xf6b3, 0xf60b, 0xdd8c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3163, 0x6ac7, 0x93c9, 0xb48a, 0xcd2a, 0xe58a, 0xe5aa, 0xe5cb, 0xe5cc, 0xe5cd, 0xe60f, 0xe673, 0xe6b7, 0xe6d8, 0xe653, 0xe5aa, 0xe567, 0xcd08, 0x5205, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x49e2, 0xcd08, 0xe5cc, 0xe6b5, 0xe71a, 0xe71b, 0xe6f9, 0xeeb5, 0xee30, 0xedcb, 0xedca, 0xd54a, 0xac27, 0x72c5, 0x20c1, 0xa407, 0xedeb, 0xf670, 0xf719, 0xf79e, 0xf79e, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffd, 0xff77, 0xfecf, 0xfecf, 0xff33, 0xfffc, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffe, 0xff76, 0xfed0, 0xbceb, 0xc50b, 0xfe8f, 0xfeaf, 0xff13, 0xffbc, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xf7be, 0xf7be, 0xf6d5, 0xf60b, 0xe5ed, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3984, 0x6ac6, 0x93a7, 0xac47, 0xcce8, 0xe589, 0xe588, 0xe588, 0xe5aa, 0xe5ed, 0xe5cd, 0xe567, 0xe547, 0xcd09, 0x49e4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3962, 0xc4a6, 0xe5cb, 0xe672, 0xe6f9, 0xe673, 0xe60f, 0xe5cb, 0xeda9, 0xcd08, 0x9be6, 0x6284, 0x1081, 0x0000, 0x0000, 0x0000, 0xbcc9, 0xedeb, 0xf6b3, 0xf75a, 0xf79e, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xffdf, 0xffdf, 0xffde, 0xffde, 0xffde, 0xffde, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffe, 0xff77, 0xfef1, 0xfed0, 0xfecf, 0xfecf, 0xff54, 0xfffc, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffe, 0xff55, 0xfed0, 0x7b69, 0x0000, 0x8389, 0xee2e, 0xfeaf, 0xfed1, 0xff78, 0xffdd, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffbe, 0xf6f5, 0xf62c, 0xee2e, 0x3163, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3162, 0x6aa5, 0x93a6, 0xac46, 0xccc6, 0xdd47, 0xe567, 0xdd46, 0xe546, 0xcd09, 0x41c4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2901, 0xbc86, 0xe587, 0xe5aa, 0xe5ec, 0xe5a9, 0xe568, 0xc4c7, 0x93a6, 0x5a24, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xdd6a, 0xf60c, 0xf6f7, 0xf77c, 0xf79e, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xffde, 0xffde, 0xffbd, 0xff16, 0xfed2, 0xfef3, 0xff79, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffb9, 0xff32, 0xff12, 0xaced, 0xacec, 0xff11, 0xfed0, 0xff75, 0xfffc, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffd, 0xff54, 0xfeb0, 0x41e5, 0x0000, 0x0000, 0x39a4, 0xbccb, 0xfe8f, 0xfe8f, 0xff14, 0xffbb, 0xfffe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffdf, 0xffdf, 0xffbe, 0xf6f5, 0xf62c, 0xf64d, 0x4a05, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3983, 0x6ac4, 0x9385, 0xac25, 0xccc6, 0xc4ea, 0x41c4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x20c1, 0xac26, 0xe567, 0xe567, 0xdd47, 0xbc87, 0x8b86, 0x49c3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x41c3, 0xedeb, 0xf64e, 0xf718, 0xf79d, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xffbe, 0xffbd, 0xff59, 0xfeb1, 0xfe6e, 0xfe6d, 0xfe8e, 0xff14, 0xffdd, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffe, 0xff55, 0xfef0, 0xde53, 0x2103, 0x0000, 0xacee, 0xff11, 0xff11, 0xff75, 0xfffd, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffd, 0xff11, 0xe60e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7327, 0xe5ee, 0xfe8f, 0xfed1, 0xff57, 0xffde, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffdf, 0xffdf, 0xffbe, 0xf6f6, 0xf64d, 0xf64d, 0x62a6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x41a3, 0x41e5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9be6, 0xdd27, 0xb446, 0x8324, 0x41a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7b05, 0xf5eb, 0xf690, 0xf739, 0xf79d, 0xf7be, 0xf7be, 0xf7be, 0xf7be, 0xffbd, 0xff7a, 0xfef4, 0xfe6e, 0xfe4d, 0xf66f, 0xee0d, 0xfe6e, 0xfed1, 0xff78, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xff97, 0xff12, 0xf713, 0x62e8, 0x0000, 0x0000, 0x0000, 0xad0e, 0xff32, 0xff11, 0xff75, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffc, 0xfef1, 0xc54d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3163, 0xb4ab, 0xfe6e, 0xfeaf, 0xfef3, 0xffbb, 0xffde, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffdf, 0xffde, 0xff37, 0xf66e, 0xf64d, 0x7b26, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x41a3, 0x72e5, 0x3121, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9be7, 0xf60c, 0xf6b3, 0xf75b, 0xf79d, 0xf7be, 0xf7be, 0xf7be, 0xff7b, 0xfef4, 0xfe6f, 0xfe4d, 0xfe90, 0xd5af, 0x6ae8, 0x7b48, 0xfeb0, 0xfe8e, 0xff14, 0xfffe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffb, 0xff33, 0xff33, 0xa4ef, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xad0e, 0xff11, 0xff12, 0xff75, 0xfffe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffc, 0xfef1, 0xa48c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6ac6, 0xddcd, 0xfe8e, 0xfeb0, 0xff58, 0xffdd, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffde, 0xff37, 0xf66f, 0xf64d, 0x8b88, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xbca8, 0xf60c, 0xf6f6, 0xf77c, 0xf7be, 0xf7be, 0xf77c, 0xf716, 0xf66f, 0xfe4d, 0xfe4d, 0xe610, 0x83aa, 0x18a2, 0x0000, 0x0000, 0xcd8f, 0xfe6e, 0xfed1, 0xff98, 0xfffe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffd, 0xff54, 0xff11, 0xd674, 0x2123, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xad0e, 0xff11, 0xff11, 0xff75, 0xfffe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffb9, 0xfef1, 0x7b69, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2943, 0xa449, 0xf64e, 0xfe8f, 0xff14, 0xff9b, 0xfffe, 0xffff, 0xffdf, 0xffdf, 0xff37, 0xfe8f, 0xf64d, 0x9be8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xd54a, 0xf62d, 0xf75a, 0xf79d, 0xf77c, 0xf738, 0xf691, 0xfe4d, 0xfe4d, 0xee50, 0xa46c, 0x2943, 0x0000, 0x0000, 0x0000, 0x0000, 0x62a7, 0xfe8f, 0xfeaf, 0xfef2, 0xffdd, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffe, 0xffb8, 0xfef1, 0xf6f3, 0x62e9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xad0d, 0xff11, 0xff11, 0xff97, 0xfffe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffd, 0xff97, 0xfef2, 0x41e5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6286, 0xd58d, 0xfe6e, 0xfed1, 0xff37, 0xffbd, 0xffde, 0xffdf, 0xff79, 0xfeb1, 0xfe4d, 0xac49, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x41a3, 0xedeb, 0xf64e, 0xf75a, 0xf75a, 0xf6d4, 0xf62d, 0xf62d, 0xf64f, 0xb4ed, 0x4a06, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xbd2e, 0xfeaf, 0xfeb0, 0xff77, 0xfffe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffb, 0xff33, 0xff32, 0xa4cf, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xaced, 0xff32, 0xff12, 0xffb8, 0xfffe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffd, 0xff96, 0xe650, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x20e2, 0x9c09, 0xf62e, 0xfe8e, 0xfed1, 0xff9c, 0xffde, 0xff79, 0xfed2, 0xfe4d, 0xb48a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x72e5, 0xf60c, 0xf66f, 0xf6b2, 0xf66f, 0xf62c, 0xf66e, 0xcd8e, 0x6ae8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a06, 0xf690, 0xfeaf, 0xff12, 0xffdc, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffc, 0xff76, 0xff32, 0xd652, 0x18c2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xad0e, 0xff32, 0xff32, 0xffb8, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffc, 0xff75, 0xc56e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5205, 0xcd2b, 0xfe6e, 0xfeb0, 0xff36, 0xff36, 0xfed2, 0xfe4d, 0xc4ea, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9bc7, 0xf60b, 0xf60b, 0xf60b, 0xf62c, 0xddce, 0x838a, 0x18a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xacad, 0xfeb0, 0xfed0, 0xffb9, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xff98, 0xff11, 0xf714, 0x5ac8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xad0e, 0xff31, 0xff53, 0xffb8, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffb, 0xff53, 0xa4ac, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8ba8, 0xeded, 0xfe6d, 0xfe8f, 0xfe8f, 0xfe4d, 0xcd2b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xb489, 0xf60b, 0xf60c, 0xe60e, 0x9c2a, 0x2943, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3184, 0xee2f, 0xfed0, 0xff33, 0xffdb, 0xffff, 0xffff, 0xffff, 0xffff, 0xffda, 0xff55, 0xff75, 0x9ccf, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xad0d, 0xff32, 0xff53, 0xffb8, 0xffff, 0xffff, 0xffff, 0xffda, 0xff33, 0x7b89, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x49e4, 0xc4eb, 0xfe4d, 0xfe4d, 0xfe4d, 0xdd6b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xd54b, 0xee0e, 0xb4ab, 0x41e5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x940b, 0xfef1, 0xfef1, 0xff98, 0xfffe, 0xffff, 0xffff, 0xfffe, 0xff76, 0xff53, 0xd654, 0x18c2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xad0d, 0xff32, 0xff33, 0xffd8, 0xffff, 0xfffd, 0xffb8, 0xff13, 0x41e5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7b27, 0xe5cc, 0xfe4d, 0xe5ed, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x39c7, 0xc5b4, 0x6ae7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2103, 0xde0f, 0xfef1, 0xff34, 0xffdb, 0xffff, 0xffff, 0xff97, 0xff32, 0xf736, 0x52a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xaced, 0xff32, 0xff32, 0xffb7, 0xff96, 0xff32, 0xe691, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3983, 0xb48a, 0xee2f, 0x2103, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x18c3, 0x18c2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7348, 0xff12, 0xfef0, 0xff77, 0xfffe, 0xfffc, 0xff33, 0xff74, 0x9c8e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xad0d, 0xff33, 0xff32, 0xff32, 0xff11, 0xc58e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7329, 0x2944, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xcdb0, 0xfed0, 0xff11, 0xff33, 0xff32, 0xff33, 0xd655, 0x18c2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xad0e, 0xff32, 0xff32, 0xff11, 0xa48c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x62a7, 0xfed1, 0xfef1, 0xfef1, 0xff12, 0xf734, 0x5268, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xad0d, 0xff53, 0xff32, 0x7b68, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xb52e, 0xff11, 0xff11, 0xff75, 0x948e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xad0e, 0xfef1, 0x41e5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a05, 0xf6b0, 0xff33, 0xce12, 0x18c2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x940a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa48c, 0xef15, 0x4a47, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2964, 0x73ac, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+};
+#define banner_pixel 16200
+#define MAXR 31
+#define MINR 0
+#define MAXG 63
+#define MING 0
+#define MAXB 31
+#define MINB 0
Index: trunk/src/opengl/glide/sst1/glide/cpudetect.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/cpudetect.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/cpudetect.c	(revision 2885)
@@ -0,0 +1,47 @@
+/* 
+ * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ * FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ * 
+ * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ * TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ * THE UNITED STATES.  
+ * 
+ * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+ */
+
+#include <sys/utsname.h>
+#include <stdio.h>
+
+int _cpu_detect_asm() {
+  struct utsname name;
+
+  uname(&name);
+  if (!strcmp(name.machine, "i386")) return 3;
+  if (!strcmp(name.machine, "i486")) return 4;
+  if (!strcmp(name.machine, "i586")) return 5;
+  if (!strcmp(name.machine, "i686")) return 6;
+  fprintf(stderr, "Couldn't determine cpu type. Using i586\n");
+  return 5;
+}
+
+void single_precision_asm() {
+  asm("push %eax \n fnclex \n fstcw (%esp) \n movl (%esp), %eax \n "
+      "and $0x0000fcff, %eax \n movl %eax, (%esp) \n fldcw (%esp) \n pop %eax");
+}
+
+
+void double_precision_asm() {
+  asm("push %eax \n fnclex \n fstcw (%esp) \n movw (%esp), %eax \n "
+      "and $0x0000fcff, %eax \n or $0x000002ff, %eax \n mov %eax, (%esp) \n "
+      "fldcw (%esp) \n pop %eax");
+}
+
Index: trunk/src/opengl/glide/sst1/glide/cpudtect.asm
===================================================================
--- trunk/src/opengl/glide/sst1/glide/cpudtect.asm	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/cpudtect.asm	(revision 2885)
@@ -0,0 +1,163 @@
+;;
+;; THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+;; PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+;; TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+;; INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+;; DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+;; THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+;; EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+;; FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+;; 
+;; USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+;; RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+;; TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+;; AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+;; SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+;; THE UNITED STATES.  
+;; 
+;; COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+;;
+;; $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/cpudtect.asm,v 1.1 2000-02-25 00:31:09 sandervl Exp $
+;; $Log: cpudtect.asm,v $
+;; Revision 1.1  2000-02-25 00:31:09  sandervl
+;; Created new Voodoo 1 Glide dir
+;;
+; 
+; 2     3/04/97 9:10p Dow
+; Neutered mutiplatform multiheaded monster.
+;;
+;;
+
+TITLE  cpudtect.asm
+
+.586P
+
+CODE32  segment para use32 public 'CODE'
+CODE32  ends
+DATA32  segment para use32 public 'DATA'
+DATA32  ends
+BSS32   segment para use32 public 'BSS'
+BSS32   ends
+DGROUP  group BSS32, DATA32
+        assume  cs:FLAT, ds:FLAT, ss:FLAT, es:FLAT
+    
+;;; Some useful constants
+; CPU Type
+CPUTypeUnknown  = 0ffffffffh
+CPUTypePrePent  = 4h
+CPUTypeP5       = 5h    
+CPUTypeP6       = 6h    
+        
+;;; References to external data:
+    
+CODE32   SEGMENT
+;;
+;;  cpu_detect_asm - detect the type of CPU 
+;; 
+;;  USAGE:
+;;
+;;  int _System cpu_detect_asm(void);
+;;
+;;  returns 4 for non-pen
+
+PUBLIC  _cpu_detect_asm
+_cpu_detect_asm PROC 
+    pushad                              ; save all regs.
+
+    ; First, determine whether CPUID instruction is available.
+    ; If it's not, then it's a 386 or 486.
+    pushfd                              ; push original EFLAGS.
+    pop eax                             ; pop into eax
+    mov ecx, eax                        ; save original EFLAGS in ecx
+    xor eax, 0200000h                   ; flip ID bit in EFLAGS
+    push    eax                         ; put it back on stack
+    popfd                               ; pop into EFLAGS
+    pushfd                              ; get EFLAGS back
+    pop eax                             ; into eax
+    xor eax, ecx                        ; check to see if we could toggle ID
+    jz  NotPentium                      ; Sorry, not P5 or P6.
+    
+    ;
+    ; Now determine whether it's an intel P6 CPU.
+    ;
+    ;;  Is it an Intel CPU?
+    xor eax, eax                        ; eax = 0.
+    cpuid                               ; get cpuid
+    xor ebx, 0756e6547h                 ; "Genu"
+    jnz NotIntel
+    xor edx, 049656e69h                 ; "ineI"
+    jnz NotIntel
+    xor ecx, 06c65746eh                 ; "ntel"
+    jnz NotIntel                        ;
+    ;;  Verifying architecture family
+    mov eax, 1
+    cpuid                               ; get family/model/stepping
+    shr eax, 8                          ; rid of model & stepping number
+    and eax, 0fh                        ; use only family
+    cmp eax, 6
+    jl     IsP5                         ; It's a P5
+    ;; Else it's a P6
+    ;
+    ; Intel P6 processor. 
+    ; Make sure it supports Memory Type Range Request registers
+    ;
+IsP6:   
+    popad
+    mov eax, 6                          ; 
+    ret                                 ; return 
+
+IsP5:   
+    popad
+    mov eax, 5                          ; 
+    ret
+
+NotPentium:
+    popad
+    mov eax, 4
+    ret
+
+NotIntel:
+    popad
+    mov eax, 0ffffffffh
+    ret
+        
+_cpu_detect_asm ENDP
+
+
+;------------------------------------------------------------------------------   
+; this routine sets the precision to single
+; which effects all adds, mults, and divs
+    align 4                 ; 
+    PUBLIC  _single_precision_asm
+_single_precision_asm PROC 
+    push  eax       ; make room
+    fnclex          ; clear pending exceptions    
+    fstcw WORD PTR [esp]
+    mov   eax, DWORD PTR [esp]
+    and   eax, 0000fcffh  ; clear bits 9:8
+    mov   DWORD PTR [esp], eax
+    fldcw WORD PTR [esp]
+    pop   eax
+    ret   0
+_single_precision_asm ENDP
+
+;------------------------------------------------------------------------------   
+; this routine sets the precision to double
+; which effects all adds, mults, and divs
+    align 4                 ; 
+    PUBLIC  _double_precision_asm
+_double_precision_asm PROC 
+    push  eax       ; make room
+    fnclex          ; clear pending exceptions    
+    fstcw WORD PTR [esp]
+    mov   eax, DWORD PTR [esp]
+    and   eax, 0000fcffh  ; clear bits 9:8
+    or    eax, 000002ffh  ; set 9:8 to 10
+    mov   DWORD PTR [esp], eax
+    fldcw WORD PTR [esp]
+    pop   eax
+    ret   0
+_double_precision_asm ENDP
+    
+CODE32 ENDS
+END
Index: trunk/src/opengl/glide/sst1/glide/ddgump.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/ddgump.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/ddgump.c	(revision 2885)
@@ -0,0 +1,607 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/ddgump.c,v 1.1 2000-02-25 00:31:09 sandervl Exp $
+** $Log: ddgump.c,v $
+** Revision 1.1  2000-02-25 00:31:09  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 2     3/04/97 9:08p Dow
+ * Neutered multiplatform multiheaded monster
+ * 
+ * 1     12/23/96 1:39p Dow
+ * Changes for multiplatform
+**
+*/
+
+/* Implements multipass drawing */
+
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+#include "gump.h"
+
+extern GrMPState _gumpState;
+
+/* CHD BUG this belongs in fxglide.h */
+void FX_CSTYLE
+_gumpTexCombineFunction( int virtual_tmu );
+
+/*
+** _gumpTexCombineFunction
+**                                                          
+** Sets the texture combine function.  For a dual TMU system this function
+** will configure the TEXTUREMODE registers as appropriate.  For a
+** single TMU system this function will configure TEXTUREMODE if
+** possible, or defer operations until grDrawTriangle() is called.
+*/
+GR_DDFUNC(_gumpTexCombineFunction, void, ( int virtual_tmu ))
+{
+  FxU32 texmode;
+  GrMPTextureCombineFnc_t tc;
+
+  GR_BEGIN("_gumpTexCombineFunction",99,4+2*PACKER_WORKAROUND_SIZE);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",virtual_tmu));
+
+  texmode = gc->state.tmu_config[0].textureMode;
+  texmode &= ~( SST_TCOMBINE | SST_TACOMBINE );
+  tc = _gumpState.tc_fnc;
+
+  switch ( tc )
+  {
+  case GR_MPTEXTURECOMBINE_ADD:
+    /* tmu0: other + local */
+    /* tmu1: local */
+    /* pass0(tm0): local */
+    /* pass1(tm1): local */
+    if ( virtual_tmu == 0 )
+    {
+      texmode |= ( SST_TC_REPLACE | SST_TCA_REPLACE );
+    }
+    else
+    {
+      texmode |= ( SST_TC_REPLACE | SST_TCA_REPLACE );
+    }
+    break;
+  case GR_MPTEXTURECOMBINE_MULTIPLY:
+    /* tmu0: other * local */
+    /* tmu1: local */
+    /* pass0(tm0): local */
+    /* pass1(tm1): local */
+    if ( virtual_tmu == 0 )
+    {
+      texmode |= ( SST_TC_REPLACE | SST_TCA_REPLACE );
+    }
+    else
+    {
+      texmode |= ( SST_TC_REPLACE | SST_TCA_REPLACE );
+    }
+    break;
+  case GR_MPTEXTURECOMBINE_DETAIL0:
+    /* tmu0: (other - local) * lod + local */
+    /*     = lod * other + (1 - lod) * local */
+    /* tmu1: local */
+    /* pass0(tm0): (-local) * lod + local */
+    /*           = (1 - lod) * local */
+    /* pass1(tm1): (-local) * (1 - lod) + local */
+    /*           = lod * local */
+    if ( virtual_tmu == 0 )
+    {
+      texmode |= ( SST_TC_BLEND_LOD | SST_TCA_BLEND_LOD |
+                   SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER );
+    }
+    else
+    {
+      texmode |= ( SST_TC_BLEND_LOD | SST_TCA_BLEND_LOD |
+                   SST_TC_REVERSE_BLEND | SST_TCA_REVERSE_BLEND |
+                   SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER );      
+    }
+    break;
+  case GR_MPTEXTURECOMBINE_DETAIL1:
+    /* tmu0: (other - local) * (1 - lod) + local */
+    /*     = (1 - lod) * other + lod * local */
+    /* tmu1: local */
+    /* pass0(tm0): (-local) * (1 - lod) + local */
+    /*           = lod * local */
+    /* pass1(tm1): (-local) * lod + local */
+    /*           = (1 - lod) * local */
+    if ( virtual_tmu == 0 )
+    {
+      texmode |= ( SST_TC_BLEND_LOD | SST_TCA_BLEND_LOD |
+                   SST_TC_REVERSE_BLEND | SST_TCA_REVERSE_BLEND |
+                   SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER );
+    }
+    else
+    {
+      texmode |= ( SST_TC_BLEND_LOD | SST_TCA_BLEND_LOD |
+                   SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER );
+    }
+    break;
+  case GR_MPTEXTURECOMBINE_TRILINEAR0:
+    /* tmu0: (other - local) * lodbfrac + local */
+    /*     = lodbfrac * other + (1 - lodbfrac) * local */
+    /* tmu1: local */
+    /* pass0(tm0): (-local) * lodbfrac + local */
+    /*           = (1 - lodbfrac) * local */
+    /* pass1(tm1): (-local) * (1 - lodbfrac) + local */
+    /*           = lodbfrac * local */
+    if ( virtual_tmu == 0 )
+    {
+      texmode |= ( SST_TC_BLEND_LODFRAC | SST_TCA_BLEND_LODFRAC |
+                   SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER );
+    }
+    else
+    {
+      texmode |= ( SST_TC_BLEND_LODFRAC | SST_TCA_BLEND_LODFRAC |
+                   SST_TC_REVERSE_BLEND | SST_TCA_REVERSE_BLEND |
+                   SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER );
+    }
+    break;
+  case GR_MPTEXTURECOMBINE_TRILINEAR1:
+    /* tmu0: (other - local) * (1 - lodbfrac) + local
+           = (1 - lodbfrac) * other + lodbfrac * local
+       tmu1: local
+       pass0(tm0): (-local) * (1 - lodbfrac) + local
+                 = lodbfrac * local
+       pass1(tm1): (-local) * lodbfrac + local
+                 = (1 - lodbfrac) * local
+    */
+    if ( virtual_tmu == 0 )
+    {
+      texmode |= ( SST_TC_BLEND_LODFRAC | SST_TCA_BLEND_LODFRAC |
+                  SST_TC_REVERSE_BLEND | SST_TCA_REVERSE_BLEND |
+                  SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER );
+    }
+    else
+    {
+      texmode |= ( SST_TC_BLEND_LODFRAC | SST_TCA_BLEND_LODFRAC |
+                   SST_TC_ZERO_OTHER | SST_TCA_ZERO_OTHER );
+    }
+    break;
+  case GR_MPTEXTURECOMBINE_SUBTRACT:
+    /*
+       tmu0: other - local 
+       tmu1: local
+       doesn't work, alpha blender can't subtract
+       */
+    GrErrorCallback( "_gumpTexCombineFunction:  TEXTURE_SUBTRACT not supported", FXFALSE );
+    return;
+    break;
+  default:
+    GrErrorCallback( "_gumpTexCombineFunction:  Unsupported function", FXFALSE );
+    return;
+    break;
+  }
+  PACKER_WORKAROUND;
+  GR_SET( SST_TMU(hw,0)->textureMode , texmode );
+  PACKER_WORKAROUND;
+  GR_END_SLOPPY();
+} /* _gumpTexCombineFunction */
+
+GR_ENTRY(guMPDrawTriangle, void, ( const GrVertex *a, const GrVertex *b, const GrVertex *c ))
+{
+  GR_BEGIN_NOFIFOCHECK("guMPDrawTriangle",98);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x,0x%x,0x%x)\n",a,b,c));
+  GR_CHECK_F(myName, !a || !b || !c, "NULL pointer passed");
+
+  /* check for multipass texture modes */
+  /* xxx complex multipass mode checks should be moved into gtex/gglide */
+  /* specific color combine modes use texture */
+  /* this is equivalent to
+       fbzColorPath & SST_ENTEXTREMAP
+       cc_state & STATE_CC_REQUIRES_DECAL_STW */
+  /* specific texture combine modes */
+  /* xxx don't even check anymore, because you can't */
+
+  {
+    /* check for not possible on one tmu modes */
+    /* alpha blend enabled (grAlphaBlendMode)
+         xxx some can work, with some cheats, even more
+       low bit alpha switches between iterated and constant rgb
+         (grAlphaControlsITRGBLighting)
+       alpha test (grAlphaTestFunction)
+         xxx actually, NEVER is ok too
+       chromakey
+    */
+
+    if ( ( gc->state.fbi_config.alphaMode & SST_ENALPHABLEND ) ||
+         ( gc->state.fbi_config.fbzColorPath & SST_LOCALSELECT_OVERRIDE_WITH_ATEX ) ||
+         ( gc->state.fbi_config.alphaMode & SST_ENALPHAFUNC ) ||
+         ( gc->state.fbi_config.fbzMode & SST_ENCHROMAKEY )
+       )
+    {
+      GrErrorCallback( "guMPDrawTriangle:  Illegal state", FXFALSE );
+    }
+
+    if ( _gumpState.tc_fnc == GR_MPTEXTURECOMBINE_ADD ||
+         _gumpState.tc_fnc == GR_MPTEXTURECOMBINE_DETAIL0 ||
+         _gumpState.tc_fnc == GR_MPTEXTURECOMBINE_DETAIL1 ||
+         _gumpState.tc_fnc == GR_MPTEXTURECOMBINE_TRILINEAR0 ||
+         _gumpState.tc_fnc == GR_MPTEXTURECOMBINE_TRILINEAR1 )
+    {
+      /* render pass with all effects */
+      /* select other texture map */
+      /* set alpha blend to add to dest buffer */
+      /* if depth buffering, save depth buffer function,
+         set to z-equal */
+      /* disable fog and color combine bias */
+      /* render other pass */
+      /* restore depth buffer function, restore alpha blend, enable fog
+         and color combine bias */
+
+      FxU32 alphamode, alphamode_orig;
+      FxU32 fbzcolorpath, fbzcolorpath_orig;
+      FxU32 fbzmode, fbzmode_orig;
+      FxU32 fogmode, fogmode_orig;
+
+      alphamode = alphamode_orig = gc->state.fbi_config.alphaMode;
+      fbzcolorpath = fbzcolorpath_orig = gc->state.fbi_config.fbzColorPath;
+      GR_CHECK_SIZE();
+
+      /* first pass */
+
+      /* tmu setup */
+      guTexSource( _gumpState.mmid[0] );
+      _gumpTexCombineFunction( 0 );
+
+      /* render first pass */
+      grDrawTriangle( a, b, c );
+
+      /* second pass */
+
+      /* xxx may need to copy texture coordinates, see
+         grTexCombineFunction's second parameter.  if so,
+         we have to disable the second coordinate when drawing. */
+
+      /* tmu setup */
+      guTexSource( _gumpState.mmid[1] );
+      _gumpTexCombineFunction( 1 );
+
+      GR_SET_EXPECTED_SIZE(16);
+      /* enable alpha blend to add to destination buffers */
+      alphamode &= ~(SST_RGBSRCFACT | SST_RGBDSTFACT | SST_ASRCFACT | SST_ADSTFACT);
+      alphamode |= SST_ENALPHABLEND |
+                   (SST_A_ONE << SST_RGBSRCFACT_SHIFT) |
+                   (SST_A_ONE << SST_RGBDSTFACT_SHIFT) |
+                   (SST_A_ONE << SST_ASRCFACT_SHIFT) |
+                   (SST_A_ONE << SST_ADSTFACT_SHIFT);
+
+      GR_SET( hw->alphaMode, alphamode );
+
+      /* if depth buffering, set to z= mode and disable writes */
+
+      if ( gc->state.fbi_config.fbzMode & SST_ENDEPTHBUFFER )
+      {
+        fbzmode = fbzmode_orig = gc->state.fbi_config.fbzMode;
+
+        fbzmode &= ~(SST_ZAWRMASK | SST_ZFUNC);
+        fbzmode |= GR_CMP_EQUAL;
+
+        GR_SET( hw->fbzMode, fbzmode );
+      }
+
+      /* disable (fogta * fogColor) bias */
+      /* xxx setting ADD_FOG with fog disabled is harmless */
+      if ( gc->state.fbi_config.fogMode & SST_ENFOGGING ) {
+        fogmode = fogmode_orig = gc->state.fbi_config.fogMode;
+        fogmode |= SST_FOGADD;
+        GR_SET( hw->fogMode, fogmode );
+      }
+
+      /* disable biasing in color combine */
+      /* this can change the parameters output */
+      /* xxx the equivalent of GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA
+             does not work, you need to do this instead of below.
+
+      if ( gc->state.cc_fnc == GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA )
+      {
+        fbzcolorpath &= ~SST_CC_ADD_CLOCAL;
+      }
+      */
+
+      
+      fbzcolorpath &= ~(SST_CC_ADD_CLOCAL | SST_CC_ADD_ALOCAL | SST_CC_SUB_CLOCAL);
+      GR_SET( hw->fbzColorPath, fbzcolorpath );
+      GR_CHECK_SIZE_SLOPPY();
+
+      /* render other pass */
+      grDrawTriangle( a, b, c );
+
+      /* restore */
+      GR_SET_EXPECTED_SIZE(16);
+
+      /* restore alpha blending state */
+      GR_SET( hw->alphaMode, alphamode_orig );
+
+      /* restore depth buffer state */
+      if ( gc->state.fbi_config.fbzMode & SST_ENDEPTHBUFFER ) {
+        GR_SET( hw->fbzMode, fbzmode_orig );
+      }
+
+      /* restore fog state */
+      if ( gc->state.fbi_config.fogMode & SST_ENFOGGING ) {
+        GR_SET( hw->fogMode, fogmode_orig );
+      }
+
+      /* restore ccu/acu state */
+      GR_SET( hw->fbzColorPath, fbzcolorpath_orig );
+
+      goto all_done;
+    }
+
+    else if ( _gumpState.tc_fnc == GR_MPTEXTURECOMBINE_MULTIPLY )
+    {
+      /* disable fog and color combine bias */
+      /* render pass with all other effects */
+      /* select other texture map */
+      /* set alpha blend to multiply to dest buffer */
+      /* if depth buffering, save depth buffer function,
+         set to z-equal */
+      /* disable fog and color combine factor */
+      /* render other pass */
+      /* if fog or color combine w/bias */
+        /* disable tmu */
+        /* set alpha blend to add to dest buffer */
+        /* enable fog and color combine bias */
+        /* render bias pass */
+      /* restore depth buffer function, restore alpha blend, enable fog
+         and color combine bias */
+
+      FxU32 alphamode, alphamode_orig;
+      FxU32 fbzcolorpath, fbzcolorpath_orig;
+      FxU32 fbzmode, fbzmode_orig;
+      FxU32 fogmode, fogmode_orig;
+
+      alphamode = alphamode_orig = gc->state.fbi_config.alphaMode;
+      fbzcolorpath = fbzcolorpath_orig = gc->state.fbi_config.fbzColorPath;
+
+      /* first pass */
+
+      /* tmu setup */
+
+      guTexSource( _gumpState.mmid[0] );
+      _gumpTexCombineFunction( 0 );
+
+      /* disable bias */
+      GR_SET_EXPECTED_SIZE(8);
+
+      /* disable (fogta * fogColor) bias */
+      /* xxx setting ADD_FOG with fog disabled is harmless */
+
+      if ( gc->state.fbi_config.fogMode & SST_ENFOGGING ) {
+        fogmode = fogmode_orig = gc->state.fbi_config.fogMode;
+        fogmode |= SST_FOGADD;
+        GR_SET( hw->fogMode, fogmode );
+      }
+
+      /* disable biasing in color combine */
+      /* this can change the parameters output */
+      /* xxx consult add path for switch version */
+      /* xxx the equivalent of GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA
+             does not work, you need to do this instead of below.
+
+      if ( gc->state.cc_fnc == GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA )
+      {
+        fbzcolorpath &= ~SST_CC_ADD_CLOCAL;
+      }
+      */
+
+      fbzcolorpath &= ~(SST_CC_ADD_CLOCAL | SST_CC_ADD_ALOCAL | SST_CC_SUB_CLOCAL);
+      GR_SET( hw->fbzColorPath, fbzcolorpath );
+      GR_CHECK_SIZE_SLOPPY();
+
+      /* render first pass */
+
+      grDrawTriangle( a, b, c );
+
+      /* second pass */
+
+      /* xxx may sometimes need to copy texture coordinates */
+
+      /* tmu setup */
+
+      guTexSource( _gumpState.mmid[1] );
+      _gumpTexCombineFunction( 1 );
+      GR_SET_EXPECTED_SIZE(16);
+
+      /* enable alpha blend to multiply to destination buffers */
+      /* xxx alpha component blender can only handle factors of
+         0 and 1 */
+
+      alphamode &= ~(SST_RGBSRCFACT | SST_RGBDSTFACT | SST_ASRCFACT | SST_ADSTFACT);
+      alphamode |= SST_ENALPHABLEND |
+                   (SST_A_COLOR << SST_RGBSRCFACT_SHIFT) |
+                   (SST_A_ZERO << SST_RGBDSTFACT_SHIFT) |
+                   (SST_A_ONE << SST_ASRCFACT_SHIFT) |
+                   (SST_A_ZERO << SST_ADSTFACT_SHIFT);
+
+      GR_SET( hw->alphaMode, alphamode );
+
+      /* if depth buffering, set to z= mode and disable writes */
+      if ( gc->state.fbi_config.fbzMode & SST_ENDEPTHBUFFER )
+      {
+        fbzmode = fbzmode_orig = gc->state.fbi_config.fbzMode;
+        fbzmode &= ~(SST_ZAWRMASK | SST_ZFUNC);
+        fbzmode |= GR_CMP_EQUAL;
+        GR_SET( hw->fbzMode, fbzmode );
+      }
+
+      /* disable fog */
+      if ( gc->state.fbi_config.fogMode & SST_ENFOGGING ) {
+        GR_SET( hw->fogMode, 0 );
+      }
+
+      /* disable factor and bias in color combine--
+         decal, except for the cases that need texture alpha */
+      /* this can change the parameters output */
+
+      fbzcolorpath  = fbzcolorpath_orig;
+      fbzcolorpath &= ~( SST_RGBSELECT |
+                         SST_LOCALSELECT |
+                         SST_CC_ZERO_OTHER |
+                         SST_CC_SUB_CLOCAL |
+                         SST_CC_MSELECT |
+                         SST_CC_REVERSE_BLEND |
+                         SST_CC_ADD_CLOCAL |
+                         SST_CC_ADD_ALOCAL |
+                         SST_CC_INVERT_OUTPUT |
+                         SST_CC_REVERSE_BLEND );
+
+      /* xxx the equivalent of GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA
+             does not work, you need to do this instead of below.
+
+      if ( gc->state.cc_fnc == GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA )
+      {
+        xxx see implementation notes on why this isn't implemented yet
+        GrErrorCallback( "guDrawTriangleMP:  MULTIPLY and BLEND_ITRGB_ON_TEXALPHA not implemented yet!", FXFALSE );
+        goto all_done;
+      }
+      */
+
+      fbzcolorpath |= SST_RGBSEL_TMUOUT;
+      GR_SET( hw->fbzColorPath, fbzcolorpath );
+      GR_CHECK_SIZE_SLOPPY();
+
+      /* render second pass */
+      grDrawTriangle( a, b, c );
+
+      /* if bias, third pass */
+      if ( ( gc->state.fbi_config.fogMode & SST_ENFOGGING )
+      /* xxxXXXxxx it isn't very easy to check following any more!
+           ||
+           gc->state.cc_fnc == GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_ADD_ITALPHA ||
+           gc->state.cc_fnc == GR_COLORCOMBINE_TEXTURE_TIMES_ITALPHA_ADD_ITRGB ||
+           gc->state.cc_fnc == GR_COLORCOMBINE_TEXTURE_ADD_ITRGB ||
+           gc->state.cc_fnc == GR_COLORCOMBINE_TEXTURE_SUB_ITRGB ||
+           gc->state.cc_fnc == GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA ||
+           gc->state.cc_fnc == GR_COLORCOMBINE_DIFF_SPEC_A ||
+           gc->state.cc_fnc == GR_COLORCOMBINE_DIFF_SPEC_B */ )
+      {
+        /* enable alpha blend to add to destination buffers */
+        GR_SET_EXPECTED_SIZE(8);
+
+        alphamode &= ~(SST_RGBSRCFACT | SST_RGBDSTFACT | SST_ASRCFACT | SST_ADSTFACT);
+        alphamode |= SST_ENALPHABLEND |
+                     (SST_A_ONE << SST_RGBSRCFACT_SHIFT) |
+                     (SST_A_ONE << SST_RGBDSTFACT_SHIFT) |
+                     (SST_A_ONE << SST_ASRCFACT_SHIFT) |
+                     (SST_A_ONE << SST_ADSTFACT_SHIFT);
+
+        GR_SET( hw->alphaMode, alphamode );
+
+        /* disable fog factor, leave fog bias enabled */
+        /* xxx setting ADD_MULT with fog disabled is harmless */
+        if ( gc->state.fbi_config.fogMode & SST_ENFOGGING ) {
+          fogmode = fogmode_orig;
+          fogmode |= SST_FOGMULT;
+          GR_SET( hw->fogMode, fogmode );
+        }
+
+        /* disable factor in color combine, enable bias */
+        /* this can change the parameters output */
+
+        fbzcolorpath  = fbzcolorpath_orig;
+        fbzcolorpath &= ~( SST_ENTEXTUREMAP |
+                           SST_RGBSELECT |
+                           SST_LOCALSELECT |
+                           SST_CC_ZERO_OTHER |
+                           SST_CC_SUB_CLOCAL |
+                           SST_CC_MSELECT |
+                           SST_CC_REVERSE_BLEND |
+                           SST_CC_ADD_CLOCAL |
+                           SST_CC_ADD_ALOCAL |
+                           SST_CC_INVERT_OUTPUT |
+                           SST_CC_REVERSE_BLEND );
+
+#if 0
+        /* xxx the following doesn't work anymore! */
+
+        switch ( gc->state.cc_fnc )
+        {
+        case GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_ADD_ITALPHA:
+          fbzcolorpath |= SST_CC_ADD_ALOCAL | SST_CC_ZERO_OTHER;
+          break;
+
+          /* unimplemented in Glide */
+        case GR_COLORCOMBINE_TEXTURE_TIMES_ITALPHA_ADD_ITRGB:
+          fbzcolorpath |= SST_CC_ADD_CLOCAL | SST_CC_ZERO_OTHER;
+          break;
+
+        case GR_COLORCOMBINE_TEXTURE_ADD_ITRGB:
+          fbzcolorpath |= SST_CC_ADD_CLOCAL | SST_CC_ZERO_OTHER;
+          break;
+
+        case GR_COLORCOMBINE_TEXTURE_SUB_ITRGB:
+          /* Can't do this on SST1, can't subtract in alpha blender */
+          GrErrorCallback( "guDrawTriangleM:  GR_COLORCOMBINE_TEXTURE_SUB_ITRGB does not work with GR_MPTEXTURECOMBINE_MULTIPLY.", FXFALSE );
+          fbzcolorpath |= SST_CC_ZERO_OTHER;
+          break;
+
+        case GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA:
+          fbzcolorpath |= SST_CC_ZERO_OTHER;
+          break;
+
+        case GR_COLORCOMBINE_DIFF_SPEC_A:
+          fbzcolorpath |= SST_CC_ADD_CLOCAL;
+          break;
+
+        case GR_COLORCOMBINE_DIFF_SPEC_B:
+          fbzcolorpath |= SST_CC_ADD_ALOCAL;
+          break;
+        }
+#endif
+        GR_CHECK_SIZE_SLOPPY();
+
+        /* render third pass */
+        grDrawTriangle( a, b, c );
+      }
+
+      GR_SET_EXPECTED_SIZE(16);
+
+      /* restore alpha blending state */
+      GR_SET( hw->alphaMode, alphamode_orig );
+
+      /* restore depth buffer state */
+      if ( gc->state.fbi_config.fbzMode & SST_ENDEPTHBUFFER ) {
+        GR_SET( hw->fbzMode, fbzmode_orig );
+      }
+
+      /* restore fog state */
+      if ( gc->state.fbi_config.fogMode & SST_ENFOGGING ) {
+        GR_SET( hw->fogMode, fogmode_orig );
+      }
+
+      /* restore ccu/acu state */
+      GR_SET( hw->fbzColorPath, fbzcolorpath_orig );
+
+      goto all_done;
+    }
+
+    else if ( _gumpState.tc_fnc == GR_MPTEXTURECOMBINE_SUBTRACT )
+    {
+      GrErrorCallback( "gumpDrawTriangle:  GR_MPTEXCOMBINE_SUBTRACT not implemented", FXFALSE );
+      goto all_done;
+    }
+  }
+all_done:
+  GR_END_SLOPPY();
+}
Index: trunk/src/opengl/glide/sst1/glide/diglide.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/diglide.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/diglide.c	(revision 2885)
@@ -0,0 +1,349 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/diglide.c,v 1.1 2000-02-25 00:31:09 sandervl Exp $
+** $Log: diglide.c,v $
+** Revision 1.1  2000-02-25 00:31:09  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 10    6/18/97 5:54p Dow
+ * P6 adjustments
+ * 
+ * 9     3/13/97 2:51a Jdt
+ * Removed splash from grGlideInit().
+ * 
+ * 8     3/09/97 10:31a Dow
+ * Added GR_DIENTRY for di glide functions
+ * 
+ * 7     2/12/97 2:09p Hanson
+ * Hopefully removed the rest of my muckage. 
+ * 
+ * 6     2/12/97 11:25a Hanson
+ * 
+ * 5     1/18/97 11:38p Dow
+ * Removed _curGCFuncs Global (moved into _GlideRoot)
+ * 
+ * 4     1/16/97 3:37p Dow
+ * Added _curGCFuncs global
+ * 
+ * 3     1/14/97 10:44a Dow
+ * Modified grGlideInit to only call sstopen if splash screen is going to
+ * happen && HW != SST96
+ * 
+ * 2     1/09/97 10:50a Dow
+ * disabled splash screen for sst-96
+ * 
+ * 1     12/23/96 1:39p Dow
+ * Changes for multiplatform
+ * 
+ * 32    11/17/96 11:16p Garymct
+ * Updated grSplash code to set all of the necessary state itself rather
+ * than expecting the caller to do so.
+ * 
+ * 31    11/18/96 1:37a Tarolli
+ * fixed grAlphaBlendFunction warning bug
+ * 
+ * 29    11/15/96 3:40p Jdt
+ * Fixed SST-96 build.
+ * 
+ * 28    11/15/96 3:24p Tarolli
+ * renamed version.h to rcver.h ,  added some alpha blend function
+ * checking
+**
+*/
+
+#include <string.h>
+#include <3dfx.h>
+#include <glidesys.h>
+
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+#include <init.h>
+#endif
+
+#include "rcver.h"
+static char glideIdent[] = "@#%" VERSIONSTR ;
+
+/* the root of all EVIL */
+struct _GlideRoot_s /* GR_CDECL */ _GlideRoot;
+/* This is global to speed up the function call wrappers */
+
+/*---------------------------------------------------------------------------
+**
+*/
+void
+_grDisplayStats(void)
+{
+    int frames = _GlideRoot.stats.bufferSwaps;
+
+    if (frames <= 0) frames = 1;
+    gdbg_info(80,"GLIDE STATISTICS:                       fifo spins: %7d\n",
+                   _GlideRoot.stats.fifoSpins);
+    gdbg_info(80,"     triangles processed: %7d       tris drawn: %7d\n",
+                   _GlideRoot.stats.trisProcessed,
+                   _GlideRoot.stats.trisDrawn);
+    gdbg_info(80,"            buffer swaps: %7d       tris/frame: %7d , %d\n",
+                   _GlideRoot.stats.bufferSwaps,
+                   _GlideRoot.stats.trisProcessed/frames,
+                   _GlideRoot.stats.trisDrawn/frames);
+    gdbg_info(80,"                  points: %7d       pnts/frame: %7d\n",
+                   _GlideRoot.stats.pointsDrawn,
+                   _GlideRoot.stats.pointsDrawn/frames);
+    gdbg_info(80,"                   lines: %7d      lines/frame: %7d\n",
+                   _GlideRoot.stats.linesDrawn,
+                   _GlideRoot.stats.linesDrawn/frames);
+    gdbg_info(80,"       texture downloads: %7d    texture bytes: %7d\n",
+                   _GlideRoot.stats.texDownloads,  _GlideRoot.stats.texBytes);
+    gdbg_info(80,"       palette downloads: %7d    palette bytes: %7d\n",
+                   _GlideRoot.stats.palDownloads, _GlideRoot.stats.palBytes);
+#ifdef GLIDE_DEBUG
+    /* these stats are only kept in debugging mode */
+    gdbg_info(80,"       Min PCI FIFO free: 0x%04x (%d)\n",
+                  _GlideRoot.stats.minPciFIFOFree, _GlideRoot.stats.minPciFIFOFree );
+    gdbg_info(80,"    Min Memory FIFO free: 0x%04x (%d)\n",
+                  _GlideRoot.stats.minMemFIFOFree, _GlideRoot.stats.minMemFIFOFree);
+#endif
+}
+/*
+** fifoFree is kept in bytes, each fifo entry is 8 bytes, but since there
+** are headers involved, we assume an average of 2 registers per 8 bytes
+** or 4 bytes of registers stored in every fifo entry
+*/
+void
+_grReCacheFifo( FxI32 n )
+{
+  GR_DCL_GC;
+  gc->state.fifoFree = ((grSstStatus() >> SST_MEMFIFOLEVEL_SHIFT) & 0xffff)<<2;
+  gc->state.fifoFree -= gc->hwDep.sst1Dep.swFifoLWM + n;
+}
+
+FxI32 GR_CDECL
+_grSpinFifo( FxI32 n )
+{
+  GR_DCL_GC;
+  do {
+    _GlideRoot.stats.fifoSpins++;
+    _grReCacheFifo( n );
+  } while (gc->state.fifoFree < 0);
+  return gc->state.fifoFree;
+}
+
+/*---------------------------------------------------------------------------
+** No Comment
+*/
+#ifdef GLIDE_DEBUG
+FxBool
+_grCanSupportDepthBuffer( void )
+{
+  GR_DCL_GC;
+  if ( gc->state.screen_height == 640 ) {
+    if ( gc->fbuf_size == 1 ) {
+      return FXFALSE;
+    }
+  } else if ( gc->state.screen_width == 800 ) {
+    if ( ( gc->fbuf_size == 1 ) ||
+        ( gc->fbuf_size == 2 ) ) {
+      return FXFALSE;
+    }
+  }
+  return FXTRUE;
+} /* _grCanSupportDepthBuffer */
+#endif
+
+/*---------------------------------------------------------------------------
+**
+*/
+void 
+_grSwizzleColor( GrColor_t *color )
+{
+  GR_DCL_GC;
+  unsigned long red, green, blue, alpha;
+  
+  switch( gc->state.color_format ) {
+  case GR_COLORFORMAT_ARGB:
+    break;
+  case GR_COLORFORMAT_ABGR:
+    blue = *color & 0x00ff;
+    red = ( *color >> 16 ) & 0xff;
+    *color &= 0xff00ff00;
+    *color |= ( blue << 16 );
+    *color |= red;
+    break;
+  case GR_COLORFORMAT_RGBA:
+    red    = ( *color & 0x0000ff00 ) >> 8;
+    green  = ( *color & 0x00ff0000 ) >> 16;
+    blue   = ( *color & 0xff000000 ) >> 24;
+    alpha  = ( *color & 0x000000ff );
+    *color = ( alpha << 24 ) | ( blue << 16 ) | ( green << 8 ) | red;
+    break;
+  case GR_COLORFORMAT_BGRA:
+    red    = ( *color & 0xff000000 ) >> 24;
+    green  = ( *color & 0x00ff0000 ) >> 16;
+    blue   = ( *color & 0x0000ff00 ) >> 8;
+    alpha  = ( *color & 0x000000ff );
+    *color = ( alpha << 24 ) | ( blue << 16 ) | ( green << 8 ) | red;
+    break;
+  }
+} /* _grSwizzleColor */
+
+/*---------------------------------------------------------------------------
+** grGlideGetVersion
+** NOTE: allow this to be called before grGlideInit()
+*/
+GR_DIENTRY(grGlideGetVersion, void, ( char version[80] ))
+{
+  GDBG_INFO((87,"grGlideGetVersion(0x%x) => \"%s\"\n",version,glideIdent+3));
+  GR_ASSERT(version != NULL);
+  strcpy(version,glideIdent+3);
+} /* grGlideGetVersion */
+
+/*---------------------------------------------------------------------------
+** grGlideGetState
+*/
+GR_DIENTRY(grGlideGetState, void, ( GrState *state ))
+{
+  GR_BEGIN_NOFIFOCHECK("grGlideGetState",87);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x)\n",state));
+  GR_ASSERT(state != NULL);
+  *state = gc->state;
+  GR_END();
+} /* grGlideGetState */
+
+/*---------------------------------------------------------------------------
+** grHints
+*/
+GR_DIENTRY(grHints, void, (GrHint_t hintType, FxU32 hints))
+{
+  extern void _single_precision_asm(void);
+  extern void _double_precision_asm(void);
+  GR_BEGIN_NOFIFOCHECK("grHints",85);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x)\n",hintType,hints));
+
+  switch (hintType) {
+    case GR_HINT_STWHINT:
+      if (gc->state.paramHints != hints) {
+        gc->state.paramHints = hints;
+        _grUpdateParamIndex();
+      }
+      break;
+    case GR_HINT_FIFOCHECKHINT:
+      if (hints) {
+        gc->state.checkFifo = FXTRUE;
+        /* swFifoLWM is kept internally in bytes, hints are in fifo
+           entries */ 
+        if (_GlideRoot.environment.swFifoLWM >= 0)
+          gc->hwDep.sst1Dep.swFifoLWM =
+            _GlideRoot.environment.swFifoLWM << 2;
+        else
+          gc->hwDep.sst1Dep.swFifoLWM = (hints & 0xffff) << 2;
+
+      } else
+        gc->state.checkFifo = FXFALSE;
+      break;
+    case GR_HINT_FPUPRECISION:
+      hints ? _double_precision_asm() : _single_precision_asm();
+      break;
+    case GR_HINT_ALLOW_MIPMAP_DITHER:
+      gc->state.allowLODdither = hints;
+      break;
+    default:
+      GR_CHECK_F( myName, 1, "invalid hints type" );
+  }
+  GR_END();
+} /* grHints */
+
+/*---------------------------------------------------------------------------
+** grGlideInit
+*/
+GR_DIENTRY(grGlideInit, void, ( void ))
+{
+  GDBG_INIT();
+  
+  GDBG_INFO((80,"grGlideInit()\n"));
+  _GlideInitEnvironment();                      /* the main init code */
+  FXUNUSED(*glideIdent);
+
+  grResetTriStats();
+  GDBG_INFO((281,"grGlideInit --done---------------------------------------\n"));
+} /* grGlideInit */
+
+
+/*---------------------------------------------------------------------------
+**  grGlideShamelessPlug - grGlideShamelessPlug
+**
+**  Returns:
+**
+**  Notes:
+**
+*/
+GR_DIENTRY(grGlideShamelessPlug, void, ( const FxBool mode ))
+{
+  GDBG_INFO((80,"grGlideShamelessPlug(%d)\n",mode));
+  _GlideRoot.environment.shamelessPlug = mode;
+} /* grGlideShamelessPlug */
+
+
+
+/*---------------------------------------------------------------------------
+**  grResetTriStats - Set triangle counters to zero.
+*/
+GR_DIENTRY(grResetTriStats, void, ( void ))
+{
+  GDBG_INFO((80,"grResetTriStats()\n"));
+  _GlideRoot.stats.fifoSpins = 0;
+  _GlideRoot.stats.bufferSwaps = 0;
+  _GlideRoot.stats.linesDrawn = 0;
+  _GlideRoot.stats.trisProcessed = 0;
+  _GlideRoot.stats.trisDrawn = 0;
+  _GlideRoot.stats.texDownloads = 0;
+  _GlideRoot.stats.texBytes = 0;
+  _GlideRoot.stats.palDownloads = 0;
+  _GlideRoot.stats.palBytes = 0;
+} /* grResetTriStats */
+
+
+/*---------------------------------------------------------------------------
+**  grResetTriStats - Set triangle counters to zero.
+*/
+GR_DIENTRY(grTriStats, void, ( FxU32 *trisProcessed, FxU32 *trisDrawn ))
+{
+  GDBG_INFO((80,"grTriStats() => %d %d\n",
+                _GlideRoot.stats.trisProcessed,
+                _GlideRoot.stats.trisDrawn));
+  *trisProcessed = _GlideRoot.stats.trisProcessed;
+  *trisDrawn = _GlideRoot.stats.trisDrawn;
+} /* grTriStats */
+
+void GR_CDECL
+_grFence( void )
+{
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+  GR_DCL_GC;
+  GDBG_INFO((125,"\t\t\t\t%d writes since last fence\n",
+             gc->hwDep.sst96Dep.writesSinceFence));
+#endif
+  GDBG_INFO((125,"\t\t\t\t\t\t\tFENCE\n"));
+
+  P6FENCE;
+}
Index: trunk/src/opengl/glide/sst1/glide/digutex.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/digutex.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/digutex.c	(revision 2885)
@@ -0,0 +1,565 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/digutex.c,v 1.1 2000-02-25 00:31:10 sandervl Exp $
+** $Log: digutex.c,v $
+** Revision 1.1  2000-02-25 00:31:10  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 5     8/14/97 7:02p Pgj
+ * per GMT
+ * 
+ * 4     5/05/97 4:24p Pgj
+ * Neuter guTexDownloadMipMap error message
+ * 
+ * 3     3/18/97 9:07p Dow
+ * Got rid of #$#%#$ // comments
+ * 
+ * 2     3/09/97 10:31a Dow
+ * Added GR_DIENTRY for di glide functions
+ * 
+ * 1     12/23/96 1:39p Dow
+ * Changes for multiplatform
+**
+*/
+
+#include <string.h>
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+/* externals from ditex.c */
+extern FxU32 _grMipMapHostSize[][16];
+extern FxU32 _gr_aspect_index_table[];
+extern FxU32 _gr_aspect_xlate_table[];
+extern FxU32 _gr_evenOdd_xlate_table[];
+
+
+/*---------------------------------------------------------------------------
+** guTexAllocateMemory
+*/
+GR_DIENTRY(guTexAllocateMemory, GrMipMapId_t, ( GrChipID_t tmu,
+                    FxU8 odd_even_mask,
+                    int width, int height,
+                    GrTextureFormat_t format,
+                    GrMipMapMode_t mipmap_mode,
+                    GrLOD_t small_lod, GrLOD_t large_lod,
+                    GrAspectRatio_t aspect_ratio,
+                    GrTextureClampMode_t s_clamp_mode,
+                    GrTextureClampMode_t t_clamp_mode,
+                    GrTextureFilterMode_t minfilter_mode,
+                    GrTextureFilterMode_t magfilter_mode,
+                    float lod_bias,
+                    FxBool trilinear
+                    ))
+{
+  FxU32
+    memrequired,
+    memavail,
+    baseAddress,
+    tLod,
+    texturemode,
+    filterMode,                 /* filter mode bits */
+    clampMode;                  /* clamp mode bits */
+
+  GrMipMapId_t
+    mmid = (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE;
+  int
+    int_lod_bias;
+  GrTexInfo info;
+
+  GR_BEGIN_NOFIFOCHECK("guTexAllocateMemory",99);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d, %d,%d, %d,%d, %d,%d,%d, %d,%d, %d,%d)\n",
+                tmu,odd_even_mask,width,height,format,mipmap_mode,
+                small_lod,large_lod,aspect_ratio,
+                s_clamp_mode,t_clamp_mode, minfilter_mode,magfilter_mode));
+  /*
+   ** The constants are actually reverse of each other so the following
+   ** test IS valid!
+   */
+  GR_CHECK_F(myName, small_lod < large_lod, "smallest_lod is larger than large_lod");
+  
+  info.smallLod = small_lod;
+  info.largeLod = large_lod;
+  info.aspectRatio = aspect_ratio;
+  info.format = format;
+  memrequired = grTexTextureMemRequired(odd_even_mask, &info);
+
+  /*
+   ** Make sure to not cross 2 MByte texture boundry
+   */
+  if ((gc->tmu_state[tmu].freemem_base < 0x200000) &&
+    (gc->tmu_state[tmu].freemem_base + memrequired > 0x200000))
+    gc->tmu_state[tmu].freemem_base = 0x200000;
+  
+  /*
+   ** If we have enough memory and a free mip map handle then go for it
+   */
+  memavail = guTexMemQueryAvail( tmu );
+  
+  if ( memavail < memrequired )
+    return (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE;
+  
+  if (gc->mm_table.free_mmid >= MAX_MIPMAPS_PER_SST )
+    return (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE;
+  
+  /*
+   ** Allocate the mip map id
+   */
+  mmid = gc->mm_table.free_mmid++;
+
+  /*
+   ** calculate baseAddress (where LOD 0 would go)
+   */
+  baseAddress = _grTexCalcBaseAddress( gc->tmu_state[tmu].freemem_base, 
+                                       large_lod, 
+                                       aspect_ratio, 
+                                       format, 
+                                       odd_even_mask );
+
+  GDBG_INFO((gc->myLevel,"  baseAddress = 0x%x (in bytes)\n",baseAddress));
+  
+  /*
+   ** reduce available memory to reflect allocation
+   */
+  gc->tmu_state[tmu].freemem_base += memrequired;
+
+  /*
+   ** Create the tLOD register value for this mip map
+   */
+  int_lod_bias = _grTexFloatLODToFixedLOD( lod_bias );
+  tLod = mipmap_mode==GR_MIPMAP_DISABLE ? large_lod : small_lod;
+  tLod = SST_TLOD_MINMAX_INT(large_lod,tLod);
+  tLod |= _gr_evenOdd_xlate_table[odd_even_mask];
+  tLod |= _gr_aspect_xlate_table[aspect_ratio];
+  tLod |= int_lod_bias << SST_LODBIAS_SHIFT;
+  filterMode = (
+                (minfilter_mode == GR_TEXTUREFILTER_BILINEAR ? SST_TMINFILTER : 0) |
+                (magfilter_mode == GR_TEXTUREFILTER_BILINEAR ? SST_TMAGFILTER : 0)
+                );
+  
+  clampMode = (
+               (s_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPS : 0) |
+               (t_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPT : 0)
+               );  
+  
+  /*
+   ** Create the tTextureMode register value for this mip map
+   */
+  texturemode  = ( format << SST_TFORMAT_SHIFT );
+  texturemode |= SST_TCLAMPW;
+  texturemode |= SST_TPERSP_ST;
+  texturemode |= filterMode;
+  texturemode |= clampMode;
+  
+  if ( mipmap_mode == GR_MIPMAP_NEAREST_DITHER )
+    texturemode |= SST_TLODDITHER;
+  
+  if ( trilinear ) {
+      texturemode |= SST_TRILINEAR;
+
+      if ( odd_even_mask & GR_MIPMAPLEVELMASK_ODD )
+        tLod |= SST_LOD_ODD;
+
+      if ( odd_even_mask != GR_MIPMAPLEVELMASK_BOTH )
+        tLod |= SST_LOD_TSPLIT;
+  }
+  
+  /*
+   ** Fill in the mm_table data for this mip map
+   */
+  gc->mm_table.data[mmid].format         = format;
+  gc->mm_table.data[mmid].mipmap_mode    = mipmap_mode;
+  gc->mm_table.data[mmid].magfilter_mode = magfilter_mode;
+  gc->mm_table.data[mmid].minfilter_mode = minfilter_mode;
+  gc->mm_table.data[mmid].s_clamp_mode   = s_clamp_mode;
+  gc->mm_table.data[mmid].t_clamp_mode   = t_clamp_mode;
+  gc->mm_table.data[mmid].tLOD           = tLod;
+  gc->mm_table.data[mmid].tTextureMode   = texturemode;
+  gc->mm_table.data[mmid].lod_bias       = int_lod_bias;
+  gc->mm_table.data[mmid].lod_min        = small_lod;
+  gc->mm_table.data[mmid].lod_max        = large_lod;
+  gc->mm_table.data[mmid].tmu            = tmu;
+  gc->mm_table.data[mmid].odd_even_mask  = odd_even_mask;
+  gc->mm_table.data[mmid].tmu_base_address = baseAddress;
+  gc->mm_table.data[mmid].trilinear      = trilinear;
+  gc->mm_table.data[mmid].aspect_ratio   = aspect_ratio;
+  gc->mm_table.data[mmid].data           = 0;
+  /*   gc->mm_table.data[mmid].ncc_table      = 0; */
+  gc->mm_table.data[mmid].sst            = _GlideRoot.current_sst;
+  gc->mm_table.data[mmid].valid          = FXTRUE;
+  gc->mm_table.data[mmid].width          = width;
+  gc->mm_table.data[mmid].height         = height;
+  
+  GR_RETURN(mmid);
+} /* guTexAllocateMemory */
+
+static void
+_guTexRebuildRegisterShadows( GrMipMapId_t mmid )
+{
+  GR_DCL_GC;
+  GrMipMapInfo *mminfo = &gc->mm_table.data[mmid];
+  int texturemode      = 0;
+  int tLod             = 0;
+  FxU32 
+    filterMode,                 /* filter mode bits of texturemode */
+    clampMode;                  /* clamp mode bits of texturemode */
+
+  /* build filterMode */
+  filterMode = (
+                (mminfo->minfilter_mode == GR_TEXTUREFILTER_BILINEAR ? SST_TMINFILTER : 0) |
+                (mminfo->magfilter_mode == GR_TEXTUREFILTER_BILINEAR ? SST_TMAGFILTER : 0)
+                );
+  clampMode = (
+               (mminfo->s_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPS : 0) |
+               (mminfo->t_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPT : 0)
+               );
+   
+  /*
+   ** build up tTextureMode
+   */
+  texturemode |= ( mminfo->format << SST_TFORMAT_SHIFT );
+  texturemode |= SST_TCLAMPW;
+  texturemode |= SST_TPERSP_ST;
+  texturemode |= filterMode;
+  texturemode |= clampMode;
+
+  if ( mminfo->mipmap_mode == GR_MIPMAP_NEAREST_DITHER )
+    texturemode |= SST_TLODDITHER;
+
+  if ( mminfo->trilinear )
+    texturemode |= SST_TRILINEAR;
+
+  /*
+   ** build up tLOD
+   */
+  tLod = mminfo->mipmap_mode == GR_MIPMAP_DISABLE ? mminfo->lod_max : mminfo->lod_min;
+  tLod = SST_TLOD_MINMAX_INT(mminfo->lod_max,tLod);
+  tLod |= _gr_evenOdd_xlate_table[mminfo->odd_even_mask];
+  tLod |= _gr_aspect_xlate_table[mminfo->aspect_ratio];
+  tLod |= mminfo->lod_bias << SST_LODBIAS_SHIFT;
+
+  /*
+   ** assign them
+   */
+  mminfo->tTextureMode = texturemode;
+  mminfo->tLOD         = tLod;
+} /* guTexRebuildRegisterShadows */
+
+
+/*---------------------------------------------------------------------------
+**  guTexChangeAttributes 
+*/
+GR_DIENTRY(guTexChangeAttributes, FxBool, ( GrMipMapId_t mmid,
+                      int width, int height,
+                      GrTextureFormat_t fmt,
+                      GrMipMapMode_t mm_mode,
+                      GrLOD_t smallest_lod, GrLOD_t largest_lod,
+                      GrAspectRatio_t aspect,
+                      GrTextureClampMode_t s_clamp_mode,
+                      GrTextureClampMode_t t_clamp_mode,
+                      GrTextureFilterMode_t minFilterMode,
+                      GrTextureFilterMode_t magFilterMode
+                      ))
+{
+  GrMipMapInfo *mminfo;
+
+  GR_BEGIN_NOFIFOCHECK("guTexChangeAttributes",88);
+  GDBG_INFO_MORE((gc->myLevel,"(%d, %d,%d, %d,%d, %d,%d,%d, %d,%d, %d,%d)\n",
+                mmid,width,height,fmt,mm_mode,
+                smallest_lod,largest_lod,aspect,
+                s_clamp_mode,t_clamp_mode, minFilterMode,magFilterMode));
+  /*
+  ** Make sure that mmid is not NULL
+  */
+  if ( mmid == GR_NULL_MIPMAP_HANDLE ) {
+    GR_RETURN(FXFALSE);
+  }
+
+  mminfo = &gc->mm_table.data[mmid];
+
+  /*
+  ** Fill in the mm_table data for this mip map
+  */
+  if ( fmt != -1 )
+     mminfo->format         = fmt;
+
+  if ( mm_mode != -1 )
+     mminfo->mipmap_mode    = mm_mode;
+
+  if ( smallest_lod != -1 )
+     mminfo->lod_min        = smallest_lod;
+  if ( largest_lod != -1 )
+     mminfo->lod_max        = largest_lod;
+  if ( minFilterMode != -1 )
+     mminfo->minfilter_mode = minFilterMode;
+  if ( magFilterMode != -1 )
+     mminfo->magfilter_mode = magFilterMode;
+  if ( s_clamp_mode != -1 )
+     mminfo->s_clamp_mode   = s_clamp_mode;
+  if ( t_clamp_mode != -1 )
+     mminfo->t_clamp_mode   = t_clamp_mode;
+  if ( aspect != -1 )
+     mminfo->aspect_ratio   = aspect;
+  if ( width != -1 )
+     mminfo->width          = width;
+  if ( height != -1 )
+     mminfo->height         = height;
+
+  _guTexRebuildRegisterShadows( mmid );
+  GR_RETURN(FXTRUE);
+} /* guTexChangeAttributes */
+
+/*---------------------------------------------------------------------------
+** grTexCombineFunction - obsolete
+**                              
+*/
+GR_DIENTRY(grTexCombineFunction, void,
+           (GrChipID_t tmu, GrTextureCombineFnc_t tc)) 
+{
+  guTexCombineFunction( tmu, tc );
+}
+
+/*---------------------------------------------------------------------------
+** guTexCombineFunction
+**                              
+** Sets the texture combine function.  For a dual TMU system this function
+** will configure the TEXTUREMODE registers as appropriate.  For a
+** single TMU system this function will configure TEXTUREMODE if
+** possible, or defer operations until grDrawTriangle() is called.
+*/
+GR_DIENTRY(guTexCombineFunction, void,
+           (GrChipID_t tmu, GrTextureCombineFnc_t tc))
+{
+  GDBG_INFO((99,"guTexCombineFunction(%d,%d)\n",tmu,tc));
+  switch ( tc )  {
+  case GR_TEXTURECOMBINE_ZERO:
+    grTexCombine( tmu, GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE,
+                  GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE );
+    break;
+
+  case GR_TEXTURECOMBINE_DECAL:
+    grTexCombine( tmu, GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
+                  GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE );
+    break;
+
+  case GR_TEXTURECOMBINE_ONE:
+    grTexCombine( tmu, GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE,
+                  GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE, FXTRUE, FXTRUE );
+    break;
+
+  case GR_TEXTURECOMBINE_ADD:
+    grTexCombine( tmu, GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, GR_COMBINE_FACTOR_ONE,
+                  GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, GR_COMBINE_FACTOR_ONE, FXFALSE, FXFALSE );
+    break;
+
+  case GR_TEXTURECOMBINE_MULTIPLY:
+    grTexCombine( tmu, GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_LOCAL,
+                  GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_LOCAL, FXFALSE, FXFALSE );
+    break;
+
+  case GR_TEXTURECOMBINE_DETAIL:
+    grTexCombine( tmu, GR_COMBINE_FUNCTION_BLEND, GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR,
+                  GR_COMBINE_FUNCTION_BLEND, GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR, FXFALSE, FXFALSE );
+    break;
+
+  case GR_TEXTURECOMBINE_DETAIL_OTHER:
+    grTexCombine( tmu, GR_COMBINE_FUNCTION_BLEND, GR_COMBINE_FACTOR_DETAIL_FACTOR,
+                  GR_COMBINE_FUNCTION_BLEND, GR_COMBINE_FACTOR_DETAIL_FACTOR, FXFALSE, FXFALSE );
+    break;
+
+  case GR_TEXTURECOMBINE_TRILINEAR_ODD:
+    grTexCombine( tmu, GR_COMBINE_FUNCTION_BLEND, GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION,
+                  GR_COMBINE_FUNCTION_BLEND, GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION, FXFALSE, FXFALSE );
+    break;
+
+  case GR_TEXTURECOMBINE_TRILINEAR_EVEN:
+    grTexCombine( tmu, GR_COMBINE_FUNCTION_BLEND, GR_COMBINE_FACTOR_LOD_FRACTION,
+                  GR_COMBINE_FUNCTION_BLEND, GR_COMBINE_FACTOR_LOD_FRACTION, FXFALSE, FXFALSE );
+    break;
+
+  case GR_TEXTURECOMBINE_SUBTRACT:
+    grTexCombine( tmu, GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL, GR_COMBINE_FACTOR_ONE,
+                  GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL, GR_COMBINE_FACTOR_ONE, FXFALSE, FXFALSE );
+    break;
+
+  case GR_TEXTURECOMBINE_OTHER:
+    grTexCombine( tmu, GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_ONE,
+                  GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_ONE, FXFALSE, FXFALSE );
+    break;
+
+  default:
+    GrErrorCallback( "guTexCombineFunction:  Unsupported function", FXTRUE );
+    break;
+  }
+} /* guTexCombineFunction */
+
+/*---------------------------------------------------------------------------
+** guTexDownloadMipMap
+**
+** Downloads a mip map (previously allocated with guTexAllocateMemory) to
+** the hardware using the given data and ncctble.  The "data" is assumed
+** to be in row major order from largest mip map to smallest mip map.
+*/
+GR_DIENTRY(guTexDownloadMipMap, void, 
+           (GrMipMapId_t mmid, const void *src, const GuNccTable
+            *ncc_table ) )
+{
+  GR_DCL_GC;
+  GrLOD_t     lod;
+  const void *ptr = src;
+
+  GDBG_INFO((99,"guTexDownloadMipMap(%d,0x%x,0x%x)\n",mmid,src,ncc_table));
+  GR_ASSERT(gc != NULL);
+  GR_ASSERT(src != NULL);
+  GR_CHECK_F("guTexDownloadMipMap",
+              ( mmid == GR_NULL_MIPMAP_HANDLE ) || ( mmid >= gc->mm_table.free_mmid ),
+              "invalid mip map handle passed");
+
+#if 0 /* Fixme!!! XXX ??? */
+  GR_CHECK_F("guTexDownloadMipMap",
+              gc->mm_table.data[mmid].format == GR_TEXFMT_P_8,
+              "guTex* does not support palletted textures - use grTex* instead");
+#endif /* 0 */
+
+  /*
+  ** Bind data and ncc table to this mip map
+  */
+  gc->mm_table.data[mmid].data      = (void *) ptr;
+  if (gc->mm_table.data[mmid].format == GR_TEXFMT_YIQ_422 ||
+      gc->mm_table.data[mmid].format == GR_TEXFMT_AYIQ_8422) {
+    gc->mm_table.data[mmid].ncc_table = *ncc_table;
+  }
+
+  /*
+  ** Start downloading mip map levels, note that ptr is updated by the caller
+  */
+  for ( lod = gc->mm_table.data[mmid].lod_max; lod <= gc->mm_table.data[mmid].lod_min; lod++ ) {
+     guTexDownloadMipMapLevel( mmid, lod, &ptr );
+  }
+} /* guTexDownloadMipMap */
+
+/*---------------------------------------------------------------------------
+** guTexDownloadMipMapLevel
+**
+** Downloads a single mip map level to a mip map.  "src" is considered to be
+** row major data of the correct aspect ratio and format.
+*/
+GR_DIENTRY(guTexDownloadMipMapLevel, void,
+           (GrMipMapId_t mmid, GrLOD_t lod,
+            const void **src_base))
+{
+  FxU32 i;
+  const  GrMipMapInfo *mminfo;
+  GR_DCL_GC;
+ 
+  GDBG_INFO((99,"guTexDownloadMipMapLevel(%d,%d,0x%x)\n",mmid,lod,src_base));
+  GR_ASSERT(src_base != NULL);
+  mminfo = &gc->mm_table.data[mmid];
+  GR_CHECK_F( "guTexDownloadMipMapLevel",
+              ( lod > mminfo->lod_min ) || ( lod < mminfo->lod_max ),
+              "specified lod is out of range");
+
+  /* GMT: replace with array access */
+  /* download this level */
+  i = _grTexCalcBaseAddress( 0,
+                            mminfo->lod_max,
+                            mminfo->aspect_ratio,
+                            mminfo->format,
+                            mminfo->odd_even_mask);
+  grTexDownloadMipMapLevel( mminfo->tmu,
+                            mminfo->tmu_base_address - i,
+                            lod,
+                            mminfo->lod_max,
+                            mminfo->aspect_ratio,
+                            mminfo->format,
+                            mminfo->odd_even_mask,
+                            (void *)*src_base );
+
+  /* update src_base to point to next mipmap level */
+  *src_base = (void *) (((FxU32)*src_base) +
+               (_grMipMapHostSize[_gr_aspect_index_table[mminfo->aspect_ratio]][lod]
+                    << (mminfo->format>=GR_TEXFMT_16BIT)));
+
+} /* guTexDownloadMipmapLevel */
+
+/*---------------------------------------------------------------------------
+** guTexGetCurrentMipMap
+*/
+GR_DIENTRY(guTexGetCurrentMipMap, GrMipMapId_t, ( GrChipID_t tmu ))
+{
+  GR_BEGIN_NOFIFOCHECK("guTexGetCurrentMipMap",99);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",tmu));
+  GR_CHECK_TMU( myName, tmu );
+
+  GR_RETURN(gc->state.current_mm[tmu]);
+} /* guTexGetCurrentMipMap */
+
+/*---------------------------------------------------------------------------
+** guTexGetMipMapInfo
+*/
+GR_DIENTRY(guTexGetMipMapInfo, GrMipMapInfo *, ( GrMipMapId_t mmid ))
+{
+  GR_BEGIN_NOFIFOCHECK("guTexGetMipMapInfo",99);
+  GDBG_INFO_MORE((gc->myLevel,"(%d) => 0x%x\n",mmid,&gc->mm_table.data[mmid]));
+  return &( gc->mm_table.data[mmid] );
+} /* guTexGetMipMapInfo */
+
+/*---------------------------------------------------------------------------
+** guTexMemQueryAvail
+**
+** returns the amount of available texture memory on a specified TMU.
+*/
+GR_DIENTRY(guTexMemQueryAvail, FxU32, ( GrChipID_t tmu ))
+{
+  GR_BEGIN_NOFIFOCHECK("guTexMemQueryAvail",99);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",tmu));
+  GR_CHECK_TMU( myName, tmu );
+  GR_RETURN(gc->tmu_state[tmu].total_mem - gc->tmu_state[tmu].freemem_base);
+} /* guTexQueryMemAvail */
+
+/*---------------------------------------------------------------------------
+** guTexMemReset
+**
+** Clears out texture buffer memory.
+*/
+GR_DIENTRY(guTexMemReset, void, ( void ))
+{
+  int i;
+  
+  GR_BEGIN_NOFIFOCHECK("guTexMemReset",99);
+  GDBG_INFO_MORE((gc->myLevel,"()\n"));
+
+  memset( gc->mm_table.data, 0, sizeof( gc->mm_table.data ) );
+  gc->mm_table.free_mmid = 0;
+  
+  for ( i = 0; i < gc->num_tmu; i++ ) {
+    gc->state.current_mm[i] = (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE;
+    gc->tmu_state[i].freemem_base = 0;
+    gc->tmu_state[i].ncc_mmids[0] = 
+      gc->tmu_state[i].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE;    
+    gc->tmu_state[i].ncc_table[0] = 
+      gc->tmu_state[i].ncc_table[1] = 0;
+  }
+  GR_END();
+} /* guTexMemReset */
+
Index: trunk/src/opengl/glide/sst1/glide/disst.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/disst.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/disst.c	(revision 2885)
@@ -0,0 +1,170 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/disst.c,v 1.1 2000-02-25 00:31:10 sandervl Exp $
+** $Log: disst.c,v $
+** Revision 1.1  2000-02-25 00:31:10  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 9     8/13/97 8:51a Pgj
+ * Fix Bug 710
+ * 
+ * 8     7/24/97 10:55a Dow
+ * Fixed bogus check in grSstQueryHardware
+ * 
+ * 7     5/02/97 2:07p Pgj
+ * grSstScreenWidth/Height now FxU32
+ * 
+ * 6     3/17/97 6:25a Jdt
+ * Added initDeviceSelect to grSstSelect()
+ * 
+ * 5     3/09/97 10:31a Dow
+ * Added GR_DIENTRY for di glide functions
+ * 
+ * 4     3/04/97 9:08p Dow
+ * Neutered multiplatform multiheaded monster
+ * 
+ * 3     1/18/97 11:39p Dow
+ * Changed location of _curGCFuncs
+ * 
+ * 2     1/16/97 3:39p Dow
+ * Added ref to _curGCFuncs during grSstSelect()
+ * 
+ * 1     12/23/96 1:39p Dow
+ * Changes for multiplatform
+**
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <3dfx.h>
+
+#include <glidesys.h>
+#include <sst1vid.h>
+
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+
+/*---------------------------------------------------------------------------
+** grSstQueryBoards
+**
+** NOTE:  it is OK to call this routine before grGlideInit
+*/
+GR_DIENTRY(grSstQueryBoards, FxBool, ( GrHwConfiguration *hwc ))
+{
+  GDBG_INFO((80,"grSstQueryBoards(0x%x)\n",hwc));
+
+  hwc->num_sst = initNumBoardsInSystem();
+  return FXTRUE;
+} /* grSstQueryBoards */
+
+/*---------------------------------------------------------------------------
+** grSstQueryHardware
+**
+*/
+GR_DIENTRY(grSstQueryHardware, FxBool, ( GrHwConfiguration *hwc ))
+{
+  FxBool retVal;
+
+  GDBG_INFO((80, "grSstQueryHardware\n"));
+  GDBG_INFO_MORE((80,"(0x%x)\n",hwc));
+
+  /* init and copy the data back to the user's structure */
+  retVal = _GlideRoot.hwConfig.num_sst > 0;
+  *hwc = _GlideRoot.hwConfig;
+
+  return(retVal);
+} /* grSstQueryHardware */
+
+/*---------------------------------------------------------------------------
+** grSstSelect
+*/
+GR_DIENTRY(grSstSelect, void, ( int which ))
+{
+  if ( which >= _GlideRoot.hwConfig.num_sst )
+    GrErrorCallback( "grSstSelect:  non-existent SST", FXTRUE );
+
+  _GlideRoot.current_sst = which;
+  _GlideRoot.curGC = &_GlideRoot.GCs[which];
+#ifdef GLIDE_MULTIPLATFORM
+  _GlideRoot.curGCFuncs = _GlideRoot.curGC->gcFuncs;
+#endif
+  /* now begin a normal Glide routine's flow */
+  {
+    GR_BEGIN_NOFIFOCHECK("grSstSelect",80);
+    GDBG_INFO_MORE((gc->myLevel,"(%d)\n",which));
+
+    _GlideRoot.packerFixAddress  = ( FxU32 ) gc->tex_ptr;
+    _GlideRoot.packerFixAddress += ( ( ( FxU32 ) 3 ) << 21 );
+    _GlideRoot.packerFixAddress += ( ( ( FxU32 ) 1 ) << 17 );
+
+    /* Now that we have selected a board, we can build the offests and register
+       lists for the  optimized triangle setup code */
+    _grRebuildDataList();
+
+    initDeviceSelect( which );
+
+    GR_END();
+  }
+} /* grSstSelect */
+
+/*---------------------------------------------------------------------------
+** grSstScreenWidth
+*/
+GR_DIENTRY(grSstScreenWidth, FxU32, (void))
+{
+  GR_DCL_GC;
+  GR_ASSERT(gc != NULL);
+  return gc->state.screen_width;
+} /* grSstScreenWidth */
+
+/*---------------------------------------------------------------------------
+** grSstScreenHeight
+*/
+GR_DIENTRY(grSstScreenHeight, FxU32,  (void))
+{
+  GR_DCL_GC;
+  GR_ASSERT(gc != NULL);
+  return gc->state.screen_height;
+}
+
+/*---------------------------------------------------------------------------
+**  grSstVidMode - override args to grSstOpen()
+*/
+GR_DIENTRY(grSstVidMode, void,
+           (FxU32 whichSst, sst1VideoTimingStruct *vidTimings))
+{
+  GDBG_INFO((80,"grSstVidMode(%d,0x%x)\n",whichSst,vidTimings));
+#ifdef GLIDE_DEBUG
+  if (whichSst >= MAX_NUM_SST) {
+    char errStr[1028];
+    sprintf(errStr, "grSstVidMode:  %d greater than MAX_NUM_SST (%d)\n",
+            whichSst, MAX_NUM_SST);
+
+    GrErrorCallback(errStr, FXTRUE);
+  }
+#endif
+
+  _GlideRoot.GCs[whichSst].vidTimings = vidTimings;    
+} /* grSstVidMode */
+
Index: trunk/src/opengl/glide/sst1/glide/ditex.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/ditex.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/ditex.c	(revision 2885)
@@ -0,0 +1,639 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/ditex.c,v 1.1 2000-02-25 00:31:10 sandervl Exp $
+** $Log: ditex.c,v $
+** Revision 1.1  2000-02-25 00:31:10  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 11    8/19/97 5:02p Atai
+ * delete the hack for 4MB texture memory
+ * 
+ * 10    8/14/97 6:45p Pgj
+ * Fixed bug per GMT
+ * 
+ * 9     8/11/97 3:56p Atai
+ * fixed error message
+ * 
+ * 8     8/11/97 1:39p Atai
+ * step 1: use environment variable to set up texture memory size
+ * 
+ * 7     7/18/97 6:46p Jdt
+ * Protected access to vgInfo structure
+ * 
+ * 6     3/15/97 8:09p Jdt
+ * Remove grTexDownloadTable from this file because I added SST-1 only
+ * code to it
+ * 
+ * 5     3/09/97 10:31a Dow
+ * Added GR_DIENTRY for di glide functions
+ * 
+ * 4     2/12/97 2:09p Hanson
+ * Hopefully removed the rest of my muckage. 
+ * 
+ * 3     2/12/97 12:34p Dow
+ * Fixed Hanson muckage
+ * 
+ * 2     1/18/97 11:41p Dow
+ * Fixed Gary's "Last C Bug" analog
+ * Fixed usage of _grMipMapOffset_Tsplit
+ * 
+ * 1     12/23/96 1:39p Dow
+ * Changes for multiplatform
+**
+*/
+
+#include <stdio.h>
+#include <3dfx.h>
+
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+FxU32 _gr_aspect_index_table[] =
+{
+   3,
+   2,
+   1,
+   0,
+   1,
+   2,
+   3,
+};
+
+/* size in texels  */
+FxU32 _grMipMapHostSize[4][16] = 
+{
+  {                             /* 1:1 aspect ratio */
+    65536,                      /* 0 : 256x256  */
+    16384,                      /* 1 : 128x128  */
+    4096,                       /* 2 :  64x64   */
+    1024,                       /* 3 :  32x32   */
+    256,                        /* 4 :  16x16   */
+    64,                         /* 5 :   8x8    */
+    16,                         /* 6 :   4x4    */
+    4,                          /* 7 :   2x2    */
+    1,                          /* 8 :   1x1    */
+  },
+  {                             /* 2:1 aspect ratio */
+    32768,                      /* 0 : 256x128  */
+    8192,                       /* 1 : 128x64   */
+    2048,                       /* 2 :  64x32   */
+    512,                        /* 3 :  32x16   */
+    128,                        /* 4 :  16x8    */
+    32,                         /* 5 :   8x4    */
+    8,                          /* 6 :   4x2    */
+    2,                          /* 7 :   2x1    */
+    1,                          /* 8 :   1x1    */
+  },
+  {                             /* 4:1 aspect ratio */
+    16384,                      /* 0 : 256x64   */
+    4096,                       /* 1 : 128x32   */
+    1024,                       /* 2 :  64x16   */
+    256,                        /* 3 :  32x8    */
+    64,                         /* 4 :  16x4    */
+    16,                         /* 5 :   8x2    */
+    4,                          /* 6 :   4x1    */
+    2,                          /* 7 :   2x1    */
+    1,                          /* 8 :   1x1    */
+  },
+  {                             /* 8:1 aspect ratio */
+    8192,                       /* 0 : 256x32   */
+    2048,                       /* 1 : 128x16   */
+    512,                        /* 2 :  64x8    */
+    128,                        /* 3 :  32x4    */
+    32,                         /* 4 :  16x2    */
+    8,                          /* 5 :   8x1    */
+    4,                          /* 6 :   4x1    */
+    2,                          /* 7 :   2x1    */
+    1,                          /* 8 :   1x1    */
+  }
+};
+
+const int _grMipMapHostWH[GR_ASPECT_1x8+1][GR_LOD_1+1][2] =
+{
+   { 
+     256 , 32, 
+     128 , 16, 
+     64  , 8, 
+     32  , 4, 
+     16  , 2, 
+     8   , 1, 
+     4   , 1, 
+     2   , 1, 
+     1   , 1 
+   },
+   { 
+     256 , 64, 
+     128 , 32, 
+     64  , 16, 
+     32  , 8, 
+     16  , 4, 
+     8   , 2,
+     4   , 1, 
+     2   , 1, 
+     1   , 1 
+   },
+   { 
+     256 , 128, 
+     128 , 64, 
+     64  , 32, 
+     32  , 16,
+     16  , 8,
+     8   , 4, 
+     4   , 2, 
+     2   , 1, 
+     1   , 1 
+   },
+   { 
+     256 , 256, 
+     128 , 128, 
+     64  , 64,
+     32  , 32,
+     16  , 16,
+     8   , 8, 
+     4   , 4, 
+     2   , 2, 
+     1   , 1 
+   },
+   { 
+     128, 256,
+     64,  128,
+     32,  64 ,
+     16,  32 ,
+     8,   16 , 
+     4,   8  , 
+     2,   4  , 
+     1,   2  , 
+     1,   1
+   },
+   {
+     64,  256,
+     32,  128,
+     16,  64 ,
+     8,   32 ,
+     4,   16 ,
+     2,   8  , 
+     1,   4  , 
+     1,   2  , 
+     1,   1
+   },
+   { 
+     32,  256,
+     16,  128,
+     8,   64 ,
+     4,   32 ,
+     2,   16 ,
+     1,   8  , 
+     1,   4  , 
+     1,   2  ,
+     1,   1
+   }
+};
+
+/* translates GR_ASPECT_* to bits for the TLOD register */
+FxU32 _gr_aspect_xlate_table[] =
+{
+   (3<< SST_LOD_ASPECT_SHIFT) | SST_LOD_S_IS_WIDER,
+   (2<< SST_LOD_ASPECT_SHIFT) | SST_LOD_S_IS_WIDER,
+   (1<< SST_LOD_ASPECT_SHIFT) | SST_LOD_S_IS_WIDER,
+    0<< SST_LOD_ASPECT_SHIFT,
+    1<< SST_LOD_ASPECT_SHIFT,
+    2<< SST_LOD_ASPECT_SHIFT,
+    3<< SST_LOD_ASPECT_SHIFT
+};
+
+FxU32 _gr_evenOdd_xlate_table[] = 
+{
+  0xFFFFFFFF,                      /* invalid */
+  SST_LOD_TSPLIT,                  /* even */
+  SST_LOD_TSPLIT | SST_LOD_ODD,    /* odd  */
+  0,                               /* both */
+};
+
+/* the size of each mipmap level in texels, 4 is the minimum no matter what */
+/* index is [aspect_ratio][lod]                                             */
+unsigned long _grMipMapSize[4][16] = {
+  {   /* 8:1 aspect ratio */
+    0x02000,        /* 0 : 256x32   */
+    0x00800,        /* 1 : 128x16   */
+    0x00200,        /* 2 :  64x8    */
+    0x00080,        /* 3 :  32x4    */
+    0x00020,        /* 4 :  16x2    */
+    0x00010,        /* 5 :   8x1    */
+    0x00008,        /* 6 :   4x1    */
+    0x00004,        /* 7 :   2x1    */
+    0x00004,        /* 8 :   1x1    */
+  },
+  {   /* 4:1 aspect ratio */
+    0x04000,        /* 0 : 256x64   */
+    0x01000,        /* 1 : 128x32   */
+    0x00400,        /* 2 :  64x16   */
+    0x00100,        /* 3 :  32x8    */
+    0x00040,        /* 4 :  16x4    */
+    0x00010,        /* 5 :   8x2    */
+    0x00008,        /* 6 :   4x1    */
+    0x00004,        /* 7 :   2x1    */
+    0x00004,        /* 8 :   1x1    */
+  },
+  {   /* 2:1 aspect ratio */
+    0x08000,        /* 0 : 256x128  */
+    0x02000,        /* 1 : 128x64   */
+    0x00800,        /* 2 :  64x32   */
+    0x00200,        /* 3 :  32x16   */
+    0x00080,        /* 4 :  16x8    */
+    0x00020,        /* 5 :   8x4    */
+    0x00008,        /* 6 :   4x2    */
+    0x00004,        /* 7 :   2x1    */
+    0x00004,        /* 8 :   1x1    */
+  },
+  {   /* 1:1 aspect ratio */
+    0x10000,        /* 0 : 256x256  */
+    0x04000,        /* 1 : 128x128  */
+    0x01000,        /* 2 :  64x64   */
+    0x00400,        /* 3 :  32x32   */
+    0x00100,        /* 4 :  16x16   */
+    0x00040,        /* 5 :   8x8    */
+    0x00010,        /* 6 :   4x4    */
+    0x00004,        /* 7 :   2x2    */
+    0x00004,        /* 8 :   1x1    */
+  },
+};
+
+
+/* the offset from mipmap level 0 of each mipmap level in texels            */
+/* index is [aspect_ratio][lod]                                             */
+unsigned long _grMipMapOffset[4][16];
+unsigned long _grMipMapOffset_Tsplit[4][16];
+
+/* initialize the MipMap Offset arrays */
+void
+_grMipMapInit(void)
+{
+  int ar,lod;
+
+  for (ar=0; ar<4; ar++) {              /* for each aspect ratio           */
+    _grMipMapOffset[ar][0] = 0;         /* start off with offset=0         */
+    for (lod=1; lod<=9; lod++) {        /* for each lod, add in prev size */
+      _grMipMapOffset[ar][lod] = _grMipMapOffset[ar][lod-1] +
+        _grMipMapSize[ar][lod-1];
+    }
+    _grMipMapOffset_Tsplit[ar][0] = 0;  /* start off with offset=0 */
+    _grMipMapOffset_Tsplit[ar][1] = 0;  /* start off with offset=0 */
+    for (lod=2; lod<=9; lod++) {        /* for each lod, add in prev size */
+      _grMipMapOffset_Tsplit[ar][lod] = _grMipMapOffset_Tsplit[ar][lod-2] +
+        _grMipMapSize[ar][lod-2];
+    }
+  }
+} /* _grMipMapInit */
+
+/*---------------------------------------------------------------------------
+**
+*/
+FxU32
+_grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod, 
+                           GrAspectRatio_t aspect, GrTextureFormat_t format,
+                           FxU32 evenOdd )
+{
+  FxU32 memrequired;
+
+  GR_CHECK_W("_grTexTextureMemRequired", small_lod < large_lod,
+                 "small_lod bigger than large_lod" );
+  GR_CHECK_F( "_grTexTextureMemRequired", evenOdd >  GR_MIPMAPLEVELMASK_BOTH || evenOdd == 0, "invalid evenOdd mask" );
+
+  if ( aspect > GR_ASPECT_1x1 )         /* mirror aspect ratios         */
+    aspect =  GR_ASPECT_1x8 - aspect;
+
+  if ( evenOdd == GR_MIPMAPLEVELMASK_BOTH ) {
+    memrequired  = _grMipMapOffset[aspect][small_lod+1];
+    memrequired -= _grMipMapOffset[aspect][large_lod];
+  }
+  else {
+    memrequired = 0;
+    /* construct XOR mask   */
+    evenOdd = (evenOdd == GR_MIPMAPLEVELMASK_EVEN) ? 1 : 0;  
+    while (large_lod <= small_lod) {    /* sum up all the mipmap levels */
+      if ((large_lod ^ evenOdd) & 1)    /* that match the XOR mask      */
+        memrequired += _grMipMapSize[aspect][large_lod];
+      large_lod++;
+    }
+  }
+
+  if ( format >= GR_TEXFMT_16BIT )      /* convert from texels to bytes */
+    memrequired <<= 1;                  /* 2 bytes per texel            */
+
+  memrequired += 7;                     /* round up to 8 byte boundary  */
+  memrequired &= ~7;
+  return memrequired;
+} /* _grTexTextureMemRequired */
+
+FxU16
+_grTexFloatLODToFixedLOD( float value )
+{
+  float num_quarters;
+  int   new_value;
+
+  num_quarters = ( value + .125F ) / .25F;
+  new_value    = ( int ) num_quarters;
+
+  new_value   &= 0x003F;
+
+  return new_value;
+} /* _grTexFloatLODToFixedLOD */
+
+/*---------------------------------------------------------------------------
+** _grTexCalcBaseAddress
+*/
+FxU32
+_grTexCalcBaseAddress( FxU32 start, GrLOD_t large_lod,
+                       GrAspectRatio_t aspect, GrTextureFormat_t format,
+                       FxU32 odd_even_mask )
+{
+  FxU32 sum_of_lod_sizes;
+
+  if ( aspect > GR_ASPECT_1x1 )         /* mirror aspect ratios         */
+    aspect =  GR_ASPECT_1x8 - aspect;
+
+  if ( odd_even_mask == GR_MIPMAPLEVELMASK_BOTH )
+    sum_of_lod_sizes = _grMipMapOffset[aspect][large_lod];
+  else {
+    if (
+        ((odd_even_mask == GR_MIPMAPLEVELMASK_EVEN) && (large_lod & 1)) ||
+        ((odd_even_mask == GR_MIPMAPLEVELMASK_ODD) && !(large_lod & 1))
+        )
+      large_lod += 1;
+    sum_of_lod_sizes = _grMipMapOffset_Tsplit[aspect][large_lod];
+  }
+    
+  if ( format >= GR_TEXFMT_16BIT )
+    sum_of_lod_sizes <<= 1;
+  return ( start - sum_of_lod_sizes );
+} /* _grTexCalcBaseAddress */
+
+/*---------------------------------------------------------------------------
+** grTexCalcMemRequired
+*/
+GR_DIENTRY(grTexCalcMemRequired, FxU32,
+           ( GrLOD_t small_lod, GrLOD_t large_lod, 
+            GrAspectRatio_t aspect, GrTextureFormat_t format ))
+{
+  FxU32 memrequired;
+
+  memrequired = _grTexTextureMemRequired(small_lod, large_lod, 
+                                         aspect, format,
+                                         GR_MIPMAPLEVELMASK_BOTH );
+  GDBG_INFO((88,"grTexCalcMemRequired(%d,%d,%d,%d) => 0x%x(%d)\n",
+                small_lod,large_lod,aspect,format,memrequired,memrequired));
+  return memrequired;
+} /* grTexCalcMemRequired */
+
+
+/*---------------------------------------------------------------------------
+** grTexDetailControl
+*/
+GR_DIENTRY(grTexDetailControl, void,
+           ( GrChipID_t tmu, int lod_bias, FxU8 detail_scale,
+            float detail_max ))
+{
+  FxU32 tDetail;
+  FxU32 dmax    = ( FxU32 ) ( detail_max * _GlideRoot.pool.f255 );
+  FxU32 dscale  = detail_scale;
+  
+  GR_BEGIN_NOFIFOCHECK("grTexDetailControl",88);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,%g)\n",tmu,detail_scale,detail_max));
+  GR_CHECK_TMU( myName, tmu );
+  GR_CHECK_F( myName, lod_bias < -32 || lod_bias > 31, "lod_bias out of range" );
+  GR_CHECK_F( myName, detail_scale > 7, "detail_scale out of range" );
+  GR_CHECK_F( myName, detail_max < 0.0 || detail_max > 1.0, "detail_max out of range" );
+
+  tDetail  = ( ( lod_bias << SST_DETAIL_BIAS_SHIFT ) & SST_DETAIL_BIAS );
+  tDetail |= ( ( dmax << SST_DETAIL_MAX_SHIFT ) & SST_DETAIL_MAX );
+  tDetail |= ( ( dscale << SST_DETAIL_SCALE_SHIFT ) & SST_DETAIL_SCALE );
+  
+  /* MULTIPLAT */
+  _grTexDetailControl( tmu, tDetail );
+  GR_END();
+} /* grTexDetailControl */
+
+GR_DIENTRY(grTexMinAddress, FxU32, ( GrChipID_t tmu ))
+{
+  GR_BEGIN_NOFIFOCHECK("grTexMinAddress",88);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",tmu));
+  GR_CHECK_TMU(myName,tmu);
+  FXUNUSED( tmu );
+  GR_RETURN(0);
+} /* grTexMinAddress */
+
+
+/*-------------------------------------------------------------------
+  Function: grTexMaxAddress
+  Date: 6/2
+  Implementor(s): GaryT
+  Library: glide
+  Description:
+    Returns address of maximum extent of texture ram for a given TMU
+  Arguments:
+    tmu
+  Return:
+    the largest valid texture start Address
+  -------------------------------------------------------------------*/
+GR_DIENTRY(grTexMaxAddress, FxU32, ( GrChipID_t tmu ))
+{
+  GR_BEGIN_NOFIFOCHECK("grTexMaxAddress",88);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",tmu));
+  GR_CHECK_TMU( myName, tmu );
+  GR_RETURN(gc->tmu_state[tmu].total_mem-8);
+} /* grTexMaxAddress */
+
+
+/*-------------------------------------------------------------------
+  Function: grTexTextureMemRequired
+  Date: 6/2
+  Implementor(s): GaryMcT, Jdt
+  Library: glide
+  Description:
+    Returns the tmu memory required to store the specified mipmap    
+    ( Gary and I don't like the name of this function, but are 
+      a little backed into a corner because of the existence 
+      of grTexMemRequired() which does not imply any distinction
+      between texture memory and system ram )
+  Arguments:
+    evenOdd  - which set of mipmap levels are to be stored
+                One of:
+                  GR_MIPMAPLEVELMASK_EVEN 
+                  GR_MIPMAPLEVELMASK_ODD
+                  GR_MIPMAPLEVELMASK_BOTH
+    info      - pointer to GrTexInfo structure defining dimensions
+                of texture
+  Return:
+    offset to be added to current texture base address to calculate next 
+    valid texture memory download location
+  -------------------------------------------------------------------*/
+GR_DIENTRY(grTexTextureMemRequired, FxU32,
+           ( FxU32 evenOdd, GrTexInfo *info))
+{
+  FxU32 memrequired;
+
+  GR_CHECK_F( "grTexTextureMemRequired", !info, "invalid info pointer" );
+  memrequired = _grTexTextureMemRequired( info->smallLod, info->largeLod, 
+                                          info->aspectRatio, info->format,
+                                          evenOdd );
+                        
+  GDBG_INFO((88,"grTexTextureMemRequired(%d,0x%x) => 0x%x(%d)\n",
+                evenOdd,info,memrequired,memrequired));
+  return memrequired;
+} /* grTexTextureMemRequired */
+
+
+/*-------------------------------------------------------------------
+  Function: grTexDownloadMipMap
+  Date: 6/2
+  Implementor(s): GaryMcT, Jdt
+  Library: glide
+  Description:
+    Downloads a texture mipmap to the specified tmu at the specified
+    base address.
+  Arguments:
+    tmu          - which tmu
+    startAddress - starting address for texture download,
+    evenOdd  - which set of mipmap levels have been downloaded for
+                the selected texture
+                One of:
+                  GR_MIPMAPLEVELMASK_EVEN
+                  GR_MIPMAPLEVELMASK_ODD
+                  GR_MIPMAPLEVELMASK_BOTH
+    info       - pointer to GrTexInfo structure defining dimension of
+                 texture to be downloaded and containing texture data
+  Return:
+    none
+  -------------------------------------------------------------------*/
+GR_DIENTRY(grTexDownloadMipMap, void, 
+           ( GrChipID_t tmu, FxU32 startAddress, FxU32
+            evenOdd, GrTexInfo  *info ))
+{
+  GR_DCL_GC;
+  GrLOD_t lod;
+  char *src_base;
+  FxU32 size = grTexTextureMemRequired( evenOdd, info );
+
+  FXUNUSED(gc);
+
+  GDBG_INFO((89,"grTexDownloadMipMap(%d,0x%x,%d,0x%x\n",tmu,startAddress,evenOdd,info));
+  GR_CHECK_TMU( "grTexDownloadMipMap", tmu );
+  GR_CHECK_F( "grTexDownloadMipMap", startAddress + size > gc->tmu_state[tmu].total_mem,
+               "insufficient texture ram at startAddress" );
+  GR_CHECK_F( "grTexDownloadMipMap", evenOdd > 0x3, "evenOdd mask invalid" );
+  GR_CHECK_F( "grTexDownloadMipMap", !info, "info invalid" );
+  
+  if ((startAddress < 0x200000) && (startAddress + size > 0x200000))
+      GrErrorCallback("grTexDownloadMipMap: mipmap "
+                      " cannot span 2 Mbyte boundary",FXTRUE);
+
+  src_base = (char *)info->data;
+  
+  /*---------------------------------------------------------------
+    Download one mipmap level at a time
+    ---------------------------------------------------------------*/
+  for( lod = info->largeLod; lod <= info->smallLod; lod++ ) {
+    grTexDownloadMipMapLevel( tmu, 
+                              startAddress, 
+                              lod,
+                              info->largeLod,
+                              info->aspectRatio,
+                              info->format,
+                              evenOdd,
+                              src_base );
+               
+    src_base += _grMipMapHostSize[_gr_aspect_index_table[info->aspectRatio]][lod]
+                    << (info->format>=GR_TEXFMT_16BIT);
+  }
+} /* grTexDownloadMipMap */
+
+
+/*-------------------------------------------------------------------
+  Function: grTexDownloadTablePartial
+  Date: 6/3
+  Implementor(s): GaryT
+  Library: glide
+  Description:
+    download part of a look up table data to a tmu
+  Arguments:
+    tmu - which tmu
+    type - what type of table to download
+        One of:
+            GR_TEXTABLE_NCC0
+            GR_TEXTABLE_NCC1
+            GR_TEXTABLE_PALETTE
+    void *data - pointer to table data
+  Return:
+    none
+  -------------------------------------------------------------------*/
+GR_DIENTRY(grTexDownloadTablePartial, void,
+           ( GrChipID_t tmu, GrTexTable_t type, 
+            void *data, int start, int end ))
+{
+  GR_BEGIN_NOFIFOCHECK("grTexDownloadTablePartial",89);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,0x%x, %d,%d)\n",tmu,type,data,start,end));
+  GR_CHECK_TMU(myName,tmu);
+  GR_CHECK_F(myName, type > 0x2, "invalid table specified");
+  GR_CHECK_F(myName, !data, "invalid data pointer");
+#if (GLIDE_PLATFORM & GLIDE_HW_SST1)
+  GR_CHECK_F(myName, _GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].sstBoard.VoodooConfig.tmuConfig[0].tmuRev < 1,
+               "Texelfx rev 0 does not support paletted textures");
+#endif
+
+  if ( type == GR_TEXTABLE_PALETTE )     /* Need Palette Download Code */
+    _grTexDownloadPalette( tmu, (GuTexPalette *)data, start, end );
+  else {                                 /* Type is an ncc table */
+    _grTexDownloadNccTable( tmu, type, (GuNccTable*)data, start, end );
+  }
+  GR_END();
+} /* grTexDownloadTable */
+
+/*---------------------------------------------------------------------------
+** grTexDownloadMipMapLevel
+*/
+GR_DIENTRY(grTexDownloadMipMapLevel, void, 
+           ( GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod,
+            GrLOD_t largeLod, GrAspectRatio_t aspectRatio,
+            GrTextureFormat_t format, FxU32 evenOdd, void *data )) 
+{
+  GR_BEGIN_NOFIFOCHECK("grTexDownloadMipMapLevel",89);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x, %d,%d,%d, %d,%d 0x%x)\n",
+                  tmu,startAddress,thisLod,largeLod,aspectRatio,
+                  format,evenOdd,data));
+  grTexDownloadMipMapLevelPartial( tmu, startAddress,
+                                   thisLod, largeLod, 
+                                   aspectRatio, format,
+                                   evenOdd, data,
+                                   0, _grMipMapHostWH[aspectRatio][thisLod][1]-1 );
+  GR_END();
+} /* grTexDownloadMipmapLevel */
+
+FxU16 rle_line[256];
+FxU16 *rle_line_end;
+
+#if defined(__WIN32__) || defined(__OS2__) || defined(__GNUC__)
+void rle_decode_line_asm(FxU16 *tlut,FxU8 *src,FxU16 *dest)
+{
+   /* don't do anything just shut up the compiler */
+}
+#endif
Index: trunk/src/opengl/glide/sst1/glide/fxbldno.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/fxbldno.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/fxbldno.c	(revision 2885)
@@ -0,0 +1,55 @@
+/*
+ * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ * FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ * 
+ * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ * TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ * THE UNITED STATES.  
+ * 
+ * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+ *
+ * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/fxbldno.c,v 1.1 2000-02-25 00:31:11 sandervl Exp $
+ * $Log: fxbldno.c,v $
+ * Revision 1.1  2000-02-25 00:31:11  sandervl
+ * Created new Voodoo 1 Glide dir
+ *
+ * 
+ * 1     7/25/97 9:05a Pgj
+ * generate fxbldno.h which defines BUILD_NUMBER
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+main(int argc, char **argv)
+{
+    struct tm	locTime;
+    time_t	sysTime;
+    char	*build;
+
+    time(&sysTime);
+    locTime = *localtime(&sysTime);
+
+    if (build = getenv("BUILD_NUMBER")) {
+	printf("#define BUILD_NUMBER	%s\n", build);
+    } else {
+	unsigned short magic;
+	magic = (locTime.tm_yday << 7) |
+	        (locTime.tm_hour << 2) |
+		(locTime.tm_min / 15);
+	printf("#define BUILD_NUMBER	%d\n", magic);
+    }
+    return 0;
+
+} /* end main() */
Index: trunk/src/opengl/glide/sst1/glide/fxgasm.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/fxgasm.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/fxgasm.c	(revision 2885)
@@ -0,0 +1,194 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:11 $
+*/
+
+#include <stdio.h>
+
+#include <3dfx.h>
+#include <glidesys.h>
+
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+/*----------------------------------------------------------------------
+ * macros for creating assembler offset files
+ *----------------------------------------------------------------------*/
+
+#ifndef __linux__
+#define NEWLINE printf("\n")
+#define COMMENT printf(";----------------------------------------------------------------------\n")
+
+#define HEADER(str)     NEWLINE; COMMENT; \
+                        printf("; Assembler offsets for %s struct\n",str);\
+                        COMMENT; NEWLINE
+
+#define OFFSET(p,o,pname) if (hex) \
+        printf("%s\t= %08xh\n",pname,((int)&p.o)-(int)&p); \
+    else printf("%s\t= %10d\n",pname,((int)&p.o)-(int)&p)
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+#define HWOFFSET(p, o, pname) if (hex) \
+        printf("%s\t= %08xh\n",pname,(((int) &p.o)-(int)&p)>>2);\
+    else printf("%s\t= %10d\n",pname,(((int)&p.o)-(int)&p))
+#endif /* (GLIDE_PLATFORM & GLIDE_HW_SST96) */
+
+#define OFFSET2(p,o,pname) if (hex) \
+        printf("%s\t= %08xh\n",pname,((int)&o)-(int)&p); \
+    else printf("%s\t= %10d\n",pname,((int)&o)-(int)&p)
+
+#define SIZEOF(p,pname) if (hex) \
+        printf("SIZEOF_%s\t= %08xh\n",pname,sizeof(p)); \
+    else printf("SIZEOF_%s\t= %10d\n",pname,sizeof(p))
+#else
+#define NEWLINE printf("\n");
+#define COMMENT printf("#----------------------------------------------------------------------\n")
+
+#define HEADER(str)     NEWLINE; COMMENT; \
+                        printf("# Assembler offsets for %s struct\n",str);\
+                        COMMENT; NEWLINE
+
+#define OFFSET(p,o,pname) if (hex) \
+        printf("%s\t .EQU %08x\n",pname,((int)&p.o)-(int)&p); \
+    else printf("%s\t .EQU %10d\n",pname,((int)&p.o)-(int)&p)
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+#define HWOFFSET(p, o, pname) if (hex) \
+        printf("%s\t .EQU %08x\n",pname,(((int) &p.o)-(int)&p)>>2);\
+    else printf("%s\t .EQU %10d\n",pname,(((int)&p.o)-(int)&p))
+#endif /* (GLIDE_PLATFORM & GLIDE_HW_SST96) */
+
+#define OFFSET2(p,o,pname) if (hex) \
+        printf("%s\t .EQU %08x\n",pname,((int)&o)-(int)&p); \
+    else printf("%s\t .EQU %10d\n",pname,((int)&o)-(int)&p)
+
+#define SIZEOF(p,pname) if (hex) \
+        printf("SIZEOF_%s\t .EQU %08x\n",pname,sizeof(p)); \
+    else printf("SIZEOF_%s\t .EQU %10d\n",pname,sizeof(p))
+#endif
+
+int
+main (int argc, char **argv)
+{
+    int hex=0;          /* default is print in decimal  */
+    static Sstregs sst;
+    static struct _GlideRoot_s gr;
+    static GrGC gc;
+    static struct dataList_s dl;
+
+    if (argc > 1) {
+      if (strcmp("-inline", argv[1]) == 0) {
+        Sstregs dummyRegs;
+
+        printf("#ifndef __FX_INLINE_H__\n");
+        printf("#define __FX_INLINE_H__\n");
+        printf("\n");
+        
+        printf("/* The # of 2-byte entries in the hw fog table */\n");
+        printf("#define kInternalFogTableEntryCount 0x%XUL\n",
+               sizeof(dummyRegs.fogTable) >> 1);
+
+        printf("\n");
+        printf("#endif /* __FX_INLINE_H__ */\n");
+
+        return 0;
+      }
+
+      hex = 1;
+    }
+
+#ifndef __linux__
+    printf("SST_CHIP_MASK = 0%xh\n",SST_CHIP_MASK);
+#else
+    printf("SST_CHIP_MASK .EQU 0x%x\n", SST_CHIP_MASK);
+#endif
+
+    HEADER ("SSTREGS");
+#if (GLIDE_PLATFORM & GLIDE_HW_SST1)
+    OFFSET (sst,FvA.x,"FVAX\t\t");
+    OFFSET (sst,FvA.y,"FVAY\t\t");
+    OFFSET (sst,FvB.x,"FVBX\t\t");
+    OFFSET (sst,FvB.y,"FVBY\t\t");
+    OFFSET (sst,FvC.x,"FVCX\t\t");
+    OFFSET (sst,FvC.y,"FVCY\t\t");
+    OFFSET (sst,FtriangleCMD,"FTRIANGLECMD\t");
+#elif (GLIDE_PLATFORM & GLIDE_HW_SST96)
+    HWOFFSET (sst,FvA.x,"FVAX\t\t");
+    HWOFFSET (sst,FvA.y,"FVAY\t\t");
+    HWOFFSET (sst,FvB.x,"FVBX\t\t");
+    HWOFFSET (sst,FvB.y,"FVBY\t\t");
+    HWOFFSET (sst,FvC.x,"FVCX\t\t");
+    HWOFFSET (sst,FvC.y,"FVCY\t\t");
+    HWOFFSET (sst,FtriangleCMD,"FTRIANGLECMD\t");
+#else
+#error "Update fxgasm.c for this chip"    
+#endif
+    NEWLINE;
+#ifdef GLIDE_USE_ALT_REGMAP
+    OFFSET2(sst.Fr_ALT,sst.Fdrdx_ALT,"FDPDX_OFFSET\t");
+    OFFSET2(sst.Fr_ALT,sst.Fdrdy_ALT,"FDPDY_OFFSET\t");
+#else
+    OFFSET2(sst.Fr,sst.Fdrdx,"FDPDX_OFFSET\t");
+    OFFSET2(sst.Fr,sst.Fdrdy,"FDPDY_OFFSET\t");
+#endif
+    HEADER ("GC");
+    OFFSET (gc,base_ptr,"base_ptr\t");
+    OFFSET (gc,reg_ptr,"reg_ptr\t\t");
+    OFFSET (gc,lfb_ptr,"lfb_ptr\t\t");
+    OFFSET (gc,state.cull_mode,"cull_mode\t");
+    OFFSET (gc,dataList,"dataList\t");
+#if (GLIDE_PLATFORM & GLIDE_HW_SST1)
+    OFFSET (gc,state.fifoFree, "fifoFree\t");
+#endif
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+    OFFSET (gc,hwDep.sst96Dep.writesSinceFence, "writesSinceFence" );
+    OFFSET (gc,hwDep.sst96Dep.paramMask, "paramMask\t");
+    OFFSET (gc,hwDep.sst96Dep.gwCommand, "gwCommand\t");
+    OFFSET (gc,hwDep.sst96Dep.gwHeaders, "gwHeaders\t");
+    OFFSET (gc,fifoData.hwDep.vg96FIFOData.fifoPtr, "fifoPtr\t\t");
+    OFFSET (gc,fifoData.hwDep.vg96FIFOData.fifoSize, "fifoSize\t");
+#endif
+    SIZEOF (gr.GCs[0].state,"GrState\t");
+    SIZEOF (gr.hwConfig,"GrHwConfiguration");
+    SIZEOF (gr.GCs[0],"GC\t");
+    NEWLINE;
+
+    HEADER ("GlideRoot");
+    OFFSET (gr,p6Fencer,"p6Fencer\t");
+    OFFSET (gr,current_sst,"current_sst\t");
+    OFFSET (gr,CPUType,"CPUType\t\t");
+    OFFSET (gr,curGC,"curGC\t\t");
+    OFFSET (gr,curTriSize,"curTriSize\t");
+    OFFSET (gr,stats.trisProcessed,"trisProcessed\t");
+    OFFSET (gr,stats.trisDrawn,"trisDrawn\t");
+    SIZEOF (gr,"GlideRoot");
+    NEWLINE;
+
+    HEADER ("dataList");
+    OFFSET (dl,i,"dl_i\t\t");
+    OFFSET (dl,addr,"dl_addr\t\t");
+    SIZEOF (dl,"dataList\t");
+    NEWLINE;
+
+    return 0;
+}
Index: trunk/src/opengl/glide/sst1/glide/fxglide.h
===================================================================
--- trunk/src/opengl/glide/sst1/glide/fxglide.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/fxglide.h	(revision 2885)
@@ -0,0 +1,1417 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/fxglide.h,v 1.1 2000-02-25 00:31:12 sandervl Exp $
+** $Log: fxglide.h,v $
+** Revision 1.1  2000-02-25 00:31:12  sandervl
+** Created new Voodoo 1 Glide dir
+**
+** 
+** 86    2/12/98 4:01p Atai
+** change refresh rate if oemdll updated for tv out
+ * 
+ * 85    12/19/97 11:04a Atai
+ * oeminit dll stuff
+ * 
+ * 84    12/03/97 9:36a Dow
+ * Fixed bug in grSstIsBusy()
+ * 
+ * 83    9/19/97 12:38p Peter
+ * asm rush trisetup vs alt fifo
+ * 
+ * 82    9/11/97 9:31a Peter
+ * This is what happens when you don't listen to Chris
+ * 
+ * 81    9/10/97 10:15p Peter
+ * fifo logic from GaryT
+ * 
+ * 80    9/08/97 3:24p Peter
+ * fixed my fifo muckage
+ * 
+ * 79    8/19/97 8:54p Peter
+ * lots of stuff, hopefully no muckage
+ * 
+ * 78    8/01/97 11:48a Dow
+ * Made some macros use conventional FIFO accounting
+ * 
+ * 77    7/10/97 1:36p Dow
+ * Modified Nudge of Love to work around likely hardware bug.
+ * 
+ * 76    7/09/97 10:18a Dow
+ * Further Nudge Of Love adjustments
+ * 
+ * 75    7/08/97 8:55p Dow
+ * Fixed muckage in the Nudge Of Love
+ * 
+ * 74    7/08/97 1:29p Jdt
+ * Fixed watcom muckage
+ * 
+ * 73    7/07/97 8:33a Jdt
+ * New tracing macros.
+ * 
+ * 72    7/04/97 12:07p Dow
+ * Changed the DUMPGWH stuff, added const for triangle command packet
+ * 
+ * 71    6/29/97 11:28p Jdt
+ * Added gwCommand
+ * 
+ * 70    6/26/97 3:08p Dow
+ * New metrics for P6 stuff.
+ * 
+ * 69    6/21/97 1:05p Dow
+ * Moved the Nudge of Love to a macro
+ * 
+ * 68    6/20/97 5:50p Dow
+ * Changes for Chip Field
+ * 
+ * 67    6/19/97 7:35p Dow
+ * More P6 Stuff
+ * 
+ * 66    6/18/97 6:07p Dow
+ * Protected P6 Stuff
+ * 
+ * 65    6/18/97 5:54p Dow
+ * P6 adjustments
+ * 
+ * 64    6/16/97 12:45p Dow
+ * P6 Fixes
+ * 
+ * 63    6/08/97 11:06p Pgj
+ * use Group Write for Texture Downloads
+ * 
+ * 62    5/28/97 2:08p Dow
+ * Added checks for int10h when in debugging mode.
+ * 
+ * 61    5/27/97 11:37p Pgj
+ * Fix for Bug report 545
+ * 
+ * 60    5/27/97 2:02p Dow
+ * Fixed up some macros--GR_CHECK_FOR_ROOM & a call to assert()
+ * 
+ * 59    5/22/97 11:18a Dow
+ * Changed GR_ASSERT to fix stack muckage
+ * 
+ * 58    5/19/97 7:35p Pgj
+ * Print cogent error message if h/w not found
+ * 
+ * 57    5/15/97 12:20p Dow
+ * Fixed improper definition of GR_SET
+ * 
+ * 56    5/04/97 12:47p Dow
+ * Added direct write macro fro grSstControl
+ * 
+ * 55    5/02/97 2:07p Pgj
+ * screen_width/height now FxU32
+ * 
+ * 54    5/02/97 9:34a Dow
+ * Changed indentation of GrState to match the rest of file, modified
+ * GR_ASSERT
+ * 
+ * 53    4/13/97 2:06p Pgj
+ * eliminate all anonymous unions (use hwDep)
+ * 
+ * 52    3/24/97 2:00p Dow
+ * Fixed some chip field problems
+ * 
+ * 51    3/21/97 12:42p Dow
+ * Made STWHints not send the Bend Over Baby Packet to FBI Jr.
+ * 
+ * 50    3/19/97 10:43p Dow
+ * windowsInit stuff
+ * 
+ * 49    3/19/97 1:37a Jdt
+ * Added fbStride to gc
+ * 
+ * 48    3/18/97 9:08p Dow
+ * Added FX_GLIDE_NO_DITHER_SUB environment variable
+ * 
+ * 47    3/17/97 6:25a Jdt
+ * Added open flag to gc
+ * 
+ * 46    3/16/97 12:38a Jdt
+ * Shouldn't have removed fifoData, duh..
+ * 
+ * 45    3/16/97 12:19a Jdt
+ * Removed redundant data
+ * 
+ * 44    3/13/97 2:51a Jdt
+ * Removed lockIdle flag
+ * 
+ * 43    3/13/97 1:18a Jdt
+ * Added flag for sli lfb reads.
+ * 
+ * 42    3/09/97 10:31a Dow
+ * Added GR_DIENTRY for di glide functions
+ * 
+ * 41    3/04/97 9:11p Dow
+ * Neutered mutiplatform multiheaded monster.
+ * 
+ * 40    2/26/97 2:18p Dow
+ * moved all debug set functions to __cdecl
+ * 
+ * 39    2/26/97 11:54a Jdt
+ * Added glide buffer locking and fixed bug in GR_SET
+ * 
+ * 38    2/19/97 4:42p Dow
+ * Fixed debug build for Watcom
+ * 
+ * 37    2/14/97 12:55p Dow
+ * moved vg96 fifo wrap into init code
+ * 
+ * 36    2/12/97 5:31p Dow
+ * Fixed my ^$%^^&*^%^  error.
+ * 
+ * 35    2/12/97 2:09p Hanson
+ * Hopefully removed the rest of my muckage. 
+ * 
+ * 34    2/11/97 6:58p Dow
+ * Changes to support vid tiles and ser status
+ * 
+ * 33    1/18/97 11:44p Dow
+ * Moved _curGCFuncs into _GlideRoot
+ * Added support for GMT's register debugging
+ * 
+ * 32    1/16/97 3:41p Dow
+ * Embedded fn protos in ifndef FX_GLIDE_NO_FUNC_PROTO
+ * 
+ * 31    12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+ * 
+ * 30    11/14/96 1:04p Jdt
+ * Test for keywords
+**
+*/
+            
+/*                                               
+** fxglide.h
+**  
+** Internal declarations for use inside Glide.
+**
+** GLIDE_LIB:        Defined if building the Glide Library.  This macro
+**                   should ONLY be defined by a makefile intended to build
+**                   GLIDE.LIB or glide.a.
+**
+** GLIDE_HARDWARE:   Defined if GLIDE should use the actual SST hardware.  An
+**                   application is responsible for defining this macro.
+**
+** GLIDE_NUM_TMU:    Number of physical TMUs installed.  Valid values are 1
+**                   and 2.  If this macro is not defined by the application
+**                   it is automatically set to the value 2.
+**
+*/
+
+#ifndef __FXGLIDE_H__
+#define __FXGLIDE_H__
+
+/*
+** -----------------------------------------------------------------------
+** INCLUDE FILES
+** -----------------------------------------------------------------------
+*/
+#include <stdlib.h>
+#include <math.h>
+#include <3dfx.h>
+#include <sst1init.h>
+#include <sst.h>
+#include <gdebug.h>
+#include <init.h>
+
+#if GLIDE_MULTIPLATFORM
+#include "gcfuncs.h"
+#endif
+
+/* isolate this 'hack' here so as to make the code look cleaner */
+#ifdef __WATCOMC__
+#define GR_CDECL __cdecl
+#elif __OS2__
+#define GR_CDECL _System
+#else
+#define GR_CDECL
+#endif
+
+/*==========================================================================*/
+/*
+** GrState
+**
+** If something changes in here, then go into glide.h, and look for a 
+** declaration of the following form:
+**
+** #define GLIDE_STATE_PAD_SIZE N
+** #ifndef GLIDE_LIB
+** typedef struct {
+**   char pad[GLIDE_STATE_PAD_SIZE];
+** }  GrState;
+** #endif
+** 
+** Then change N to sizeof(GrState) AS DECLARED IN THIS FILE!
+**
+*/
+
+struct _GrState_s 
+{
+  GrCullMode_t                 /* these go in front for cache hits */
+    cull_mode;                 /* cull neg, cull pos, don't cull   */
+  
+  GrHint_t
+    paramHints;                /* Tells us if we need to pointcast a
+                                  parameter to a specific chip */
+  FxI32
+    fifoFree;                  /* # free entries in FIFO */
+  FxU32
+    paramIndex,                /* Index into array containing
+                                  parameter indeces to be sent ot the
+                                  triangle setup code    */
+    tmuMask;                   /* Tells the paramIndex updater which
+                                  TMUs need values */
+  struct{
+    FxU32   fbzColorPath;
+    FxU32   fogMode;
+    FxU32   alphaMode;
+    FxU32   fbzMode;
+    FxU32   lfbMode;
+    FxU32   clipLeftRight;
+    FxU32   clipBottomTop;
+    
+    FxU32   fogColor;
+    FxU32   zaColor;
+    FxU32   chromaKey;
+     
+    FxU32   stipple;
+    FxU32   color0;
+    FxU32   color1;
+  } fbi_config;                 /* fbi register shadow */
+  
+  struct {
+    FxU32   textureMode;
+    FxU32   tLOD;
+    FxU32   tDetail;
+    FxU32   texBaseAddr;
+    FxU32   texBaseAddr_1;
+    FxU32   texBaseAddr_2;
+    FxU32   texBaseAddr_3_8;
+    GrMipMapMode_t mmMode;      /* saved to allow MM en/dis */
+    GrLOD_t        smallLod, largeLod; /* saved to allow MM en/dis */
+    FxU32          evenOdd;
+    GrNCCTable_t   nccTable;
+  } tmu_config[GLIDE_NUM_TMU];  /* tmu register shadow           */
+  
+  FxBool                       /* Values needed to determine which */
+    ac_requires_it_alpha,      /*   parameters need gradients computed */
+    ac_requires_texture,       /*   when drawing triangles      */
+    cc_requires_it_rgb,
+    cc_requires_texture,
+    cc_delta0mode,             /* Use constants for flat shading */
+    allowLODdither,            /* allow LOD dithering            */
+    checkFifo;                 /* Check fifo status as specified by hints */
+  
+  FxU16
+    lfb_constant_depth;        /* Constant value for depth buffer (LFBs) */
+  GrAlpha_t
+    lfb_constant_alpha;        /* Constant value for alpha buffer (LFBs) */
+  
+  FxI32
+    num_buffers;               /* 2 or 3 */
+  
+  GrColorFormat_t
+    color_format;              /* ARGB, RGBA, etc. */
+  
+  GrMipMapId_t
+    current_mm[GLIDE_NUM_TMU]; /* Which guTex** thing is the TMU set
+                                  up for? THIS NEEDS TO GO!!! */
+  
+  float
+    clipwindowf_xmin, clipwindowf_ymin, /* Clipping info */
+    clipwindowf_xmax, clipwindowf_ymax;
+  FxU32
+    screen_width, screen_height; /* Screen width and height */
+  float
+    a, r, g, b;                /* Constant color values for Delta0 mode */
+};
+
+struct dataList_s {
+  int i;                      /* index into GrVertex struct for src data */
+  float *addr;                /* address of hardware register to write to */
+};
+
+typedef struct GrGC_s
+{
+  FxU32
+    *base_ptr,                  /* base address of SST */
+    *reg_ptr,                   /* pointer to base of SST registers */
+    *tex_ptr,                   /* texture memory address */
+    *lfb_ptr,                   /* linear frame buffer address */
+    *slave_ptr;                 /* Scanline Interleave Slave address */
+
+#if GLIDE_MULTIPLATFORM
+  GrGCFuncs
+    gcFuncs;
+#endif  
+
+  void *oemInit;
+
+  struct dataList_s dataList[20+12*GLIDE_NUM_TMU+3];/* add 3 for:
+						       fbi-tmu0 trans
+						       tmu0-tmu1 trans
+						       tmu1-tmu2 trans
+						       */
+  GrState
+    state;                      /* state of Glide/SST */
+
+  FxBool
+    nopCMD;                     /* Have we placed a NOP in the FIFO ? */
+
+  InitFIFOData  
+    fifoData;
+
+  union hwDep_u {
+    struct sst96Dep_s {
+#if (GLIDE_PLATFORM & GLIDE_OS_DOS32)
+      FxBool
+        int10Called;            /* Did the app call int10h? */
+      void (__interrupt __far *prevInt10)();
+#endif
+      FxU32
+        writesSinceFence,       /* Writes since last fence */
+        writesSinceHeader,      /* Grouped Writes since last header */
+        paramMask,              /* Mask indicating required parameters */
+        gwCommand,              /* Command for initiating a triangle gw packet */
+        gwHeaders[4];           /* Group write headers for SST96 */
+      FxU32
+        *serialStatus,          /* address of serial status register */
+        *fifoApertureBase;      /* base of fifo apurture (if different) */
+
+#if 0
+        *fifoPtr,               /* pointer to FIFO */
+        fifoSize,               /* # bytes left in FIFO */
+        *fifoVirt,              /* start virtual address */
+        fifoPhys,               /* start physical address  */
+        fifoMax,                /* in bytes */
+        fifoCur,                /* how much used up so far */
+        fifoLfb;                /* use LFB, use hostblt if 0. */
+#endif
+    } sst96Dep;
+    struct sst1Dep_s {
+      FxU32
+        /* fifoFree,               # Free entries in FIFO */
+        swFifoLWM;              /* fudge factor */
+    } sst1Dep;
+    
+  } hwDep;
+
+  FxU32 lockPtrs[2];        /* pointers to locked buffers */
+  FxU32 fbStride;
+
+  struct {
+    FxU32             freemem_base;
+    FxU32             total_mem;
+    FxU32             next_ncc_table;
+    GrMipMapId_t      ncc_mmids[2];
+    const GuNccTable *ncc_table[2];
+  } tmu_state[GLIDE_NUM_TMU];
+
+  int
+    grSstRez,                   /* Video Resolution of board */
+    grSstRefresh,               /* Video Refresh of board */
+    fbuf_size,                  /* in MB */
+    num_tmu;                    /* number of TMUs attached */
+
+  FxBool
+    scanline_interleaved;
+
+  struct {
+    GrMipMapInfo data[MAX_MIPMAPS_PER_SST];
+    GrMipMapId_t free_mmid;
+  } mm_table;                   /* mip map table */
+
+  /* LFB Flags */
+  FxU32 lfbSliOk;
+
+  /* DEBUG and SANITY variables */
+  FxI32 myLevel;                /* debug level */
+  FxI32 counter;                /* counts bytes sent to HW */
+  FxI32 expected_counter;       /* the number of bytes expected to be sent */
+
+  sst1VideoTimingStruct         /* init code overrides */
+    *vidTimings;
+
+  FxBool open;                  /* Has GC Been Opened? */
+  FxBool closedP;               /* Have we closed since an init call? (see grSstWinOpen) */
+} GrGC;
+
+/* NOTE: this changes the P6FENCE macro expansion from sst1init.h !!! */
+#define p6FenceVar _GlideRoot.p6Fencer
+
+/* if we are debugging, call a routine so we can trace fences */
+#ifdef GLIDE_DEBUG
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+#define GR_P6FENCE {_grFence(); gc->hwDep.sst96Dep.writesSinceFence = 0;}
+#else  /* SST1 */
+#define GR_P6FENCE _grFence();
+#endif /* SST1 or SST96 */
+#else  /* Not DEBUG */
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+#define GR_P6FENCE {P6FENCE; gc->hwDep.sst96Dep.writesSinceFence = 0;}
+#else  /* SST1 */
+#define GR_P6FENCE P6FENCE
+#endif /* SST1 or SST96 */
+#endif /* DEBUG or not */
+
+/*
+**  The root of all Glide data, all global data is in here
+**  stuff near the top is accessed a lot
+*/
+struct _GlideRoot_s {
+  int p6Fencer;                 /* xchg to here to keep this in cache!!! */
+  int current_sst;
+  FxU32 CPUType;
+  GrGC *curGC;                  /* point to the current GC      */
+  FxI32 curTriSize;             /* the size in bytes of the current triangle */
+  FxI32 curTriSizeNoGradient;   /* special for _trisetup_nogradients */
+  FxU32 packerFixAddress;       /* address to write packer fix to */
+  FxBool    windowsInit;        /* Is the Windows part of glide initialized? */
+
+#if GLIDE_MULTIPLATFORM
+  GrGCFuncs
+    curGCFuncs;                 /* Current dd Function pointer table */
+#endif
+  int initialized;
+
+  struct {                      /* constant pool (minimizes cache misses) */
+    float f0;
+    float fHalf;
+    float f1;
+    float f255;
+    float f256;
+    float ftemp1, ftemp2;       /* temps to convert floats to ints */
+  } pool;
+
+  struct {                      /* environment data             */
+    FxBool ignoreReopen;
+    FxBool triBoundsCheck;      /* check triangle bounds        */
+    FxBool noSplash;            /* don't draw it                */
+    FxBool shamelessPlug;       /* translucent 3Dfx logo in lower right */
+    FxU32  rsrchFlags;           
+    FxI32  swapInterval;        /* swapinterval override        */
+    FxI32  swFifoLWM;
+    FxU32  snapshot;            /* register trace snapshot      */
+    FxBool disableDitherSub;    /* Turn off dither subtraction? */
+  } environment;
+
+  struct {
+    FxU32       minMemFIFOFree;
+    FxU32       minPciFIFOFree;
+
+    FxU32       fifoSpins;      /* number of times we spun on fifo */
+
+    FxU32       bufferSwaps;    /* number of buffer swaps       */
+    FxU32       pointsDrawn;
+    FxU32       linesDrawn;
+    FxU32       trisProcessed;
+    FxU32       trisDrawn;
+
+    FxU32       texDownloads;   /* number of texDownload calls   */
+    FxU32       texBytes;       /* number of texture bytes downloaded   */
+
+    FxU32       palDownloads;   /* number of palette download calls     */
+    FxU32       palBytes;       /* number of palette bytes downloaded   */
+  } stats;
+
+  GrHwConfiguration     hwConfig;
+  
+  GrGC                  GCs[MAX_NUM_SST];       /* one GC per board     */
+};
+
+
+extern struct _GlideRoot_s /* GR_CDECL */ _GlideRoot;
+#if GLIDE_MULTIPLATFORM
+extern GrGCFuncs _curGCFuncs;
+#endif
+/*==========================================================================*/
+/* Macros for declaring functions */
+#define GR_DDFUNC(name, type, args) \
+type FX_CSTYLE name args
+
+#define GR_ENTRY(name, type, args) \
+FX_ENTRY type FX_CSTYLE name args
+
+#define GR_DIENTRY(name, type, args) \
+FX_ENTRY type FX_CSTYLE name args
+
+/*==========================================================================*/
+
+#define STATE_REQUIRES_IT_DRGB  FXBIT(0)
+#define STATE_REQUIRES_IT_ALPHA FXBIT(1)
+#define STATE_REQUIRES_OOZ      FXBIT(2)
+#define STATE_REQUIRES_OOW_FBI  FXBIT(3)
+#define STATE_REQUIRES_W_TMU0   FXBIT(4)
+#define STATE_REQUIRES_ST_TMU0  FXBIT(5)
+#define STATE_REQUIRES_W_TMU1   FXBIT(6)
+#define STATE_REQUIRES_ST_TMU1  FXBIT(7)
+#define STATE_REQUIRES_W_TMU2   FXBIT(8)
+#define STATE_REQUIRES_ST_TMU2  FXBIT(9)
+
+#define GR_TMUMASK_TMU0 FXBIT(GR_TMU0)
+#define GR_TMUMASK_TMU1 FXBIT(GR_TMU1)
+#define GR_TMUMASK_TMU2 FXBIT(GR_TMU2)
+
+/*
+**  Parameter gradient offsets
+**
+**  These are the offsets (in bytes)of the DPDX and DPDY registers from
+**  from the P register
+*/
+#ifdef GLIDE_USE_ALT_REGMAP
+#define DPDX_OFFSET 0x4
+#define DPDY_OFFSET 0x8
+#else
+#define DPDX_OFFSET 0x20
+#define DPDY_OFFSET 0x40
+#endif
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96) /* Stuff for group write packet header */
+
+#define GWH_VTX_AX_BIT          FXBIT(0)
+#define GWH_VTX_AY_BIT          FXBIT(1)
+#define GWH_VTX_BX_BIT          FXBIT(2)
+#define GWH_VTX_BY_BIT          FXBIT(3)
+#define GWH_VTX_CX_BIT          FXBIT(4)
+#define GWH_VTX_CY_BIT          FXBIT(5)
+#define GWH_FSTARTR_BIT         FXBIT(6)
+#define GWH_FDRDX_BIT           FXBIT(7)
+#define GWH_FDRDY_BIT           FXBIT(8)
+#define GWH_FSTARTG_BIT         FXBIT(9)
+#define GWH_FDGDX_BIT           FXBIT(10)
+#define GWH_FDGDY_BIT           FXBIT(11)
+#define GWH_FSTARTB_BIT         FXBIT(12)
+#define GWH_FDBDX_BIT           FXBIT(13)
+#define GWH_FDBDY_BIT           FXBIT(14)
+#define GWH_FSTARTZ_BIT         FXBIT(15)
+#define GWH_FDZDX_BIT           FXBIT(16)
+#define GWH_FDZDY_BIT           FXBIT(17)
+#define GWH_FSTARTA_BIT         FXBIT(18)
+#define GWH_FDADX_BIT           FXBIT(19)
+#define GWH_FDADY_BIT           FXBIT(20)
+#define GWH_FSTARTS_BIT         FXBIT(21)
+#define GWH_FDSDX_BIT           FXBIT(22)
+#define GWH_FDSDY_BIT           FXBIT(23)
+#define GWH_FSTARTT_BIT         FXBIT(24)
+#define GWH_FDTDX_BIT           FXBIT(25)
+#define GWH_FDTDY_BIT           FXBIT(26)
+#define GWH_FSTARTW_BIT         FXBIT(27)
+#define GWH_FDWDX_BIT           FXBIT(28)
+#define GWH_FDWDY_BIT           FXBIT(29)
+#define GWH_FTRIANGLECMD_BIT    FXBIT(30)
+#define GWH_ENABLE_BIT          FXBIT(31)
+
+#define GWH_VTX_BITS (GWH_VTX_AX_BIT | GWH_VTX_AY_BIT | \
+                      GWH_VTX_BX_BIT | GWH_VTX_BY_BIT | \
+                      GWH_VTX_CX_BIT | GWH_VTX_CY_BIT)
+#define GWH_RGB_BITS (GWH_FSTARTR_BIT | GWH_FDRDX_BIT | GWH_FDRDY_BIT |\
+                      GWH_FSTARTG_BIT | GWH_FDGDX_BIT | GWH_FDGDY_BIT |\
+                      GWH_FSTARTB_BIT | GWH_FDBDX_BIT | GWH_FDBDY_BIT)
+#define GWH_Z_BITS (GWH_FSTARTZ_BIT |  GWH_FDZDX_BIT | GWH_FDZDY_BIT)
+#define GWH_A_BITS (GWH_FSTARTA_BIT | GWH_FDADX_BIT | GWH_FDADY_BIT)
+#define GWH_ST_BITS (GWH_FSTARTS_BIT | GWH_FDSDX_BIT | GWH_FDSDY_BIT |\
+                     GWH_FSTARTT_BIT | GWH_FDTDX_BIT | GWH_FDTDY_BIT)
+#define GWH_W_BITS (GWH_FSTARTW_BIT | GWH_FDWDX_BIT | GWH_FDWDY_BIT)
+
+/* All gradient bits... used in trisetup_nogradients hack */
+#define GWH_DXY_BITS ( \
+        GWH_FDRDX_BIT | GWH_FDRDY_BIT | GWH_FDGDX_BIT | GWH_FDGDY_BIT | \
+        GWH_FDBDX_BIT | GWH_FDBDY_BIT | GWH_FDZDX_BIT | GWH_FDZDY_BIT | \
+        GWH_FDADX_BIT | GWH_FDADY_BIT | GWH_FDSDX_BIT | GWH_FDSDY_BIT | \
+        GWH_FDTDX_BIT | GWH_FDTDY_BIT | GWH_FDWDX_BIT | GWH_FDWDY_BIT )
+
+void
+_grDebugGroupWriteHeader(FxU32 header, FxU32 address);
+
+#if defined(GDBG_INFO_ON)
+#define DUMPGWH(header, address) {\
+  _grDebugGroupWriteHeader(header, address);\
+}    
+#else
+#define DUMPGWH(header,address)
+#endif
+
+#ifdef GLIDE_SANITY_SIZE
+#  define GW_UPDATE_COUNT(a)  (gc->counter += a)
+#else
+#  define GW_UPDATE_COUNT(a)
+#endif
+
+#define FENCE_AMOUNT    128
+
+#define GWH_REG_SHIFT     2
+#define GWH_WRAP_SHIFT   12
+#define GWH_CHIP_SHIFT   16
+
+#define GWH_REG_OFFSET(a) ((FxU32) (a) - (FxU32) gc->reg_ptr)
+#define GWH_REG(a) ((GWH_REG_OFFSET(a) >> GWH_REG_SHIFT) & 0xff)
+#define GWH_WRAP(a) (((FxU32)(a) >> GWH_WRAP_SHIFT) & 0xf)
+#define GWH_CHIP(a) (((FxU32)(a) >> GWH_CHIP_SHIFT) & 0xf)
+
+#define GWH_GEN_WRAP(w) (((w) & 0xf) << GWH_WRAP_SHIFT)
+#define GWH_GEN_CHIP(c) (((c) & 0xf) << GWH_CHIP_SHIFT)
+
+#define GEN_PCI_ADDRESS 
+
+#define GWH_FENCE_TRIANGLE \
+if ((gc->hwDep.sst96Dep.writesSinceFence + (_GlideRoot.curTriSize>>2 ) + 4) > FENCE_AMOUNT)\
+  GR_P6FENCE
+
+#define GW_TRICMD_MASK 0x40000000
+
+#define GWH_BUILD_PCI_ADDRESS(a,c,w)\
+  (GWH_REG(a) | (GWH_WRAP(w) << GWH_WRAP_SHIFT) | (GWH_CHIP(c) << GWH_CHIP_SHIFT))
+
+#define PUMA_DWORD_REG_OFFSET 0x100000
+
+#define GWH_GEN_ADDRESS(a) \
+  ((((FxU32)(a) - (FxU32) gc->lfb_ptr) >> 2) | PUMA_DWORD_REG_OFFSET | GWH_ENABLE_BIT)
+
+#ifdef DEBUG
+#  define GWH_RESET_WSH gc->hwDep.sst96Dep.writesSinceHeader = 0
+#  define GWH_INC_WSH gc->hwDep.sst96Dep.writesSinceHeader++
+#else
+#  define GWH_RESET_WSH
+#  define GWH_INC_WSH
+#endif
+
+#if defined( GLIDE_DEBUG )
+  /* defined in GPCI.C */
+extern void GR_CDECL
+_GR_SET_GW_CMD( volatile void *addr, unsigned long data );
+extern void GR_CDECL
+_GR_SET_GW_HEADER( volatile void *addr, unsigned long data );
+extern void GR_CDECL
+_GR_SET_GW_ENTRY( volatile void *addr, unsigned long data );
+
+#define SET_GW_CMD( addr, offset, data )    \
+_GR_SET_GW_CMD( ((FxU32*)(addr))+(offset), (data) ); GR_INC_SIZE(4)
+
+#define SET_GW_HEADER( addr, offset, data ) \
+_GR_SET_GW_HEADER( ((FxU32*)(addr))+(offset), (data) ); GR_INC_SIZE(4)
+
+#define FSET_GW_ENTRY( addr, offset, data )  \
+{                                            \
+   float _tacoFTemp;                         \
+   _tacoFTemp = (data);                      \
+   _GR_SET_GW_ENTRY( ((FxU32*)(addr))+(offset), (*(FxU32*)&_tacoFTemp) ); \
+   GR_INC_SIZE(4);\
+}
+#else
+
+#define SET_GW_CMD( addr, offset, data )    \
+*(addr+offset)=data;
+
+#define SET_GW_HEADER( addr, offset, data ) \
+*(addr+offset)=data;
+
+#define FSET_GW_ENTRY( addr, offset, data )  \
+*((float*)(addr+offset))=data;
+
+#endif
+
+#if SST96_ALT_FIFO_WRAP
+#define GWH_PACKET_SIZE_CHECK(__s) \
+  if (gc->fifoData.hwDep.vg96FIFOData.fifoSize < (FxU32) ((__s) + 12)) {\
+    gc->fifoData.hwDep.vg96FIFOData.blockSize = (__s) + 12; \
+    initWrapFIFO(&gc->fifoData); \
+  }
+#else
+#define GWH_PACKET_SIZE_CHECK(__s) \
+  if (gc->fifoData.hwDep.vg96FIFOData.fifoSize < (FxU32) ((__s) + 12)) {\
+    _grSst96FifoMakeRoom();\
+    GR_ASSERT(!(gc->fifoData.hwDep.vg96FIFOData.fifoSize < 0x1000));\
+  }
+#endif
+
+#define GWH_BEGIN_TRIANGLE_PACKET(header, address) \
+{\
+  GWH_RESET_WSH;\
+  GR_ASSERT(!(((FxU32)(gc->fifoData.hwDep.vg96FIFOData.fifoPtr) & 0x7)));\
+  GWH_FENCE_TRIANGLE;\
+  GDBG_INFO((120, "Beginning Grouped Write Packet\n"));\
+  GDBG_INFO((120, "fifoPtr = 0x%x fifoSize = 0x%x\n", gc->fifoData.hwDep.vg96FIFOData.fifoPtr, gc->fifoData.hwDep.vg96FIFOData.fifoSize));\
+  GDBG_INFO((120, "Base = 0x%x Mask = 0x%x\n", (FxU32) address, header));\
+  GW_UPDATE_COUNT(8);\
+  GWH_PACKET_SIZE_CHECK(_GlideRoot.curTriSize); \
+  DUMPGWH(header,address);\
+  GLIDE_FIFO_CHECK(); \
+  *gc->fifoData.hwDep.vg96FIFOData.fifoPtr++ = GWH_GEN_ADDRESS(address);\
+  *gc->fifoData.hwDep.vg96FIFOData.fifoPtr++ = header;\
+  gc->fifoData.hwDep.vg96FIFOData.fifoSize -= 8;\
+  gc->hwDep.sst96Dep.writesSinceFence += 2;\
+}
+
+#define GWH_FENCE_TEXDL \
+if ((gc->hwDep.sst96Dep.writesSinceFence + 34) >= FENCE_AMOUNT)\
+  GR_P6FENCE
+
+#define GWH_BEGIN_TEXDL_PACKET(header, address) \
+{\
+  GWH_RESET_WSH;\
+  GR_ASSERT(!(((FxU32)(gc->fifoData.hwDep.vg96FIFOData.fifoPtr) & 0x7)));\
+  GWH_FENCE_TEXDL;\
+  GDBG_INFO((120, "Beginning Texture Grouped Write Packet\n"));\
+  GDBG_INFO((120, "fifoPtr = 0x%x fifoSize = 0x%x\n", gc->fifoData.hwDep.vg96FIFOData.fifoPtr, gc->fifoData.hwDep.vg96FIFOData.fifoSize));\
+  GDBG_INFO((120, "Base = 0x%x Mask = 0x%x\n", address, header));\
+  GW_UPDATE_COUNT(8);\
+  GWH_PACKET_SIZE_CHECK(34 << 2); \
+  GLIDE_FIFO_CHECK(); \
+  DUMPGWH(header,((((FxU32) address - (FxU32) gc->lfb_ptr)) >> 2) | GWH_ENABLE_BIT);\
+  *gc->fifoData.hwDep.vg96FIFOData.fifoPtr++ =\
+      ((((FxU32) address - (FxU32) gc->lfb_ptr)) >> 2) | GWH_ENABLE_BIT;\
+  *gc->fifoData.hwDep.vg96FIFOData.fifoPtr++ = header;\
+  gc->fifoData.hwDep.vg96FIFOData.fifoSize -= 8;\
+  gc->hwDep.sst96Dep.writesSinceFence += 2;\
+}
+
+#define GR_SETF_GW(s) {\
+GLIDE_FIFO_CHECK(); \
+GR_ASSERT(gc->hwDep.sst96Dep.writesSinceHeader < 32);\
+GDBG_INFO((120, "Group Write:  fifoPtr = 0x%x, value = %4.2f sinceFence = 0x%x\n", gc->fifoData.hwDep.vg96FIFOData.fifoPtr, s, gc->hwDep.sst96Dep.writesSinceFence));\
+*((float *) gc->fifoData.hwDep.vg96FIFOData.fifoPtr++) = s;\
+gc->fifoData.hwDep.vg96FIFOData.fifoSize-=4;\
+GW_UPDATE_COUNT(4);\
+GR_ASSERT(gc->hwDep.sst96Dep.writesSinceFence <= FENCE_AMOUNT);\
+gc->hwDep.sst96Dep.writesSinceFence++;\
+GWH_INC_WSH;\
+}
+
+#define GR_SET_GW(s) {\
+GLIDE_FIFO_CHECK(); \
+GR_ASSERT(gc->hwDep.sst96Dep.writesSinceHeader < 32);\
+GDBG_INFO((120, "Group Write:  fifoPtr = 0x%x, value = 0x%x sinceFence=%d\n", gc->fifoData.hwDep.vg96FIFOData.fifoPtr, s, gc->hwDep.sst96Dep.writesSinceFence));\
+P6FENCEFIFO;\
+*gc->fifoData.hwDep.vg96FIFOData.fifoPtr++ = s;\
+gc->fifoData.hwDep.vg96FIFOData.fifoSize-=4;\
+GW_UPDATE_COUNT(4);\
+GR_ASSERT(gc->hwDep.sst96Dep.writesSinceFence <= FENCE_AMOUNT);\
+gc->hwDep.sst96Dep.writesSinceFence++;\
+GWH_INC_WSH;\
+}
+
+#endif /* stuff for group write packet header */
+
+/*==========================================================================*/
+/*
+**  Here's the infamous Packer Bug Check and Workaround:   
+**  XOR the two addresses together to find out which bits are different.
+**  AND the result with the bits that represent the chip field of the 
+**  SST address.  If ANY of them are different, then do the packer hack.
+**  Save this address as the last with which we compared.
+*/  
+
+#define SST_CHIP_MASK 0x3C00
+
+#if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
+#define GLIDE_DRIVER_NAME "Voodoo Graphics"
+#elif   ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+#define GLIDE_DRIVER_NAME "Voodoo Rush"
+#else
+#define GLIDE_DRIVER_NAME "Unknown"
+#endif
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST1)
+  #define PACKER_WORKAROUND_SIZE 4
+
+  #define PACKER_WORKAROUND \
+    if (_GlideRoot.CPUType == 6) {\
+      GR_P6FENCE;\
+      GR_SET( *(FxU32 *)_GlideRoot.packerFixAddress, 0 );\
+      GR_P6FENCE;\
+    } \
+    else {\
+      GR_SET( *(FxU32 *)_GlideRoot.packerFixAddress, 0 ); \
+    }
+
+  #define PACKER_BUGCHECK(a)\
+    if ( (((FxU32) a) ^ lastAddress) & SST_CHIP_MASK ) {\
+      PACKER_WORKAROUND;        \
+      lastAddress = (FxU32)a;   \
+    }
+
+#else
+  #define PACKER_WORKAROUND_SIZE 0
+  #define PACKER_WORKAROUND
+  #define PACKER_BUGCHECK(a)
+#endif
+
+/* On a P6 we have to fence around commands to ensure write-ordering */
+#if 0
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+#  ifdef GR_P6FENCE
+#    undef GR_P6FENCE
+#  endif
+#  define GR_P6FENCE
+#endif
+#endif
+
+/* GMT: a very useful macro for making sure that SST commands are properly
+   fenced on a P6, e.g. P6FENCH_CMD( GR_SET(hw->nopCMD,1) );
+*/
+/* #if (GLIDE_PLATFORM & GLIDE_HW_SST1) */
+#if 1
+#define P6FENCE_CMD( cmd ) \
+    if (_GlideRoot.CPUType == 6) {     /* if it's a p6 */ \
+      GR_P6FENCE;                      /* then fence off the cmd */ \
+      cmd; \
+      GR_P6FENCE;                      /* to ensure write order  */ \
+    } \
+    else \
+      cmd
+#else
+#define P6FENCE_CMD( cmd ) cmd
+#endif
+
+/*==========================================================================*/
+#ifndef FX_GLIDE_NO_FUNC_PROTO
+
+void _grMipMapInit(void);
+FxI32 FX_CSTYLE
+_trisetup_asm(const GrVertex *va, const GrVertex *vb, const GrVertex *vc );
+FxI32 FX_CSTYLE
+_trisetup(const GrVertex *va, const GrVertex *vb, const GrVertex *vc );
+FxI32 FX_CSTYLE
+_trisetup_nogradients(const GrVertex *va, const GrVertex *vb, const GrVertex *vc );
+
+#endif /* FX_GLIDE_NO_FUNC_PROTO */
+
+/* GMT: BUG need to make this dynamically switchable */
+#if defined(GLIDE_USE_C_TRISETUP)
+  #define TRISETUP _trisetup
+#else
+  #define TRISETUP _trisetup_asm
+#endif /* GLIDE_USE_C_TRISETUP */
+
+/*==========================================================================*/
+/* 
+**  Function Prototypes
+*/
+#ifdef GLIDE_DEBUG
+FxBool
+_grCanSupportDepthBuffer( void );
+#endif
+
+void
+_grClipNormalizeAndGenerateRegValues(FxU32 minx, FxU32 miny, FxU32 maxx,
+                                     FxU32 maxy, FxU32 *clipLeftRight,
+                                     FxU32 *clipBottomTop);
+
+void 
+_grSwizzleColor( GrColor_t *color );
+
+void
+_grDisplayStats(void);
+
+void
+_GlideInitEnvironment(void);
+
+void FX_CSTYLE
+_grColorCombineDelta0Mode( FxBool delta0Mode );
+
+void
+_doGrErrorCallback( const char *name, const char *msg, FxBool fatal );
+
+void _grErrorDefaultCallback( const char *s, FxBool fatal );
+
+#ifdef __OS2__
+void _grErrorOs2Callback( const char *s, FxBool fatal );
+#endif /* __OS2__ */
+
+#ifdef __WIN32__
+void _grErrorWindowsCallback( const char *s, FxBool fatal );
+#endif /* __WIN32__ */
+
+extern void
+(*GrErrorCallback)( const char *string, FxBool fatal );
+
+void GR_CDECL
+_grFence( void );
+
+int
+_guHeapCheck( void );
+
+void FX_CSTYLE
+_grRebuildDataList( void );
+
+void
+_grReCacheFifo( FxI32 n );
+
+FxI32 GR_CDECL
+_grSpinFifo( FxI32 n );
+
+void
+_grShamelessPlug(void);
+
+FxBool
+_grSstDetectResources(void);
+
+FxU16
+_grTexFloatLODToFixedLOD( float value );
+
+void FX_CSTYLE
+_grTexDetailControl( GrChipID_t tmu, FxU32 detail );
+
+void FX_CSTYLE
+_grTexDownloadNccTable( GrChipID_t tmu, FxU32 which,
+                        const GuNccTable *ncc_table,
+                        int start, int end );
+void FX_CSTYLE
+_grTexDownloadPalette( GrChipID_t   tmu, 
+                       GuTexPalette *pal,
+                       int start, int end );
+
+FxU32
+_grTexCalcBaseAddress(
+                      FxU32 start_address, GrLOD_t largeLod,
+                      GrAspectRatio_t aspect, GrTextureFormat_t fmt,
+                      FxU32 odd_even_mask ); 
+
+void
+_grTexForceLod( GrChipID_t tmu, int value );
+
+FxU32
+_grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod, 
+                           GrAspectRatio_t aspect, GrTextureFormat_t format,
+                           FxU32 evenOdd );
+void FX_CSTYLE
+_grUpdateParamIndex( void );
+
+#if 0
+FX_ENTRY void FX_CALL
+grSstConfigPipeline(GrChipID_t chip, GrSstRegister reg, FxU32 value);
+#endif
+
+/*==========================================================================*/
+/*  GMT: have to figure out when to include this and when not to
+*/
+#if defined(GLIDE_DEBUG) || defined(GLIDE_ASSERT) || \
+	defined(GLIDE_SANITY_ASSERT) || defined(GLIDE_SANITY_SIZE) || \
+	defined(GDBG_INFO_ON)
+#define DEBUG_MODE 1
+#include <assert.h>
+
+#if SST96_FIFO
+/* sst96.c */
+extern void
+_grSst96CheckFifoData(void);
+
+#define GLIDE_FIFO_CHECK() _grSst96CheckFifoData()
+#else
+#define GLIDE_FIFO_CHECK()
+#endif
+#else
+#define GLIDE_FIFO_CHECK()
+#endif
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST1)
+/* NOTE: fifoFree is the number of entries, each is 8 bytes */
+#define GR_CHECK_FOR_ROOM(n) \
+{ \
+  FxI32 fifoFree = gc->state.fifoFree - (n); \
+  if (fifoFree < 0)          \
+    fifoFree = _grSpinFifo(n); \
+  gc->state.fifoFree = fifoFree;\
+}
+#elif (GLIDE_PLATFORM & GLIDE_HW_SST96)
+/* NOTE: fifoSize is in bytes, and each fifo entry is 8 bytes.  Since
+   the fifoSize element of the sst96Dep data structure must be
+   accurate, we subtract after we write, instead of at the beginning
+   as above. */
+#if (GLIDE_PLATFORM & GLIDE_OS_DOS32) && defined(GLIDE_DEBUG)
+#define GR_CHECKINT10 if (gc->hwDep.sst96Dep.int10Called)_doGrErrorCallback("Glide Error:", "Application called Int 10 between grSstWinOpen and Close.\n", FXTRUE)
+#else
+#define GR_CHECKINT10
+#endif
+
+#if SST96_ALT_FIFO_WRAP
+
+#define GR_CHECK_FOR_ROOM(n) \
+{\
+  FxI32 fifoSize = gc->fifoData.hwDep.vg96FIFOData.fifoSize - ((n) << 1);\
+  if (fifoSize < 0) {\
+    gc->fifoData.hwDep.vg96FIFOData.blockSize = ((n) << 1); \
+    initWrapFIFO(&gc->fifoData); \
+     GR_CHECKINT10;\
+  }\
+}
+#else /* !SST96_ALT_FIFO_WRAP */
+#define GR_CHECK_FOR_ROOM(n) \
+{\
+  FxI32 fifoSize = gc->fifoData.hwDep.vg96FIFOData.fifoSize - ((n) << 1);\
+  if (fifoSize < 0) {\
+    _grSst96FifoMakeRoom();\
+    GR_ASSERT(!(gc->fifoData.hwDep.vg96FIFOData.fifoSize < 0x1000));\
+    GR_CHECKINT10;\
+  }\
+}
+#endif /* !SST96_ALT_FIFO_WRAP */
+#endif
+
+#ifdef GLIDE_SANITY_SIZE
+
+#define FIFO_SUB_VAL ((FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoPtr - \
+                      (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoVirt)
+   
+#define GR_CHECK_SIZE() \
+   if(gc->counter != gc->expected_counter) \
+   GDBG_ERROR("GR_ASSERT_SIZE","byte counter should be %d but is %d\n", \
+              gc->expected_counter,gc->counter); \
+   ASSERT(gc->counter == gc->expected_counter); \
+   gc->counter = gc->expected_counter = 0
+#define GR_CHECK_SIZE_SLOPPY() \
+   if(gc->counter > gc->expected_counter) \
+     GDBG_ERROR("GR_ASSERT_SIZE","byte counter should be < %d but is %d\n", \
+                gc->expected_counter,gc->counter); \
+   ASSERT(gc->counter <= gc->expected_counter); \
+   gc->counter = gc->expected_counter = 0
+#define GR_SET_EXPECTED_SIZE(n) \
+   GLIDE_FIFO_CHECK(); \
+   GDBG_INFO((gc->myLevel, \
+              "FIFO: 0x%X 0x%X (0x%X)\n", \
+              (n), \
+              (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoPtr, \
+              FIFO_SUB_VAL)); \
+   GDBG_INFO((gc->myLevel, \
+              "FIFOSize: 0x%X\n", \
+              (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoSize));\
+   ASSERT(gc->counter == 0); \
+   ASSERT(gc->expected_counter == 0); \
+   GR_CHECK_FOR_ROOM((n)); \
+   gc->expected_counter = n
+#define GR_INC_SIZE(n) gc->counter += n
+#else /* !GLIDE_SANITY_SIZE */
+   /* define to do nothing */
+#define GR_CHECK_SIZE_SLOPPY()
+#define GR_CHECK_SIZE()
+#define GR_SET_EXPECTED_SIZE(n) GR_CHECK_FOR_ROOM((n))
+#define GR_INC_SIZE(n)
+#endif /* !GLIDE_SANITY_SIZE */
+
+#define GR_DCL_GC GrGC *gc = _GlideRoot.curGC
+#define GR_DCL_HW Sstregs *hw = (Sstregs *)gc->reg_ptr
+
+#ifdef DEBUG_MODE
+  #define ASSERT(exp) GR_ASSERT(exp)
+
+  #define GR_BEGIN_NOFIFOCHECK(name,level) \
+                GR_DCL_GC;      \
+                GR_DCL_HW;      \
+                static char myName[] = name;  \
+                GR_ASSERT(gc != NULL);  \
+                GR_ASSERT(hw != NULL);  \
+                gc->myLevel = level;    \
+                GDBG_INFO((gc->myLevel,"%s\n", myName)); \
+                FXUNUSED( hw )
+
+#else
+  #define ASSERT(exp)
+
+  #define GR_BEGIN_NOFIFOCHECK(name,level) \
+                GR_DCL_GC;      \
+                GR_DCL_HW;      \
+                FXUNUSED( hw )
+#endif
+
+#define GR_BEGIN(name,level,size) \
+                GR_BEGIN_NOFIFOCHECK(name,level); \
+                GR_SET_EXPECTED_SIZE(size)
+
+#if SST96_ALT_FIFO_WRAP
+#define GR_EXIT_TRACE   \
+           GLIDE_FIFO_CHECK(); \
+           GDBG_INFO((gc->myLevel, \
+                      "%s Done: FifoPtr(0x%X) FifoTest(0x%X)\n", \
+                      myName, \
+                      (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoPtr, \
+                      gc->fifoData.hwDep.vg96FIFOData.fifoSize))
+#else
+#define GR_EXIT_TRACE   GDBG_INFO((gc->myLevel,  "%s Done\n", myName))
+#endif
+
+#define GR_END()        {GR_CHECK_SIZE(); GR_EXIT_TRACE;}
+#define GR_END_SLOPPY() {GR_CHECK_SIZE_SLOPPY(); GR_EXIT_TRACE;}
+#define GR_RETURN(val) \
+                if ( GDBG_GET_DEBUGLEVEL(gc->myLevel) ) { \
+                  GR_CHECK_SIZE(); \
+                } \
+                else \
+                  GR_END(); \
+                GDBG_INFO((gc->myLevel,"%s() => 0x%x---------------------\n",myName,val,val)); \
+                return val
+
+#ifndef GR_ASSERT               
+#if defined(GLIDE_SANITY_ASSERT)
+#  define GR_ASSERT(exp) if (!(exp)) _grAssert(#exp,  __FILE__, __LINE__)
+#else
+#  define GR_ASSERT(exp) 
+#endif
+#endif
+
+#if defined(GLIDE_DEBUG)
+  #define GR_CHECK_F(name,condition,msg) \
+    if ( condition ) _doGrErrorCallback( name, msg, FXTRUE )
+  #define GR_CHECK_W(name,condition,msg) \
+    if ( condition ) _doGrErrorCallback( name, msg, FXFALSE )
+#else
+  #define GR_CHECK_F(name,condition,msg)
+  #define GR_CHECK_W(name,condition,msg)
+#endif
+
+/* macro define some basic and common GLIDE debug checks */
+#define GR_CHECK_TMU(name,tmu) \
+  GR_CHECK_F(name, tmu < GR_TMU0 || tmu >= gc->num_tmu , "invalid TMU specified")
+
+
+FxBool
+_grSst96PCIFifoEmpty(void);
+FxU32
+_grSst96Load32(FxU32 *s);
+void
+_grSst96Store32(FxU32 *d, FxU32 s);
+void
+_grSst96Store16(FxU16 *d, FxU16 s);
+void 
+_grSst96Store32F(float *d, float s);
+void
+_grAssert(char *, char *, int);
+
+#if defined(SST96)
+/* sst.h defines SET,GET,SETF, and SET16 */
+#undef SET
+#undef SETF
+#undef SET16
+
+void GR_CDECL
+_grSst96FifoMakeRoom(void);
+
+#define SST96_LFB_OFFSET 0x000000
+#define SST96_REG_OFFSET 0x400000
+#define SST96_TEX_OFFSET 0x600000
+
+#ifdef SST96_FIFO
+#ifdef GDBG_INFO_ON
+void
+_grFifoWriteDebug(FxU32 addr, FxU32 val, FxU32 fifoPtr);
+#define DEBUGFIFOWRITE(a,b,c) \
+_grFifoWriteDebug((FxU32) a, (FxU32) b, (FxU32) c)
+void
+_grFifoFWriteDebug(FxU32 addr, float val, FxU32 fifoPtr);
+#define DEBUGFIFOFWRITE(a,b,c) \
+_grFifoFWriteDebug((FxU32) a, (float) b, (FxU32) c)
+#else
+#define DEBUGFIFOWRITE(a,b,c)
+#define DEBUGFIFOFWRITE(a,b,c)
+#endif
+
+/*  
+**  Here lies the infamous Nudge Of Love.  The Nudge Of Love is
+**  required to on P6s, where the read pointer trails the write
+**  pointer by 256 bytes (64 DWORDS).  The problem with that is
+**  sometimes we really need the hardware to have read all the data we
+**  have sent--thus the Nudge, which gently strokes the read pointer
+**  through the last commands we've placed in the commadn FIFO.
+**
+**  That would be all well and good except for one thing:  If the
+**  frame time is very short, Jr, doesn't like the Nudge Of Love.  So,
+**  instead of a whole bunch of nopCmds, we must draw a smallish
+**  triangle.  The problem with that, however, is the app may be
+**  reusing the contents of the color or depth buffers.  Thus, we have
+**  to disable the color and depth mask before drawing the triangle
+**  and replace the shadowed values after we draw it.
+**
+* dpc - 19 aug 1997 - FixMe!
+* This macro is called the P6_NUDGE_OF_LOVE, but it was not previously
+* conditional on running on a p6. Is this right? I moved the set expected
+* size thing into here, and made usages of the macro not set the expected
+* size and do the sloppy check.
+*/
+#define P6_NUDGE_OF_LOVE \
+if (_GlideRoot.CPUType == 6) {\
+  int i;\
+  GR_SET_EXPECTED_SIZE(32 << 2); \
+  GR_SET(hw->fbzMode, (gc->state.fbi_config.fbzMode & (~(SST_RGBWRMASK | SST_ZAWRMASK))));\
+  GR_SETF(hw->FvA.x, 0.f);\
+  GR_SETF(hw->FvA.y, 0.f);\
+  GR_SETF(hw->FvB.x, 100.f);\
+  GR_SETF(hw->FvB.y, 0.f);\
+  GR_SETF(hw->FvC.x, 100.f);\
+  GR_SETF(hw->FvC.y, 100.f);\
+  GR_SETF(hw->FtriangleCMD, 1.f);\
+  GR_SET(hw->fbzMode, gc->state.fbi_config.fbzMode);\
+  for (i = 0; i < 23; i++) GR_SET(hw->nopCMD, 0); \
+  GR_CHECK_SIZE(); \
+}
+
+#define P6FENCEFIFO \
+if (_GlideRoot.CPUType == 6) {\
+  GR_ASSERT(gc->hwDep.sst96Dep.writesSinceFence <= FENCE_AMOUNT);\
+  if (gc->hwDep.sst96Dep.writesSinceFence == FENCE_AMOUNT) {\
+    GR_P6FENCE;\
+  }\
+}
+
+#define SST96_STORE_FIFO(addr,val){\
+  GR_ASSERT(!(((FxU32)(gc->fifoData.hwDep.vg96FIFOData.fifoPtr) & 0x7)));\
+  GR_ASSERT(gc->fifoData.hwDep.vg96FIFOData.fifoSize > 0);\
+  P6FENCEFIFO;\
+  DEBUGFIFOWRITE(addr, val, gc->fifoData.hwDep.vg96FIFOData.fifoPtr);\
+  GLIDE_FIFO_CHECK(); \
+  *gc->fifoData.hwDep.vg96FIFOData.fifoPtr++ =\
+   (((FxU32) ((FxU32) addr) - ((FxU32) gc->lfb_ptr)) >> 2);\
+  *gc->fifoData.hwDep.vg96FIFOData.fifoPtr++ = val;\
+  gc->hwDep.sst96Dep.writesSinceFence+=2;\
+  gc->fifoData.hwDep.vg96FIFOData.fifoSize -= 8;\
+  GLIDE_FIFO_CHECK(); \
+}
+
+#define SST96_STOREF_FIFO(addr,fVal){\
+  GR_ASSERT(!(((FxU32)(gc->fifoData.hwDep.vg96FIFOData.fifoPtr) & 0x7)));\
+  GR_ASSERT(gc->fifoData.hwDep.vg96FIFOData.fifoSize);\
+  P6FENCEFIFO;\
+  DEBUGFIFOFWRITE((addr), fVal, gc->fifoData.hwDep.vg96FIFOData.fifoPtr);\
+  GLIDE_FIFO_CHECK(); \
+  *gc->fifoData.hwDep.vg96FIFOData.fifoPtr++ =\
+   (((addr) - ((FxU32) gc->lfb_ptr)) >> 2);\
+  *((float *)gc->fifoData.hwDep.vg96FIFOData.fifoPtr) = fVal;\
+    gc->fifoData.hwDep.vg96FIFOData.fifoPtr++;\
+  gc->hwDep.sst96Dep.writesSinceFence+=2;\
+  gc->fifoData.hwDep.vg96FIFOData.fifoSize -= 8;\
+  GLIDE_FIFO_CHECK(); \
+}
+
+#define SET16(d,s)      SST96_STORE_FIFO((&d), (FxU32) s)
+#define SET(d,s)        SST96_STORE_FIFO((&d),s)
+#define SETF(d,s)       SST96_STOREF_FIFO(((FxU32)(&(d))), s)
+
+/*
+**  Here are some macro for the very few times when we must perform a
+**  direct write of the hardware--even when using the memory-backed
+**  command FIFO.
+*/
+#ifndef GDBG_INFO_ON
+#define SET_DIRECT(d,s) (hw->d) = (s)
+#define SETF_DIRIECT(d,s) *((float *) &hw->d) = s
+#else
+#define REGOFFSET(d) (((FxU32) &hw->d - (FxU32) hw) >> 2)
+#define SET_DIRECT(d,s)\
+  GDBG_INFO((120, "DIRECT SET of register 0x%x with value 0x%x\n",\
+             REGOFFSET(d), s));\
+  (hw->d) = (s)
+#define SETF_DIRECT(d,s)\
+  GDBG_INFO((120, "DIRECT SET of register 0x%x with value %4.4f\n",\
+             REGOFFSET(d), s));\
+  *((float *) &hw->d) = s
+#endif
+
+#else
+
+#ifndef GDBG_INFO_ON
+#define GET(s)          s
+#define SET(d,s)        d = s
+#define SET16(d,s)      d = s
+#define SETF(d,s)       (*(float *)&(d)) = s
+#else
+#undef  GET
+
+#define GET(s)          _grSst96Load32(&s)
+#define SET(d,s)        _grSst96Store32((FxU32 *)&d, s)
+#define SET16(d,s)      _grSst96Store16(&d,s)
+#define SETF(d,s)       _grSst96Store32F((float *) &d, s)
+#endif /* GDBG_INFO_ON */
+#endif /* SST96_FIFO */
+
+#endif /* defined(SST96) */
+
+#if defined(GLIDE_DEBUG) && !defined(SST96)
+  extern FxU32 GR_CDECL _GR_GET(void *);
+  extern void GR_CDECL _GR_SET16(void *, unsigned short);
+  extern void GR_CDECL _GR_SET(void *, unsigned long);
+  extern void GR_CDECL _GR_SETF(void *, float);
+
+  #define GR_GET(s)     _GR_GET(&(s))
+  #define GR_SET(d,s)   {_GR_SET(&(d),s); SET(d,s); GR_INC_SIZE(4);}
+  #define GR_SETF(d,s)  {_GR_SETF(&(d),s); SETF(d,s); GR_INC_SIZE(4);}
+  #define GR_SET16(d,s) {_GR_SET16(&(d),s); SET16(d,s); GR_INC_SIZE(2);}
+#else
+  #define GR_GET(s)     GET(s)
+  #define GR_SET(d,s)   {SET(d,s); GR_INC_SIZE(4);}
+  #define GR_SETF(d,s)  {SETF(d,s); GR_INC_SIZE(4);}
+  #define GR_SET16(d,s) {SET16(d,s); GR_INC_SIZE(2);}
+#endif
+
+
+
+#define VG96_REGISTER_OFFSET    0x400000
+#define VG96_TEXTURE_OFFSET     0x600000
+/* make SST96 addresses */
+#define SST96_REG_PTR(a) \
+        ((FxU32 *) (((FxU32) a) + VG96_REGISTER_OFFSET))
+#define SST96_LFB_PTR(a) \
+        ((FxU32 *) a)
+#define SST96_TEX_PTR(a) \
+        ((FxU32 *) (((FxU32) a) + VG96_TEXTURE_OFFSET))
+
+void rle_decode_line_asm(FxU16 *tlut,FxU8 *src,FxU16 *dest);
+
+extern FxU16 rle_line[256];
+extern FxU16 *rle_line_end;
+
+#define RLE_CODE                        0xE0
+#define NOT_RLE_CODE            31
+
+#ifdef  __WATCOMC__
+#pragma aux rle_decode_line_asm parm [edx] [edi] [esi] value [edi] modify exact [eax ebx ecx edx esi edi] = \
+"  next_pixel:                   "  \
+"  xor   ecx,ecx                 "  \
+"  mov   al,byte ptr[edi]        "  \
+"  mov   cl,byte ptr[edi]        "  \
+"  inc   edi                     "  \
+"                                "  \
+"  and   al,0xE0                 "  \
+"  cmp   al,0xE0                 "  \
+"  jne   unique                  "  \
+"                                "  \
+"  and   cl,0x1F                 "  \
+"  mov   al,cl                   "  \
+"  jz    done_rle                "  \
+"                                "  \
+"  mov   cl,byte ptr[edi]        "  \
+"  inc   edi                     "  \
+"  mov   bx,word ptr[edx+ecx*2]  "  \
+"                                "  \
+"  copy_block:                   "  \
+"  mov   word ptr[esi],bx        "  \
+"  add   esi,0x2                 "  \
+"  dec   al                      "  \
+"  jz    next_pixel              "  \
+"  jmp   copy_block              "  \
+"                                "  \
+"  unique:                       "  \
+"  mov   bx,word ptr[edx+ecx*2]  "  \
+"  mov   word ptr[esi],bx        "  \
+"  add   esi,0x2                 "  \
+"  jmp   next_pixel              "  \
+"  done_rle:                     "; 
+#endif /* __WATCOMC__ */
+
+#endif /* __FXGLIDE_H__ */
+
Index: trunk/src/opengl/glide/sst1/glide/fxinline.h
===================================================================
--- trunk/src/opengl/glide/sst1/glide/fxinline.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/fxinline.h	(revision 2885)
@@ -0,0 +1,27 @@
+/*
+ * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ * FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ *
+ * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ * TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ * THE UNITED STATES.  
+ *
+ * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+ */
+
+#ifndef __FX_INLINE_H__
+#define __FX_INLINE_H__
+
+/* The # of 2-byte entries in the hw fog table */
+#define kInternalFogTableEntryCount 0x40UL
+
+#endif /* __FX_INLINE_H__ */
Index: trunk/src/opengl/glide/sst1/glide/g3df.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/g3df.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/g3df.c	(revision 2885)
@@ -0,0 +1,526 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/g3df.c,v 1.1 2000-02-25 00:31:12 sandervl Exp $
+** $Log: g3df.c,v $
+** Revision 1.1  2000-02-25 00:31:12  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 6     3/09/97 10:31a Dow
+ * Added GR_DIENTRY for di glide functions
+**
+*/
+#include <stdio.h>
+#include <string.h>
+
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+#ifdef __linux__
+#include <ctype.h>
+#endif
+
+extern const int _grMipMapHostWH[GR_ASPECT_1x8+1][GR_LOD_1+1][2];
+extern FxU32 _gr_aspect_index_table[];
+extern FxU32 _grMipMapHostSize[4][16];
+
+static FxU16 ReadDataShort( FILE * );
+static FxU32 ReadDataLong( FILE * );
+static void  Read8Bit( FxU8 *dst, FILE *image, int small_lod, int large_lod, GrAspectRatio_t aspect );
+static void  Read16Bit( FxU16 *dst, FILE *image, int small_lod, int large_lod, GrAspectRatio_t aspect );
+
+#if ( ( GLIDE_PLATFORM & ( GLIDE_OS_DOS32 | GLIDE_OS_WIN32 ) ) != 0 )
+const char *openmode = "rb";
+#else
+const char *openmode = "r";
+#endif
+
+typedef struct
+{
+  const char        *name;
+  GrTextureFormat_t  fmt;
+  FxBool             valid;
+} CfTableEntry;
+
+#ifdef __linux__
+static void strupr(char *str) {
+  while (*str) {
+    if (islower(*str)) *str=toupper(*str);
+    str++;
+  }
+}
+#endif
+
+/*---------------------------------------------------------------------------
+** gu3dfGetInfo
+*/
+GR_DIENTRY(gu3dfGetInfo, FxBool,
+           ( const char *FileName, Gu3dfInfo *Info ))
+{
+  FILE *image_file;
+  FxU32 index, i;
+  FxU32 newlines = 0;
+  char  version[5];
+  char  color_format[10];
+  int   aspect_width, aspect_height;
+  char  buffer[100];
+  int   small_lod, large_lod;
+  FxBool ratio_found = FXFALSE;
+  FxBool format_found = FXFALSE;
+  GrAspectRatio_t wh_aspect_table[] =
+  {
+    GR_ASPECT_1x1,
+    GR_ASPECT_1x2,
+    GR_ASPECT_1x4,
+    GR_ASPECT_1x8
+  };
+  GrAspectRatio_t hw_aspect_table[] =
+  {
+    GR_ASPECT_1x1,
+    GR_ASPECT_2x1,
+    GR_ASPECT_4x1,
+    GR_ASPECT_8x1
+  };
+  CfTableEntry cftable[] = 
+  {
+      { "I8",       GR_TEXFMT_INTENSITY_8,        FXTRUE },
+      { "A8",       GR_TEXFMT_ALPHA_8,            FXTRUE },
+      { "AI44",     GR_TEXFMT_ALPHA_INTENSITY_44, FXTRUE },
+      { "YIQ",      GR_TEXFMT_YIQ_422,            FXTRUE },
+      { "RGB332",   GR_TEXFMT_RGB_332,            FXTRUE },
+      { "RGB565",   GR_TEXFMT_RGB_565,            FXTRUE },
+      { "ARGB8332", GR_TEXFMT_ARGB_8332,          FXTRUE },
+      { "ARGB1555", GR_TEXFMT_ARGB_1555,          FXTRUE },
+      { "AYIQ8422", GR_TEXFMT_AYIQ_8422,          FXTRUE },
+      { "ARGB4444", GR_TEXFMT_ARGB_4444,          FXTRUE },
+      { "AI88",     GR_TEXFMT_ALPHA_INTENSITY_88, FXTRUE },
+      { "P8",       GR_TEXFMT_P_8,                FXTRUE },
+      { "AP88",     GR_TEXFMT_AP_88,              FXTRUE },
+      { 0, 0, FXFALSE }
+  };
+
+  GDBG_INFO((81,"gu3dfGetInfo(%s,0x%x)\n",FileName,Info));
+  /*
+  ** open the filen
+  */
+  if( ( image_file = fopen( FileName, openmode ) ) == NULL )
+    return FXFALSE;
+
+  /*
+  ** check header
+  */
+  index=0;
+  while(newlines<4)  /* Read the header into a buffer. */
+    if((buffer[index++]=getc(image_file))=='\n')
+      {
+    newlines++;
+    buffer[index-1] = ' ';
+      }
+  buffer[--index] = 0;
+
+  /*
+  ** grab statistics out of the header
+  */
+  if( sscanf(buffer,"3df v%s %s lod range: %i %i aspect ratio: %i %i\n",
+         &version,
+          color_format,
+         &small_lod, &large_lod,
+         &aspect_width, &aspect_height ) == 0 )
+    return FXFALSE;
+
+  /*
+  ** determine aspect ratio, height, and width
+  */
+  i = 0;
+  ratio_found = FXFALSE;
+  while ( ( i < 4 ) && ( !ratio_found ) )
+  {
+    if ( ( aspect_width << i ) == aspect_height )
+    {
+      Info->header.aspect_ratio = wh_aspect_table[i];
+      ratio_found = FXTRUE;
+    }
+    i++;
+  }
+  i = 0;
+  while ( ( i < 4 ) && ( !ratio_found ) )
+  {
+    if ( ( aspect_height << i ) == aspect_width )
+    {
+      Info->header.aspect_ratio = hw_aspect_table[i];
+      ratio_found = FXTRUE;
+    }
+    i++;
+  }
+  if ( !ratio_found )
+    return FXFALSE;
+
+  /*
+  ** determine height and width of the mip map
+  */
+  if ( aspect_width >= aspect_height )
+  {
+    Info->header.width  = large_lod;
+    Info->header.height = large_lod / aspect_width;
+  }
+  else
+  {
+    Info->header.height = large_lod;
+    Info->header.width  = large_lod / aspect_height;
+  }
+
+
+  /*
+  ** calculate proper LOD values
+  */
+  switch ( small_lod )
+  {
+     case 1:
+       Info->header.small_lod = GR_LOD_1;
+       break;
+     case 2:
+       Info->header.small_lod = GR_LOD_2;
+       break;
+     case 4:
+       Info->header.small_lod = GR_LOD_4;
+       break;
+     case 8:
+       Info->header.small_lod = GR_LOD_8;
+       break;
+     case 16:
+       Info->header.small_lod = GR_LOD_16;
+       break;
+     case 32:
+       Info->header.small_lod = GR_LOD_32;
+       break;
+     case 64:
+       Info->header.small_lod = GR_LOD_64;
+       break;
+     case 128:
+       Info->header.small_lod = GR_LOD_128;
+       break;
+     case 256:
+       Info->header.small_lod = GR_LOD_256;
+       break;
+  }
+
+  switch ( large_lod )
+  {
+     case 1:
+       Info->header.large_lod = GR_LOD_1;
+       break;
+     case 2:
+       Info->header.large_lod = GR_LOD_2;
+       break;
+     case 4:
+       Info->header.large_lod = GR_LOD_4;
+       break;
+     case 8:
+       Info->header.large_lod = GR_LOD_8;
+       break;
+     case 16:
+       Info->header.large_lod = GR_LOD_16;
+       break;
+     case 32:
+       Info->header.large_lod = GR_LOD_32;
+       break;
+     case 64:
+       Info->header.large_lod = GR_LOD_64;
+       break;
+     case 128:
+       Info->header.large_lod = GR_LOD_128;
+       break;
+     case 256:
+       Info->header.large_lod = GR_LOD_256;
+       break;
+  }
+
+  /*
+  ** determine the color format of the input image
+  */
+  strupr( color_format );
+
+  i = 0;
+  format_found = FXFALSE;
+  while ( ( cftable[i].name != 0 ) && ( !format_found ) )
+  {
+    if ( strcmp( color_format, cftable[i].name ) == 0 )
+    {
+      Info->header.format = cftable[i].fmt;
+      format_found = FXTRUE;
+    }
+    i++;
+  }
+
+  /*
+  ** close the input file
+  */
+  fclose( image_file );
+
+  if ( format_found ) {
+      FxI32 lod;
+      Info->mem_required = 0;
+      for( lod = Info->header.large_lod; lod <= Info->header.small_lod; lod++ ) {
+          Info->mem_required +=
+          _grMipMapHostSize[_gr_aspect_index_table[Info->header.aspect_ratio]]
+                           [lod] << (Info->header.format>=GR_TEXFMT_16BIT);
+      }
+  }
+
+  return format_found;
+}
+
+/*---------------------------------------------------------------------------
+** gu3dfLoad
+*/
+GR_DIENTRY(gu3dfLoad, FxBool, ( const char *filename, Gu3dfInfo *info ))
+{
+  FILE *image_file  = 0;
+  FxU32 index       = 0;
+  FxU32 newlines    = 0;
+  char  buffer[100] = "";
+
+  GDBG_INFO((81,"gu3dfLoad(%s,0x%x)\n",filename,info));
+  /*
+  ** open the file
+  */
+  if ( ( image_file = fopen( filename, openmode ) ) == NULL )
+    return FXFALSE;
+
+  /*
+  ** examine the header
+  */
+  index = 0;
+  while ( newlines < 4 )
+  {
+    if ( ( buffer[index++] = getc( image_file ) ) == '\n')
+    {
+      newlines++;
+      buffer[index-1] = ' ';
+    }
+  }
+  buffer[--index] = 0;
+
+  /*
+  ** If necessary, read in the YIQ decompression table
+  */
+  if ( ( info->header.format == GR_TEXFMT_YIQ_422 ) ||
+       ( info->header.format == GR_TEXFMT_AYIQ_8422 ) )
+  {
+    /*
+    ** read in Y
+    */
+    for ( index = 0; index < 16; index++ )
+      info->table.nccTable.yRGB[index] = ( ( FxI16 ) ReadDataShort( image_file ) ) & 0xFF;
+
+    /*
+    ** read in I
+    */
+    for ( index = 0; index < 4; index++ )
+    {
+      info->table.nccTable.iRGB[index][0] = ( ( FxI16 ) ReadDataShort( image_file ) ) & 0x1FF;
+      info->table.nccTable.iRGB[index][1] = ( ( FxI16 ) ReadDataShort( image_file ) ) & 0x1FF;
+      info->table.nccTable.iRGB[index][2] = ( ( FxI16 ) ReadDataShort( image_file ) ) & 0x1FF;
+    }
+
+    /*
+    ** read in Q
+    */
+    for ( index = 0; index < 4; index++ )
+    {
+      info->table.nccTable.qRGB[index][0] = ( ( FxI16 ) ReadDataShort( image_file ) ) & 0x1FF;
+      info->table.nccTable.qRGB[index][1] = ( ( FxI16 ) ReadDataShort( image_file ) ) & 0x1FF;
+      info->table.nccTable.qRGB[index][2] = ( ( FxI16 ) ReadDataShort( image_file ) ) & 0x1FF;
+    }
+
+    /*
+    ** pack the table Y entries
+    */
+    for ( index = 0; index < 4; index++ )
+    {
+       FxU32 packedvalue;
+
+       packedvalue  = ( ( FxU32 ) info->table.nccTable.yRGB[index*4+0] );
+       packedvalue |= ( ( FxU32 ) info->table.nccTable.yRGB[index*4+1] ) << 8;
+       packedvalue |= ( ( FxU32 ) info->table.nccTable.yRGB[index*4+2] ) << 16;
+       packedvalue |= ( ( FxU32 ) info->table.nccTable.yRGB[index*4+3] ) << 24;
+                                           
+       info->table.nccTable.packed_data[index] = packedvalue;
+    }
+
+    /*
+    ** pack the table I entries
+    */
+    for ( index = 0; index < 4; index++ )
+    {
+       FxU32 packedvalue;
+
+       packedvalue  = ( ( FxU32 ) info->table.nccTable.iRGB[index][0] ) << 18;
+       packedvalue |= ( ( FxU32 ) info->table.nccTable.iRGB[index][1] ) << 9;
+       packedvalue |= ( ( FxU32 ) info->table.nccTable.iRGB[index][2] ) << 0;
+
+       info->table.nccTable.packed_data[index+4] = packedvalue;
+    }
+
+    /*
+    ** pack the table Q entries
+    */
+    for ( index = 0; index < 4; index++ )
+    {
+       FxU32 packedvalue;
+
+       packedvalue  = ( ( FxU32 ) info->table.nccTable.qRGB[index][0] ) << 18;
+       packedvalue |= ( ( FxU32 ) info->table.nccTable.qRGB[index][1] ) << 9;;
+       packedvalue |= ( ( FxU32 ) info->table.nccTable.qRGB[index][2] ) << 0;
+
+       info->table.nccTable.packed_data[index+8] = packedvalue;
+    }
+  }
+
+  /*
+  ** If necessary, read in the Palette
+  */
+  if ( ( info->header.format == GR_TEXFMT_P_8 ) ||
+       ( info->header.format == GR_TEXFMT_AP_88 ) ) {
+      FxU32 i;
+      for( i = 0; i < 256; i++ )
+          info->table.palette.data[i] = ReadDataLong( image_file );
+  }
+
+  /*
+  ** Read in the image
+  */
+  switch ( info->header.format )
+  {
+  case GR_TEXFMT_INTENSITY_8:
+  case GR_TEXFMT_ALPHA_8:
+  case GR_TEXFMT_ALPHA_INTENSITY_44:
+  case GR_TEXFMT_YIQ_422:
+  case GR_TEXFMT_RGB_332:
+  case GR_TEXFMT_P_8:
+    Read8Bit( (FxU8 *)info->data, image_file, info->header.small_lod, info->header.large_lod, info->header.aspect_ratio );
+    break;
+  case GR_TEXFMT_RGB_565:
+  case GR_TEXFMT_ARGB_8332:
+  case GR_TEXFMT_ARGB_1555:
+  case GR_TEXFMT_AYIQ_8422:
+  case GR_TEXFMT_ARGB_4444:
+  case GR_TEXFMT_ALPHA_INTENSITY_88:
+  case GR_TEXFMT_AP_88:
+    Read16Bit( (FxU16 *)info->data, image_file, info->header.small_lod, info->header.large_lod, info->header.aspect_ratio );
+    break;
+
+  default:
+    return FXFALSE;
+  }
+
+  /*
+  ** close the file
+  */
+  fclose( image_file );
+
+  return FXTRUE;
+}
+
+/*
+** Read8Bit
+**
+** Read in an 8-bit texture map, unpacked.
+*/
+static void Read8Bit( FxU8 *data, FILE *image_file, int small_lod, int large_lod, GrAspectRatio_t aspect_ratio )
+{
+  int lod;
+  int width, height;
+
+  for ( lod = large_lod; lod <= small_lod; lod++ )
+  {
+    width  = _grMipMapHostWH[aspect_ratio][lod][0];
+    height = _grMipMapHostWH[aspect_ratio][lod][1];
+
+    fread( data, sizeof( char ), width*height, image_file );
+    data += width*height;
+  }
+}
+
+/*
+** Read16Bit
+**
+** Read in a 16-bit texture map, unpacked.
+*/
+static void Read16Bit( FxU16 *data, FILE *image_file, int small_lod, int large_lod, GrAspectRatio_t aspect_ratio )
+{
+  int index;
+  int lod;
+  int width, height;
+
+  for ( lod = large_lod; lod <= small_lod; lod++ )
+  {
+    width  = _grMipMapHostWH[aspect_ratio][lod][0];
+    height = _grMipMapHostWH[aspect_ratio][lod][1];
+
+    for ( index = 0; index < ( width * height ); index++ )
+    {
+      *data = ReadDataShort( image_file );
+      data++;
+    }
+  }
+}
+
+/*
+** FxU16 ReadDataShort
+*/
+static FxU16 ReadDataShort( FILE *fp )
+{
+  FxU16 value;
+
+  /*
+  ** read in the MSB
+  */
+  value = ( ( FxU16 ) getc( fp ) ) << 8;
+
+  /*
+  ** read in the LSB
+  */
+  value |= ( getc( fp ) & 0x00FF );
+
+  return value;
+}
+
+/*
+** ReadDataLong
+*/
+static FxU32 ReadDataLong( FILE *fp )
+{
+    FxU32 data;
+    FxU8 byte[4];
+
+    fread(byte, 4, 1, fp);
+    data = (((FxU32) byte[0]) << 24) |
+           (((FxU32) byte[1]) << 16) |
+           (((FxU32) byte[2]) <<  8) |
+            ((FxU32) byte[3]);
+
+    return data;
+}
+
+
+
Index: trunk/src/opengl/glide/sst1/glide/gaa.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gaa.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gaa.c	(revision 2885)
@@ -0,0 +1,849 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gaa.c,v 1.1 2000-02-25 00:31:12 sandervl Exp $
+** $Log: gaa.c,v $
+** Revision 1.1  2000-02-25 00:31:12  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 13    8/21/97 2:26p Atai
+ * fix FIFO size
+ * 
+ * 12    7/25/97 2:55p Atai
+ * Remove slope calculation in edge sense code, use cross product instead.
+ * Move grAADrawTriEdgeSense() 1/area calculation after pci write command.
+ * 
+ * 11    7/24/97 5:59p Atai
+ * optimize grAADrawPoint, grAADrawLine and grAADrawTriangle for sst1
+ * 
+ * 10    3/04/97 9:08p Dow
+ * Neutered multiplatform multiheaded monster
+ * 
+ * 9     12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+**
+*/
+
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+#define FARRAY(p,i) (*(float *)((i)+(int)(p)))
+
+/*
+** -----------------------------------------------------------------------
+**
+** Antialiasing rendering functions
+**
+** -----------------------------------------------------------------------
+*/
+
+/*---------------------------------------------------------------------------
+** grAADrawPoint
+**
+**   |-w-|
+**   A---B -
+**   |\ /| |
+**   | E | h
+**   |/ \| |
+**   D --C -
+**   w = h = 2pixels
+**
+** pci write command
+** 1st triangle EDA
+**     8 + 3 * n
+** 2nd triangle BEC
+**     8
+** 3rd triangle AED
+**     5
+** 4th triangle ABE
+**     8
+** total = 29 + 3 * n
+*/
+GR_ENTRY(grAADrawPoint, void, ( const GrVertex *e )) 
+{
+  int i, j;
+  float *fp;
+  struct dataList_s *dlp;
+  float dp;
+  float PX, PY;
+
+  GR_BEGIN("grAADrawPoint",94,((_GlideRoot.curTriSize - _GlideRoot.curTriSizeNoGradient) >> 3) * 12 + 116);
+
+  PX = e->x;
+  PY = e->y;
+  j = *(long *)&e->a;
+  j ^= 0x80000000;
+
+  /* 1st triangle EDA */
+  GR_SETF(hw->FvA.x, PX);
+  dp = PX - _GlideRoot.pool.f1;
+  GR_SETF(hw->FvB.x, dp);
+  dp = PX + _GlideRoot.pool.f1;
+  GR_SETF(hw->FvC.x, dp);
+  dlp = gc->dataList;
+  GR_SETF(hw->FvA.y, PY);
+  dp = PY + _GlideRoot.pool.f1;
+  GR_SETF(hw->FvB.y, dp);
+  i = dlp->i;
+  GR_SETF(hw->FvC.y, dp);
+  while (i) {
+    fp = dlp->addr;
+    if (i & 1) {     /* packer bug check */
+      if (i & 2) P6FENCE;
+      GR_SETF( fp[0], 0.0f);
+      if (i & 2) P6FENCE;
+      dlp++;
+      i = dlp->i;
+    }
+    else {
+      dp = FARRAY(e,i);
+      GR_SETF( fp[0], dp );
+      GR_SETF( fp[DPDX_OFFSET>>2] , _GlideRoot.pool.f0);
+      dlp++;
+      i = dlp->i;
+      GR_SETF( fp[DPDY_OFFSET>>2] , _GlideRoot.pool.f0 );
+    }
+  }
+  GR_SET(hw->Fdady, j);
+  P6FENCE_CMD( GR_SET(hw->triangleCMD, 0xffffffff) );
+
+  /* 2nd triangle BEC */
+  dp = PX + _GlideRoot.pool.f1;
+  GR_SETF(hw->FvA.x, dp);
+  GR_SETF(hw->FvB.x, PX);
+  dp = PY - _GlideRoot.pool.f1;
+  GR_SETF(hw->FvA.y, dp);
+  GR_SETF(hw->FvB.y, PY);
+
+  GR_SET(hw->Fa, 0);
+  GR_SET(hw->Fdadx, j);
+  GR_SET(hw->Fdady, 0);
+  P6FENCE_CMD( GR_SET(hw->triangleCMD, 0xffffffff) );
+
+  /* 3rd triangle AED */
+  dp = PX - _GlideRoot.pool.f1;
+  GR_SETF(hw->FvA.x, dp);
+  GR_SETF(hw->FvC.x, dp);
+
+  j ^= 0x80000000;
+  GR_SET(hw->Fa, 0);
+  GR_SET(hw->Fdadx, j);
+  P6FENCE_CMD( GR_SET(hw->triangleCMD, 1) );
+
+  /* 4th triangle ABE */
+  dp = PX + _GlideRoot.pool.f1;
+  GR_SETF(hw->FvB.x, dp);
+  GR_SETF(hw->FvC.x, PX);
+  dp = PY - _GlideRoot.pool.f1;
+  GR_SETF(hw->FvB.y, dp);
+  GR_SETF(hw->FvC.y, PY);
+
+  GR_SET(hw->Fa, 0);
+  GR_SET(hw->Fdadx, 0);
+  GR_SET(hw->Fdady, j);
+  P6FENCE_CMD( GR_SET(hw->triangleCMD, 1) );
+
+  GR_END();
+} /* grAADrawPoint */
+
+static void grSetVertexParameter(const GrVertex *v1)
+{
+  GR_DCL_GC;
+  GR_DCL_HW;
+  struct dataList_s *dlp;
+  int i;
+  float *fp, dp;
+
+  dlp = gc->dataList;
+  i = dlp->i;
+
+  while (i) {
+    fp = dlp->addr;
+    if (i & 1) {     /* packer bug check */
+      if (i & 2) P6FENCE;
+      GR_SETF( fp[0], 0.0f);
+      if (i & 2) P6FENCE;
+      dlp++;
+      i = dlp->i;
+    }
+    else {
+      dp = FARRAY(v1,i);
+      GR_SETF( fp[0], dp );
+      dlp++;
+      i = dlp->i;
+    }
+  }
+}
+
+/*---------------------------------------------------------------------------
+** grAADrawLine
+**  A(x1,y1-1.0)+
+**              |  \
+**              | \   \
+**              |    \   \
+**     V1(x1,y1)*           \
+**              |  *     \     \
+**              |  \  *           \
+**              |             \      \
+**  E(x1,y1+1.0)+       \  *      \     \
+**                 \          *            +B(x2,y2-1.0)
+**                    \      \    *   \    |
+**                       \                 |
+**                          \     \    *  \|
+**                             \           +V2(x2,y2)
+**                                \   \    |
+**                                   \     |
+**                                      \ \|
+**                                         +F(x2,y2+1.0)
+**                                         
+** pci write command (x major line )
+** 1st triangle A-B-V2
+**     10 + 3 * n
+** 2nd triangle A-V1-V2
+**     6 + n
+** 3rd triangle V1-E-F
+**     6 + n
+** 4th triangle V1-V2-F
+**     5 + n
+** total = 
+*/
+GR_ENTRY(grAADrawLine, void, ( const GrVertex *v1, const GrVertex *v2 )) 
+{
+  float           adx;         /* |dX| */
+  const GrVertex *tv;
+  struct dataList_s *dlp;
+  int i;
+  float *fp, dp;
+  float tmp1, tmp2;
+  float dx, dy;           /* delta X and Y */
+
+  GR_BEGIN("grAADrawLine",95, ((_GlideRoot.curTriSize - _GlideRoot.curTriSizeNoGradient) >> 3) * 24 + 108);
+
+  GDBG_INFO((95,"grAADrawLine(0x%x,0x%x)\n",v1,v2));
+
+  /* turn off culling so triangles unconditionally draw */
+
+  /* draw from low Y to high Y */
+  if ( v2->y < v1->y ) {
+    tv = v1; v1 = v2; v2 = tv;
+  }
+  
+  /* compute deltas and absolute deltas */
+  dx = adx = v1->x - v2->x;
+  dy = v2->y - v1->y;
+  if ( adx < 0 )
+    adx = -adx;
+  
+  if ( adx >= dy ) {           /* X major line */
+
+    if (dx == 0.0f)
+      return;
+
+    /* 1st triangle A-B-V2*/
+
+    GR_SETF( hw->FvA.x, v1->x);
+    dx = _GlideRoot.pool.f1 / dx;
+    GR_SETF( hw->FvA.y, v1->y - _GlideRoot.pool.f1);
+    tmp1 = -v1->a * dy;
+    GR_SETF( hw->FvB.x, v2->x);
+    GR_SETF( hw->FvB.y, v2->y - _GlideRoot.pool.f1);
+    tmp2 = -v2->a * dy;
+    GR_SETF( hw->FvC.x, v2->x);
+    dlp = gc->dataList;
+    GR_SETF( hw->FvC.y, v2->y);
+    i = dlp->i;
+    while (i) {
+      fp = dlp->addr;
+      if (i & 1) {     /* packer bug check */
+        if (i & 2) P6FENCE;
+        GR_SETF( fp[0], 0.0f);
+        if (i & 2) P6FENCE;
+        dlp++;
+        i = dlp->i;
+      }
+      else {
+        dp = FARRAY(v1,i);
+	GR_SETF( fp[0], dp );
+	dp -= FARRAY(v2, i);
+	GR_SETF( fp[DPDX_OFFSET>>2] , dp * dx);
+	dlp++;
+	i = dlp->i;
+	GR_SETF( fp[DPDY_OFFSET>>2] , _GlideRoot.pool.f0 );
+      }
+    }
+    GR_SET( hw->Fa , 0 );
+    dp = - tmp2 * dx;
+    GR_SETF( hw->Fdadx , dp );
+    GR_SETF( hw->Fdady , v2->a );
+    P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, -dx ) );
+
+    /* 2nd triangle A-V1-V2*/
+    GR_SETF( hw->FvB.x, v1->x);
+    grSetVertexParameter(v1);
+    GR_SET( hw->Fa , 0 );
+    dp = v1->a - v2->a;
+    GR_SETF( hw->FvB.y, v1->y);
+    dp -= tmp1;
+    GR_SETF( hw->Fdady , v1->a );
+    dp *= dx;
+    GR_SETF( hw->Fdadx , dp );
+    P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, dx ) );
+
+    /* 3rd triangle v1-E-F */
+    GR_SETF( hw->FvA.y, v1->y);
+    GR_SETF( hw->FvB.y, v1->y + _GlideRoot.pool.f1);
+    GR_SETF( hw->FvC.y, v2->y + _GlideRoot.pool.f1);
+
+    grSetVertexParameter(v1);
+
+    GR_SETF( hw->Fdady , -v1->a );
+    dp = tmp1 * dx;
+    GR_SETF( hw->Fdadx , dp );
+    P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, dx ) );
+
+    /* 4th triangle V1-V2-F*/
+    GR_SETF( hw->FvB.x, v2->x);
+    dp = v1->a - v2->a + tmp2;
+    GR_SETF( hw->FvB.y, v2->y);
+    dp *= dx;
+
+    grSetVertexParameter(v1);
+
+    GR_SETF( hw->Fdadx , dp ); 
+    GR_SETF( hw->Fdady , -v2->a );
+    P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, -dx ) );
+
+  } else {                      /* Y major line */
+
+    if (dy == 0.0f)
+      return;
+
+    /* 1st triangle v1-v2-b */
+    GR_SETF( hw->FvA.x, v1->x);
+    tmp1 = v1->a * dx;
+    GR_SETF( hw->FvA.y, v1->y);
+    tmp2 = v2->a * dx;
+    GR_SETF( hw->FvB.x, v2->x);
+    dy = - 1.0f / dy;
+    GR_SETF( hw->FvB.y, v2->y);
+    GR_SETF( hw->FvC.x, v2->x - _GlideRoot.pool.f1);
+    dlp = gc->dataList;
+    GR_SETF( hw->FvC.y, v2->y);
+    i = dlp->i;
+    while (i) {
+      fp = dlp->addr;
+      if (i & 1) {     /* packer bug check */
+	if (i & 2) P6FENCE;
+	GR_SETF( fp[0], 0.0f);
+	if (i & 2) P6FENCE;
+	dlp++;
+	i = dlp->i;
+      }
+      else {
+	dp = FARRAY(v1,i);
+	GR_SETF( fp[0], dp );
+        dp -= FARRAY(v2, i);
+	GR_SETF( fp[DPDX_OFFSET>>2] , _GlideRoot.pool.f0);
+	dlp++;
+	i = dlp->i;
+        GR_SETF( fp[DPDY_OFFSET>>2] , dp * dy );
+      }
+    }
+    dp = (v1->a - tmp2 - v2->a);
+    GR_SETF( hw->Fdadx , v2->a );
+    dp *= dy;
+    GR_SETF( hw->Fdady , dp );
+    P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, -dy ) );
+
+    /* 2nd triangle v1-a-b */
+
+    GR_SETF( hw->FvB.x, v1->x - _GlideRoot.pool.f1);
+    GR_SETF( hw->FvB.y, v1->y);
+    grSetVertexParameter(v1);
+    GR_SETF( hw->Fdadx , v1->a );
+    dp = - tmp1 * dy;
+    GR_SETF( hw->Fdady , dp );
+    P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, dy ) );
+
+    /* 3rd triangle e-v1-v2 */
+    GR_SETF( hw->FvA.x, v1->x + _GlideRoot.pool.f1);
+    dp = (v1->a - v2->a + tmp1);
+    GR_SETF( hw->FvB.x, v1->x);
+    dp *= dy;
+    GR_SETF( hw->FvC.x, v2->x);
+
+    grSetVertexParameter(v1);
+    GR_SET( hw->Fa , 0 );
+    GR_SETF( hw->Fdadx , -v1->a );
+    GR_SETF( hw->Fdady , dp );
+    P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, dy ) );
+
+    /* 4th triangle e-f-v2 */
+    GR_SETF( hw->FvB.x, v2->x + _GlideRoot.pool.f1);
+    GR_SETF( hw->FvB.y, v2->y);
+
+    grSetVertexParameter(v1);
+    GR_SET( hw->Fa , 0 );
+
+    GR_SETF( hw->Fdadx , -v2->a );
+    dp = tmp2 * dy;
+    GR_SETF( hw->Fdady , dp );
+    P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, -dy ) );
+
+  }
+  GR_END();
+} /* grAADrawLine */
+
+typedef enum {
+  aaEdgeSenseTop,
+  aaEdgeSenseLeft,
+  aaEdgeSenseBottom,
+  aaEdgeSenseRight
+} aaEdgeSense;
+
+/*
+**  grAADrawTriEdgeSense
+**
+**  This routine combines aaCalcEdgeSense(), grAADrawTriEdge(), and
+**  grAADrawEdgeTriangle(). The goal is to
+**  1. reduce the number of divide from 3 to 1
+**  2. minimize pci write command.
+*/
+static void
+grAADrawTriEdgeSense(const GrVertex *a,const GrVertex *b,const GrVertex *c)
+{
+  const GrVertex *tv;
+  float dx, dy, m, dp;
+  aaEdgeSense sense;
+
+  GR_BEGIN_NOFIFOCHECK("grAADrawTriEdgeSense",gc->myLevel);
+
+
+  if (a->y >= b->y) {
+    tv = a; a = b; b = tv;
+  }
+  dx = a->x - b->x;
+  dy = a->y - b->y;
+
+  if (dx == 0.f) {
+    if (c->x >  a->x)
+      sense = aaEdgeSenseLeft;
+    else
+      sense =  aaEdgeSenseRight;
+  }
+  else if (dy == 0.0f) {
+    if (c->y > a->y)
+      sense = aaEdgeSenseBottom;
+    else
+      sense = aaEdgeSenseTop;
+  }
+  else {
+    float dcax, dcay, dcbx, dcby, cp;
+    dcax = a->x - c->x;
+    dcay = a->y - c->y;
+    dcbx = b->x - c->x;
+    dcby = b->y - c->y;
+    cp = dcax * dcby - dcay * dcbx;
+
+    if (dx > 0.0f) {
+      if (dx >= -dy)    /* X-major line */
+	sense = (cp > 0) ? aaEdgeSenseTop : aaEdgeSenseBottom;
+      else              /* Y-major line */
+	sense = (cp > 0) ? aaEdgeSenseRight : aaEdgeSenseLeft;
+    }
+    else {
+      if (dx <= dy)     /* X-major line */
+	sense = (cp < 0) ? aaEdgeSenseTop : aaEdgeSenseBottom;
+      else              /* Y-major line */
+	sense = (cp < 0) ? aaEdgeSenseLeft : aaEdgeSenseRight;
+    }
+  }
+
+  switch (sense) {
+  case aaEdgeSenseTop:
+    /* pci comamnd 14 + 2 * n */
+    GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSizeNoGradient << 1);
+    GR_SETF( hw->FvA.x, a->x);
+    GR_SETF( hw->FvA.y, a->y);
+    GR_SETF( hw->FvB.x, a->x);
+    GR_SETF( hw->FvC.x, b->x);
+    m = 1.0f / dx;
+    GR_SETF( hw->FvB.y, a->y + _GlideRoot.pool.f1);
+    dp = a->a * dy;
+    GR_SETF( hw->FvC.y, b->y + _GlideRoot.pool.f1);
+    
+    grSetVertexParameter(a);
+    
+    GR_SETF( hw->Fdady, -a->a);
+    dp *= m;
+    GR_SETF( hw->Fdadx, dp);
+    P6FENCE_CMD( GR_SETF( hw->triangleCMD, dx ) );
+      
+    dp = b->a * dy;
+    GR_SETF( hw->FvB.x, b->x);
+    dp = a->a - b->a + dp;
+    GR_SETF( hw->FvB.y, b->y);
+
+    grSetVertexParameter(a);
+    
+    GR_SETF( hw->Fdady, -b->a);
+    dp *= m;
+    GR_SETF( hw->Fdadx, dp);
+    P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dx ) );
+    
+    break;
+    
+  case aaEdgeSenseLeft:
+    /* pci comamnd 16 + 2 * n */
+    GR_SET_EXPECTED_SIZE(8+(_GlideRoot.curTriSizeNoGradient << 1));
+    GR_SETF( hw->FvA.y, a->y);
+    GR_SETF( hw->FvB.x, a->x);
+    GR_SETF( hw->FvB.y, a->y);
+    GR_SETF( hw->FvC.y, b->y);    
+    m = 1.0f / dy;
+    GR_SETF( hw->FvA.x, a->x - _GlideRoot.pool.f1);
+    GR_SETF( hw->FvC.x, b->x - _GlideRoot.pool.f1);
+
+    grSetVertexParameter(a);
+    GR_SET(hw->Fa, 0);
+
+    GR_SETF( hw->Fdadx, a->a);
+    dp = - a->a * dx * m;
+    GR_SETF( hw->Fdady, dp);
+    P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dy ) );
+    
+    GR_SETF( hw->FvA.x, a->x);
+    dp = b->a * dx;
+    GR_SETF( hw->FvB.x, b->x);
+    dp = a->a - dp - b->a;
+    GR_SETF( hw->FvB.y, b->y);
+
+    grSetVertexParameter(a);
+
+    GR_SETF( hw->Fdadx, b->a);
+    dp *= m;
+    GR_SETF( hw->Fdady, dp);
+    P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dy ) );
+    
+    break;
+    
+  case aaEdgeSenseBottom:
+    
+    if (dy < -1.0f) {
+      /* pci comamnd 17 + 2 * n */
+      GR_SET_EXPECTED_SIZE(12+(_GlideRoot.curTriSizeNoGradient << 1));
+      GR_SETF( hw->FvA.x, a->x);
+      GR_SETF( hw->FvB.x, a->x);
+      GR_SETF( hw->FvB.y, a->y);
+      GR_SETF( hw->FvC.x, b->x);      
+      m = 1.0f / dx;
+      GR_SETF( hw->FvA.y, a->y - _GlideRoot.pool.f1);
+      GR_SETF( hw->FvC.y, b->y - _GlideRoot.pool.f1);
+
+      grSetVertexParameter(a);
+      GR_SET(hw->Fa, 0);
+      
+      dp = a->a * dy;
+      dp *= m;
+      GR_SETF( hw->Fdadx, -dp);
+      GR_SETF( hw->Fdady, a->a);
+      P6FENCE_CMD( GR_SETF( hw->triangleCMD, dx ) );
+    
+      GR_SETF( hw->FvA.y, a->y);
+      dp = b->a * dy;
+      GR_SETF( hw->FvB.x, b->x);
+      GR_SETF( hw->FvB.y, b->y - _GlideRoot.pool.f1);
+      dp = a->a - b->a - dp;
+      GR_SETF( hw->FvC.y, b->y);
+      grSetVertexParameter(a);
+      
+      GR_SETF( hw->Fdady, b->a);
+      dp *= m;
+      GR_SETF( hw->Fdadx, dp);
+      P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dx ) );
+    }
+    else if (dy == 0.0f) {
+
+      /* pci comamnd 16 + 2 * n */
+      GR_SET_EXPECTED_SIZE(8+(_GlideRoot.curTriSizeNoGradient << 1));
+      GR_SETF( hw->FvA.x, a->x);
+      GR_SETF( hw->FvC.x, b->x);      
+      GR_SETF( hw->FvC.y, b->y);
+      GR_SETF( hw->FvB.x, b->x);
+      m = 1.0f / dx;
+      GR_SETF( hw->FvA.y, a->y - _GlideRoot.pool.f1);
+      GR_SETF( hw->FvB.y, b->y - _GlideRoot.pool.f1);
+
+      grSetVertexParameter(a);
+      GR_SET(hw->Fa, 0);
+
+      GR_SET( hw->Fdadx, 0);
+      GR_SETF( hw->Fdady, b->a);
+      P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dx ) );
+    
+      GR_SETF( hw->FvB.x, a->x);
+      GR_SETF( hw->FvB.y, a->y);
+      grSetVertexParameter(a);
+      GR_SET(hw->Fa, 0);
+    
+      dp = a->a - b->a;
+      GR_SETF( hw->Fdady, a->a);
+      dp *= m;
+      GR_SETF( hw->Fdadx, dp);
+      P6FENCE_CMD( GR_SETF( hw->triangleCMD, dx ) );
+    }
+    else {
+
+      /* pci comamnd 20 + 2 * n */
+      GR_SET_EXPECTED_SIZE(24+(_GlideRoot.curTriSizeNoGradient << 1));
+      GR_SETF( hw->FvA.x, a->x);
+      GR_SETF( hw->FvB.x, b->x);
+      GR_SETF( hw->FvC.x, a->x);      
+      GR_SETF( hw->FvC.y, a->y);
+      m = 1.0f / dx;
+      GR_SETF( hw->FvA.y, a->y - _GlideRoot.pool.f1);
+      GR_SETF( hw->FvB.y, b->y - _GlideRoot.pool.f1);
+
+      grSetVertexParameter(a);
+      GR_SET(hw->Fa, 0);
+      
+      dp = -a->a * dy * m;
+      GR_SETF( hw->Fdadx, dp);
+      GR_SETF( hw->Fdady, a->a);
+      P6FENCE_CMD( GR_SETF( hw->triangleCMD, -dx ) );
+
+      GR_SETF( hw->FvA.x, b->x);
+      GR_SETF( hw->FvA.y, b->y - _GlideRoot.pool.f1);
+      GR_SETF( hw->FvB.x, a->x);
+      GR_SETF( hw->FvB.y, a->y);
+      dp = b->a * dy;
+      GR_SETF( hw->FvC.x, b->x);      
+      GR_SETF( hw->FvC.y, b->y);
+
+      grSetVertexParameter(b);
+      GR_SET(hw->Fa, 0);
+      dp = a->a - dp - b->a;
+      GR_SETF( hw->Fdady, b->a);
+      dp *= m;
+      GR_SETF( hw->Fdadx, dp);
+      P6FENCE_CMD( GR_SETF( hw->triangleCMD, dx ) );
+    }
+    
+    break;
+  case aaEdgeSenseRight:
+    /* pci comamnd 16 + 2 * n */
+    GR_SET_EXPECTED_SIZE(8+(_GlideRoot.curTriSizeNoGradient << 1));
+    GR_SETF( hw->FvA.y, a->y);
+    GR_SETF( hw->FvB.x, a->x);
+    GR_SETF( hw->FvB.y, a->y);
+    GR_SETF( hw->FvC.y, b->y);
+    m = 1.0f / dy;
+    GR_SETF( hw->FvA.x, a->x + _GlideRoot.pool.f1);
+    GR_SETF( hw->FvC.x, b->x + _GlideRoot.pool.f1);
+
+    grSetVertexParameter(a);
+    GR_SET(hw->Fa, 0);
+
+    dp = a->a * dx;
+    GR_SETF( hw->Fdadx, -a->a);
+    dp *= m;
+    GR_SETF( hw->Fdady, dp);
+    P6FENCE_CMD( GR_SETF( hw->triangleCMD, dy ) );
+    
+    GR_SETF( hw->FvA.x, a->x);
+    dp = b->a * dx;
+    GR_SETF( hw->FvB.x, b->x);
+    dp = dp + a->a - b->a;
+    GR_SETF( hw->FvB.y, b->y);
+    grSetVertexParameter(a);
+    
+    GR_SETF( hw->Fdadx, -b->a);
+    dp *= m;
+    GR_SETF( hw->Fdady, dp);
+    P6FENCE_CMD( GR_SETF( hw->triangleCMD, dy ) );   
+    break;
+  }
+  GR_END_SLOPPY();
+} /* grAADrawTriEdge */
+
+#if 0
+/*
+** aaCalculateSignOfSinTheta
+**  
+*/
+float
+aaCalculateSignOfSinTheta(GrVertex *a, GrVertex *b, GrVertex *c)
+{
+  float
+    x1, y1, x2, y2;
+
+  /*
+     Now, we make two vectors: ab [x1 y1] and ac [x2 y2]
+     Fromt the cross product, we know that
+     
+     x1*y2 - x2*y1 = |ab|*|ac|*sin(theta), where theta is the angle
+     between the two lines.  If sin(theta) > 0, c is above the line ab,
+     and if it's negative, it's below ab.
+     */
+  x1 = b->x - a->x;
+  y1 = b->y - a->y;
+  
+  x2 = c->x - a->x;
+  y2 = c->y - a->y;
+
+  return ((x1 * y2) - (x2 * y1));
+  
+} /* aaCalculateSignOfSinTheta */
+#endif
+
+
+/*---------------------------------------------------------------------------
+** grAADrawTriangle
+**
+**  NOTE:  This doesn't quite work yet
+*/
+GR_ENTRY(grAADrawTriangle, void, (const GrVertex *a, const GrVertex *b, const GrVertex *c, FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias ) ) 
+{
+  FxU32
+    fbzMode,                    /* What we write to fbzMode */
+    fbzModeOld;                 /* Squirrel away current fbzMode */
+
+  GR_BEGIN_NOFIFOCHECK("grAADrawTriangle",96);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x,0x%x,0x%x,%d,%d,%d)\n",
+                  a,b,c,ab_antialias,bc_antialias,ca_antialias));
+
+  fbzModeOld = gc->state.fbi_config.fbzMode;
+  if ( TRISETUP ( a, b, c ) <= 0) {/* backfaced or zero area */
+    GR_END();
+    return;
+  }
+  /* Disable depth buffer writes for edge triangles */
+  fbzMode = fbzModeOld;
+  fbzMode &= ~(SST_ZAWRMASK);
+  GR_SET_EXPECTED_SIZE(4);
+  GR_SET( hw->fbzMode, fbzMode );
+  GR_CHECK_SIZE();
+
+  if ( ab_antialias ) {
+    grAADrawTriEdgeSense(a, b, c);
+  }
+  
+  if ( bc_antialias ) {
+    grAADrawTriEdgeSense(b, c, a);
+  }
+  
+  if ( ca_antialias ) {
+    grAADrawTriEdgeSense(c, a, b);
+  }
+
+  /* Restore the old fbzMode */
+  GR_SET_EXPECTED_SIZE(4);
+  GR_SET( hw->fbzMode, fbzModeOld );
+  GR_END();
+} /* grAADrawTriangle */
+
+/*---------------------------------------------------------------------------
+**  grAADrawPolygon
+**  NOTE:  This routine does not do backface culling!!!
+*/
+
+GR_ENTRY(grAADrawPolygon, void, (const int nverts, const int ilist[], const GrVertex vlist[])) 
+{
+  int
+    i = 1;                      /* index into ilist */
+  const GrVertex
+    *a, *b, *c;                 /* What we end up sending */
+
+  GR_BEGIN_NOFIFOCHECK("grAADrawPolygon",97);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x,0x%x)\n",nverts,ilist,vlist));
+
+  for (i=1; i < nverts - 1; i++) {
+    a = &vlist[ilist[0]];
+    b = &vlist[ilist[i]];
+    c = &vlist[ilist[i+1]];
+    if ( TRISETUP ( a, b, c ) <= 0 ) /* backfaced or zero area */
+      continue;
+
+    /*
+    **  Always draw the BC edge.
+    **  On the first triangle, additionally draw the AB edge.
+    **  On the last triangle, draw the CA edge.
+    */
+    if (i == 1) {
+      grAADrawTriEdgeSense(a, b, c);
+
+    } else if (i == (nverts - 2)) {
+      grAADrawTriEdgeSense(c, a, b);
+    } 
+
+    grAADrawTriEdgeSense(b, c, a);
+
+  }
+  GR_END();
+} /* grAADrawPolygon */
+
+/*---------------------------------------------------------------------------
+**  grAADrawPolygonVertexList
+**  NOTE:  This routine does not do backface culling!!!
+*/
+
+GR_ENTRY(grAADrawPolygonVertexList, void, (const int nverts, const GrVertex vlist[])) 
+{
+  int
+    i = 1;                      /* index into ilist */
+  const GrVertex
+    *a, *b, *c;                 /* What we end up sending */
+  FxI32
+    res;
+
+  GR_BEGIN_NOFIFOCHECK("grAADrawPolygonVertexList",97);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x)\n",nverts,vlist));
+
+  for (i=1; i < nverts - 1; i++) {
+    a = &vlist[0];
+    b = &vlist[i];
+    c = &vlist[i+1];
+
+    res = TRISETUP ( a, b, c );
+    if (res <= 0)               /* backfaced or zero area */
+      continue;
+
+    /*
+    **  Always draw the BC edge.
+    **  On the first triangle, additionally draw the AB edge.
+    **  On the last triangle, draw the CA edge.
+    */
+    if (i == 1) {
+      grAADrawTriEdgeSense(a, b, c);
+    } else if (i == (nverts - 2)) {
+      grAADrawTriEdgeSense(c, a, b);
+    } 
+
+    grAADrawTriEdgeSense(b, c, a);
+
+  }
+  GR_END();
+} /* grAADrawPolygonVertexList */
+
+
+
Index: trunk/src/opengl/glide/sst1/glide/gbanner.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gbanner.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gbanner.c	(revision 2885)
@@ -0,0 +1,187 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gbanner.c,v 1.1 2000-02-25 00:31:13 sandervl Exp $
+** $Log: gbanner.c,v $
+** Revision 1.1  2000-02-25 00:31:13  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 9     5/02/97 2:08p Pgj
+ * screen_width/height now FxU32
+ * 
+ * 8     3/16/97 2:24a Jdt
+ * Fixed bug.  Didn't initialize info.
+ * 
+ * 7     3/12/97 11:51p Jdt
+ * Watcom warning.
+ * 
+ * 6     3/12/97 4:20p Jdt
+ * Fixed for VG96 and optimized SST-1
+ * 
+ * 5     2/26/97 11:55a Jdt
+ * Updated banner for new lfb api
+ * 
+ * 4     12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+**
+*/
+#include <3dfx.h>
+#include <glidesys.h>
+
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+#ifdef GLIDE_PLUG
+#include "banner.inc"
+#endif
+
+/* display the translucent 3Dfx powerfield logo */
+void
+_grShamelessPlug( void )
+{
+#ifdef GLIDE_PLUG
+  GrState state;
+  GrLfbInfo_t info;
+
+  GR_BEGIN_NOFIFOCHECK("_grShamelessPlug",80);
+  GDBG_INFO_MORE((gc->myLevel,"()\n"));
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
+  grGlideGetState( &state );
+  grDisableAllEffects();
+
+  grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,
+                 GR_COMBINE_FACTOR_ONE,
+                 GR_COMBINE_LOCAL_CONSTANT,
+                 GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+  grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,
+                 GR_COMBINE_FACTOR_ONE,
+                 GR_COMBINE_LOCAL_NONE,
+                 GR_COMBINE_OTHER_TEXTURE,
+                 FXFALSE );
+  grAlphaBlendFunction( GR_BLEND_SRC_ALPHA,
+                       GR_BLEND_ONE_MINUS_SRC_ALPHA,
+                       GR_BLEND_ZERO, GR_BLEND_ZERO );
+  grClipWindow( 0, 0,
+               gc->state.screen_width - 1,
+               gc->state.screen_height - 1); 
+  grDepthMask(FXFALSE);
+  grDepthBufferFunction(GR_CMP_ALWAYS);
+  grDepthBufferMode( GR_DEPTHBUFFER_DISABLE );
+  
+  grChromakeyValue( 0x0000 );
+  grChromakeyMode( GR_CHROMAKEY_ENABLE );
+  grLfbConstantAlpha( (FxU8) 90);
+  grLfbWriteColorFormat(GR_COLORFORMAT_ARGB);
+
+  /* Attempt to lock with pixpipe enabled */
+  info.size = sizeof( info );
+  if ( grLfbLock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER,
+                  GR_LFBWRITEMODE_565,GR_ORIGIN_UPPER_LEFT, 
+                  FXTRUE, &info ) ) {
+      FxU32 *dstData;
+      FxU32  dstJump;
+      FxU32 *srcData;
+      FxI32  srcJump;
+      FxU32  srcScanlineLength;
+      FxU32  scrWidth  = gc->state.screen_width;
+      FxU32  scrHeight = gc->state.screen_height;
+
+      FxU32  scanline;
+
+      /* Draw Banner in lower right of screen */
+      if ( scrWidth  < (FxU32)banner_width  ) return;
+      if ( scrHeight < (FxU32)banner_height ) return;
+
+      dstData = info.lfbPtr;
+      dstData = (FxU32*)( ((char*)dstData) + 
+                          (info.strideInBytes*((scrHeight-1)-banner_height)) +
+                          ((scrWidth-banner_width)<<1) );
+      dstJump = ((info.strideInBytes >> 1) - banner_width)>>1;
+      srcData = (FxU32*)&banner_data[banner_width*(banner_height-1)];
+      srcScanlineLength = banner_width>>1;
+      srcJump = (-banner_width);
+
+      for( scanline = 0; scanline < (FxU32)banner_height; scanline++ ) {
+          FxU32 *end = srcData + srcScanlineLength;
+          while( srcData < end ) *dstData++ = *srcData++;
+          dstData += dstJump;
+          srcData += srcJump;
+      }
+
+      grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER );
+  }
+  grGlideSetState( &state );
+
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+  FXUNUSED( state );
+  info.size = sizeof( info );
+  if ( grLfbLock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER,
+                  GR_LFBWRITEMODE_565,GR_ORIGIN_UPPER_LEFT, 
+                  FXFALSE, &info ) ) {
+
+      FxU16 *dstData;
+      FxU32  dstJump;
+      FxU16 *srcData;
+      FxI32  srcJump;
+      FxU32  srcScanlineLength;
+      FxU32  scrWidth  = gc->state.screen_width;
+      FxU32  scrHeight = gc->state.screen_height;
+
+      FxU32  scanline;
+
+      /* Draw Banner in lower right of screen */
+      if ( scrWidth  < (FxU32)banner_width  ) return;
+      if ( scrHeight < (FxU32)banner_height ) return;
+
+      dstData = info.lfbPtr;
+      dstData = (FxU16*)( ((char*)dstData) + 
+                          (info.strideInBytes*((scrHeight-1)-banner_height)) +
+                          ((scrWidth-banner_width)<<1) );
+      dstJump = ((info.strideInBytes >> 1) - banner_width);
+      srcData = (FxU16*)&banner_data[banner_width*(banner_height-1)];
+      srcScanlineLength = banner_width;
+      srcJump = (-banner_width)*2;
+
+      for( scanline = 0; scanline < (FxU32)banner_height; scanline++ ) {
+          FxU16 *end = srcData + srcScanlineLength;
+          while( srcData < end ) {
+              if ( *srcData )
+                  *dstData = *srcData;
+              dstData++;
+              srcData++;
+          }
+          dstData += dstJump;
+          srcData += srcJump;
+      }
+      
+      grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER );
+  }
+
+#else
+#  error "Shameless Plug Unimplemented on this Hardware"  
+#endif
+
+
+  GR_END();
+#endif
+} /* _grShamelessPlug */
Index: trunk/src/opengl/glide/sst1/glide/gdraw.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gdraw.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gdraw.c	(revision 2885)
@@ -0,0 +1,531 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gdraw.c,v 1.1 2000-02-25 00:31:13 sandervl Exp $
+** $Log: gdraw.c,v $
+** Revision 1.1  2000-02-25 00:31:13  sandervl
+** Created new Voodoo 1 Glide dir
+**
+** 
+** 31    6/02/98 8:03p Peter
+** Mmmmm.... points
+ * 
+ * 30    9/07/97 1:52p Atai
+ * performance tuning for previous check-in
+ * 
+ * 29    9/05/97 7:20p Atai
+ * fixed bug 764 (grDrawPoint integer snapping).
+ * 
+ * 28    6/20/97 5:51p Dow
+ * Moved grDebugGroupWriteHEader to sst96.c
+ * 
+ * 27    5/27/97 11:37p Pgj
+ * Fix for Bug report 545
+ * 
+ * 26    5/27/97 2:00p Dow
+ * Parenthesized a ternary op in GR_BEGIN to work around a Watcom compiler
+ * bug.
+ * 
+ * 25    3/21/97 12:42p Dow
+ * Made STWHints not send the Bend Over Baby Packet to FBI Jr.
+ * 
+ * 24    3/04/97 9:08p Dow
+ * Neutered multiplatform multiheaded monster
+ * 
+ * 23    2/18/97 9:51a Jdt
+ * Ifdefed out some if(0) code to supress watcom warnings
+ * 
+ * 22    12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+ * 
+ * 21    11/18/96 12:13p Jdt
+ * Made all debugging code go through the C-call to the assembly trisetup
+ * code.
+ * 
+ * 20    11/14/96 11:52p Jdt
+ * Fixed Watcom Assembly calling bug
+**
+*/
+#include <3dfx.h>
+
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+#include <memory.h>
+
+#define SST_XY_HALF      ( 1 << ( SST_XY_FRACBITS - 1 ) )
+#define SST_XY_ONE       ( 1 << SST_XY_FRACBITS )
+
+#define OUTBOUNDSX(a) ((a->x < 0.f ? 1 : 0) || (a->x > gc->state.screen_width ? 1 : 0))
+#define OUTBOUNDSY(a) ((a->y < 0.f ? 1 : 0) || (a->y > gc->state.screen_height ? 1 : 0))
+#define OUTBOUNDS(a) (OUTBOUNDSX(a) || OUTBOUNDSY(a))
+
+/* access a floating point array with a byte index */
+#define FARRAY(p,i) (*(float *)((i)+(int)(p)))
+
+/*---------------------------------------------------------------------------
+  NOTE: by Gary Tarolli
+  
+  The following code is very carefully scheduled for MSVC4.2 Version 10.20.6166
+  The trick is to schedule operations between PCI writes (GR_SET*).
+  This is because PCI writes cannot get off the CPU chip quickly and there
+  are about 6-12 dead clocks between back-to-back writes (P-90 to P-166).
+  So we try to do useful work during this time - this makes the code hard to
+  read because simple operations like mem++ may be broken up into three lines
+  of C code to perform, to allow the compiler to move the pieces around more.
+  PLEASE PLEASE PLEASE don't touch this code without benchmarkng it before
+  and after you touch it.  Moving a line of code up/down changes performance!
+  ---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------
+** grDrawPoint
+*/
+
+GR_ENTRY(grDrawPoint, void, ( const GrVertex *p ))
+{
+  int i, x,y;
+  struct dataList_s *dlp;
+
+  /* GMT: gross overestimate of fifo requirements */
+  GR_BEGIN("grDrawPoint",90,_GlideRoot.curTriSize);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x)\n",p));\
+
+  /* we snap to an integer by adding a large enough number that it
+   * shoves all fraction bits off the right side of the mantissa.
+   *
+   * NB: IEEE rounds to nearest integer by default, but applications
+   * can change the rounding mode so that it is difficult to get the
+   * correct truncation/ceiling operation w/ a simple adjustment to
+   * the bias. 
+   *
+   * NB: The constant kNumMantissaBits defines how many bits of
+   * integer precision a coordinate can have. This needs to be atleast
+   * as large as the maximum hw screen resolution. We later use this
+   * to compute a logical 1/2 value to fill an entire pixel.
+   */
+#define kNumMantissaBits 18UL
+  {
+    const float bias  = (const float)(3UL << kNumMantissaBits);
+
+    /* Convert to 32-bit representation */
+#define FP_TRUNC_BIAS(__fpVal, __fpBias) \
+    ((__fpVal) < (__fpBias) ? (float)((__fpVal) + (__fpBias)) : (__fpVal))
+    _GlideRoot.pool.ftemp1 = FP_TRUNC_BIAS(p->x, bias);
+    _GlideRoot.pool.ftemp2 = FP_TRUNC_BIAS(p->y, bias);
+
+    /* Mask off the real fractional bits from the mantissa */
+    x = ((*(FxU32*)&_GlideRoot.pool.ftemp1 & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
+         (0x01UL << (21UL - kNumMantissaBits)));
+    y = ((*(FxU32*)&_GlideRoot.pool.ftemp2 & (0xFFFFFFFFUL << (22UL - kNumMantissaBits))) +
+         (0x01UL << (21UL - kNumMantissaBits)));
+  }
+
+#ifdef GLIDE_USE_ALT_REGMAP
+  hw = SST_WRAP(hw,128);                /* use alternate register mapping */
+#endif
+
+  _GlideRoot.stats.pointsDrawn++;
+  
+  /* draw a little triangle, with the lower left corner at pixel center */
+  GR_SET( hw->vA.x, x );
+  GR_SET( hw->vA.y, y );
+  
+  x += (0x01UL << (21UL - kNumMantissaBits));
+  GR_SET( hw->vB.x, x );
+  GR_SET( hw->vB.y, y );
+
+  y += (0x01UL << (21UL - kNumMantissaBits));
+  GR_SET( hw->vC.y, y );
+  GR_SET( hw->vC.x, x );
+
+  /* we don't care what the slopes are because the pixel center that is drawn */
+  /* is exactly at vertex A - isn't that wonderful */
+  dlp = gc->dataList;
+  i = dlp->i;
+  while (i) {
+    if (i & 1) {        /* packer bug check */
+      if (i & 2) P6FENCE;
+      GR_SETF( *dlp->addr, 0.0F );
+      if (i & 2) P6FENCE;
+    }
+    else 
+      GR_SETF( *dlp->addr, FARRAY(p,i) );
+    dlp++;
+    i = dlp->i;
+  }
+  P6FENCE_CMD( GR_SET( hw->triangleCMD, 0x0000001UL) );
+
+  GR_END_SLOPPY();
+} /* grDrawPoint */
+
+/*---------------------------------------------------------------------------
+** grDrawLine
+**
+** NOTE: 1. this will not fill the last pixel in line because
+**          B2 or C is on the right edge and the right edge is not
+**          drawn.
+** (0,0)
+**
+**  A(x1,y1-0.5)+
+**              |  \
+**              |  \  \
+**       (x1,y1)*         \
+**              |  *           \
+**              |     *\           \
+** B1(x1,y1+0.5)+         *             \
+**                 \        \ *            +B2(x2,y2-0.5)
+**                     \          *        |
+**                        \       \    *   |
+**                             \     \     +  (x2,y2)
+**                                 \       |
+**                                      \  |
+**                                         +C(x2,y2+0.5)
+*/
+
+GR_ENTRY(grDrawLine, void, ( const GrVertex *a, const GrVertex *b ))
+{
+  float    m, dp;
+  #define  DX _GlideRoot.pool.ftemp1
+  #define ADY _GlideRoot.pool.ftemp2
+
+  int i,j;
+  float *fp;
+  struct dataList_s *dlp;
+
+
+  GR_BEGIN("grDrawLine",91,12+ _GlideRoot.curTriSize);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x,0x%x)\n",a,b));
+
+#ifdef GLIDE_USE_ALT_REGMAP
+  hw = SST_WRAP(hw,128);                /* use alternate register mapping */
+#endif
+   /*
+   ** compute absolute deltas and draw from low Y to high Y
+   */
+   ADY = b->y - a->y;
+   i = *(long *)&ADY;
+   if ( i < 0 ) {
+     const GrVertex *tv;
+     tv = a; a = b; b = tv;
+     i ^= 0x80000000;        /* ady = -ady; */
+     (*(long *)&ADY) = i;
+   }
+
+   DX = b->x - a->x;
+   j = *(long *)&DX;
+   if (j < 0 ) {
+     j ^= 0x80000000;        /* adx = -adx; */
+   }
+
+   /*
+   ** X major line
+   */
+   if (j >= i ) {                       /* if (adx > ady) */
+     if (j == 0) goto all_done;         /* check for zero-length lines */
+     /* start up divide and overlap with as much integer stuff as possible*/
+     m = _GlideRoot.pool.f1 / DX;
+       dlp = gc->dataList;
+      GR_SETF(hw->FvA.x,a->x);
+       dp = b->x;
+      GR_SETF(hw->FvB.x,dp);
+      GR_SETF(hw->FvC.x,dp)
+       _GlideRoot.stats.linesDrawn++;
+      
+     GR_SETF(hw->FvA.y,a->y - _GlideRoot.pool.fHalf);
+
+     dp = b->y;
+     GR_SETF(hw->FvB.y,dp - _GlideRoot.pool.fHalf);
+
+      i = dlp->i;
+     GR_SETF(hw->FvC.y,dp + _GlideRoot.pool.fHalf);
+
+     while (i) {
+       fp = dlp->addr;
+       if (i & 1) {     /* packer bug check */
+         if (i & 2) P6FENCE;
+         GR_SETF( fp[0], 0.0f);
+         if (i & 2) P6FENCE;
+         dlp++;
+         i = dlp->i;
+       }
+       else {
+         dp = FARRAY(a,i);
+         GR_SETF( fp[0], dp );
+         dp = FARRAY(b,i) - dp;
+         GR_SETF( fp[DPDX_OFFSET>>2] , dp * m );
+         dlp++;
+         i = dlp->i;
+         GR_SETF( fp[DPDY_OFFSET>>2] , _GlideRoot.pool.f0 );
+       }
+     }
+     P6FENCE_CMD( GR_SETF(hw->FtriangleCMD,_GlideRoot.pool.ftemp1) );
+
+     GR_SETF(hw->FvB.x,a->x);
+     GR_SETF(hw->FvB.y,a->y + _GlideRoot.pool.fHalf);
+     P6FENCE_CMD( GR_SETF(hw->FtriangleCMD,-_GlideRoot.pool.ftemp1));
+   }
+
+   /*
+   ** Y major line
+   */
+   else {
+     m = _GlideRoot.pool.f1 / ADY;
+     dlp = gc->dataList;
+     GR_SETF(hw->FvA.y,a->y);
+     dp = b->y;
+     GR_SETF(hw->FvB.y,dp);
+     _GlideRoot.stats.linesDrawn++;
+     GR_SETF(hw->FvC.y,dp);
+     
+     GR_SETF(hw->FvA.x,a->x - _GlideRoot.pool.fHalf);
+
+     dp = b->x;
+     GR_SETF(hw->FvB.x,dp - _GlideRoot.pool.fHalf);
+
+     i = dlp->i;
+     GR_SETF(hw->FvC.x,dp + _GlideRoot.pool.fHalf);
+       
+     while (i) {
+       fp = dlp->addr;
+       if (i & 1) {     /* packer bug check */
+         if (i & 2) P6FENCE;
+         GR_SETF( fp[0], 0.0f );
+         if (i & 2) P6FENCE;
+         dlp++;
+         i = dlp->i;
+       }
+       else {
+         dp = FARRAY(a,i);
+         GR_SETF( fp[0], dp );
+         dp = FARRAY(b,i) - dp;
+         GR_SETF( fp[DPDX_OFFSET>>2] , _GlideRoot.pool.f0 );
+         dlp++;
+         i = dlp->i;
+         GR_SETF( fp[DPDY_OFFSET>>2] , dp * m );
+       }
+     }
+     P6FENCE_CMD( GR_SET( hw->triangleCMD, 0xFFFFFFFF) );
+     
+     GR_SETF(hw->FvB.x,a->x + _GlideRoot.pool.fHalf);
+     GR_SETF(hw->FvB.y,a->y);
+     P6FENCE_CMD( GR_SET( hw->triangleCMD, 1) );
+   }
+
+  GR_END_SLOPPY();
+  return;
+
+all_done:  /* come here on degenerate lines */
+  _GlideRoot.stats.linesDrawn++;
+  GR_END_SLOPPY();
+} /* grDrawLine */
+
+/*---------------------------------------------------------------------------
+** grDrawTriangle
+*/
+
+#if !defined(__linux__) || defined(GLIDE_USE_C_TRISETUP) || defined(GLIDE_DEBUG)
+GR_ENTRY(grDrawTriangle, void, ( const GrVertex *a, const GrVertex *b, const GrVertex *c ))
+{
+#if defined(GLIDE_USE_C_TRISETUP) || defined( __WATCOMC__ ) || defined( GLIDE_DEBUG )
+  GR_BEGIN_NOFIFOCHECK("grDrawTriangle",92);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x,0x%x,0x%x)\n",a,b,c));
+  GR_CHECK_F(myName, !a || !b || !c, "NULL pointer passed");
+
+  /* Silly warning killer */
+  if ( 0 ) goto all_done;
+
+#ifdef GLIDE_DEBUG
+#if 0
+if (0) {                        /* GMT: only use this if needed */
+  FxU32 statBits;               /* bits we care about in status register */
+  FxU32 status;
+
+  status = GR_GET(hw->status);
+  if ((statBits = status & SST_FIFOLEVEL) < _GlideRoot.stats.minPciFIFOFree)
+    _GlideRoot.stats.minPciFIFOFree = statBits;
+
+  statBits = (status >> SST_MEMFIFOLEVEL_SHIFT) & 0xffff;
+  if (statBits < _GlideRoot.stats.minMemFIFOFree)
+    _GlideRoot.stats.minMemFIFOFree = statBits;
+}
+#endif
+
+  if (_GlideRoot.environment.triBoundsCheck) {
+    if (OUTBOUNDS(a) || OUTBOUNDS(b) || OUTBOUNDS(c)) {
+      GDBG_PRINTF(("Triangle out of bounds:\n"));
+      GDBG_PRINTF(("a->x = %3.2f, a->y = %3.2f\n", a->x, a->y));
+      GDBG_PRINTF(("b->x = %3.2f, b->y = %3.2f\n", b->x, b->y));
+      GDBG_PRINTF(("c->x = %3.2f, c->y = %3.2f\n", c->x, c->y));
+      GDBG_PRINTF(("Culling triangle based on these bogus values.\n"));
+      goto all_done;
+    }
+  }
+#endif /* GLIDE_DEBUG */
+
+  /* _trisetup and _trisetup_asm return 0 if culled, 1 if drawn */ 
+  TRISETUP( a, b, c );
+
+all_done:
+  GR_END();
+#else
+#if defined( __linux__ )
+  asm("jmp grDrawTriangle_asm");
+#endif
+#  if defined( __MSC__ )
+  extern void grDrawTriangle_asm(void);
+  {_asm jmp grDrawTriangle_asm}
+#  endif
+#endif
+} /* grDrawTriangle */
+#endif
+
+/*---------------------------------------------------------------------------
+** grDrawPlanarPolygon
+**
+** Brute force "triangle-fan" implementation of a convex polygon drawer.
+*/
+
+GR_ENTRY(grDrawPlanarPolygon, void, ( int nverts, const int ilist[], const GrVertex vlist[] ))
+{
+#if 1
+  int n,i = nverts-2;
+  const GrVertex *firstv = &vlist[ilist[0]];
+
+  GR_BEGIN_NOFIFOCHECK("grDrawPlanarPolygon",93);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x,0x%x)\n",nverts,ilist,vlist));
+  GR_CHECK_F(myName, !ilist || !vlist, "NULL pointer passed");
+
+  for ( i = 1; i < nverts - 1; i++ ) {
+    n = TRISETUP( firstv, &vlist[ilist[i]], &vlist[ilist[i+1]] );
+    if (n > 0) break;           /* stop after 1st non-zero-area triangle */
+    if (n < 0) goto all_done;
+  }
+  /* now all the gradients are loaded into the chip, so we just have to */
+  /* draw all the rest of the triangles */
+  for ( i = i+1; i < nverts - 1; i++ ) {
+    _trisetup_nogradients( firstv, &vlist[ilist[i]], &vlist[ilist[i+1]] );
+  }
+
+all_done:
+  GR_END();
+#else
+  grDrawPolygon(nverts, ilist, vlist);
+#endif
+} /* grDrawPlanarPolygon */
+
+/*---------------------------------------------------------------------------
+** grDrawPlanarPolygonVertexList
+**
+** Brute force "triangle-fan" implementation of a convex polygon drawer.
+*/
+
+GR_ENTRY(grDrawPlanarPolygonVertexList, void, ( int nverts, const GrVertex vlist[] ))
+{
+#if 1
+  int n,i = nverts-2;
+  const GrVertex *firstv = &vlist[0];
+
+  GR_BEGIN_NOFIFOCHECK("grDrawPlanarPolygonVertexList",93);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x)\n",nverts,vlist));
+  GR_CHECK_F(myName, !vlist, "NULL pointer passed");
+
+  for ( i = 1; i < nverts - 1; i++ ) {
+    n = TRISETUP( firstv, &vlist[i], &vlist[i+1] );
+    if (n > 0) break;           /* stop after 1st non-zero-area triangle */
+    if (n < 0) goto all_done;
+  }
+  /* now all the gradients are loaded into the chip, so we just have to */
+  /* draw all the rest of the triangles */
+  for ( i = i+1; i < nverts - 1; i++ ) {
+    _trisetup_nogradients( firstv, &vlist[i], &vlist[i+1] );
+  }
+
+all_done:
+  GR_END();
+#else
+  grDrawPolygonVertexList(nverts, vlist);
+#endif
+} /* grDrawPlanarPolygonVertexList */
+
+/*---------------------------------------------------------------------------
+** grDrawPolygon
+**
+** Brute force "triangle-fan" implementation of a convex polygon drawer.
+*/
+
+GR_ENTRY(grDrawPolygon, void, ( int nverts, const int ilist[], const GrVertex vlist[] ))
+{
+  int i;
+
+  GDBG_INFO((93,"grDrawPolygon(%d,0x%x,0x%x)\n",nverts,ilist,vlist));
+  for ( i = 1; i < nverts - 1; i++ ) {
+    grDrawTriangle( &vlist[ilist[0]], &vlist[ilist[i]], &vlist[ilist[i+1]] );
+  }
+} /* grDrawPolygon */
+
+/*---------------------------------------------------------------------------
+** grDrawPolygonVertexList
+**
+** Brute force "triangle-fan" implementation of a convex polygon drawer.
+*/
+
+GR_ENTRY(grDrawPolygonVertexList, void, ( int nverts, const GrVertex vlist[] ))
+{
+  int i;
+
+  GDBG_INFO((93,"grDrawPolygonVertexList(%d,0x%x)\n",nverts,vlist));
+  for ( i = 1; i < nverts - 1; i++ ) {
+    grDrawTriangle( &vlist[0], &vlist[i], &vlist[i+1] );
+  }
+} /* grDrawPolygonVertexList */
+
+/*---------------------------------------------------------------------------
+** _grColorCombineDelta0Mode
+**
+** GMT: when we are in delta0 mode, color comes from the RGB iterators
+**      but the slopes are 0.0.  So when we enter delta0 mode we set
+**      the iterators up and then we leave them alone during primitive
+**      rendering
+*/
+
+GR_DDFUNC(_grColorCombineDelta0Mode, void, ( FxBool delta0mode ))
+{
+  GR_BEGIN("_grColorCombineDelta0Mode",85,(delta0mode ? 9*4 : 0));
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",delta0mode));
+
+  if ( delta0mode ) {
+    GR_SETF( hw->Fr, gc->state.r );
+    GR_SETF( hw->Fg, gc->state.g );
+    GR_SETF( hw->Fb, gc->state.b );
+    GR_SET( hw->drdx, 0);
+    GR_SET( hw->drdy, 0);
+    GR_SET( hw->dgdx, 0);
+    GR_SET( hw->dgdy, 0);
+    GR_SET( hw->dbdx, 0);
+    GR_SET( hw->dbdy, 0);
+  }
+
+  gc->state.cc_delta0mode = delta0mode;
+  GR_END();
+
+} /* _grColorCombineDeltaMode */
+
Index: trunk/src/opengl/glide/sst1/glide/gerror.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gerror.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gerror.c	(revision 2885)
@@ -0,0 +1,189 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gerror.c,v 1.1 2000-02-25 00:31:13 sandervl Exp $
+** $Log: gerror.c,v $
+** Revision 1.1  2000-02-25 00:31:13  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 10    6/03/97 11:57p Pgj
+ * fix bug 558
+ * 
+ * 9     5/28/97 2:10p Dow
+ * Some mode setting, other cleanup
+ * 
+ * 8     5/27/97 2:02p Dow
+ * added _grAssert
+ * 
+ * 7     5/20/97 9:47a Pgj
+ * Use OutputDebugString for non-fatal errors under windows
+ * 
+ * 6     5/19/97 7:35p Pgj
+ * Print cogent error message if h/w not found
+ * 
+ * 5     3/09/97 10:31a Dow
+ * Added GR_DIENTRY for di glide functions
+ * 
+ * 4     12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+**
+*/
+#include <stdio.h>
+
+#if defined(__OS2__)
+#  include <os2.h>
+#endif
+
+#ifdef __WIN32__
+#  include <windows.h>
+#endif
+
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+#if(GLIDE_PLATFORM & GLIDE_OS_DOS32)
+#  include <malloc.h>
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+#  include <conio.h>
+#  include <i86.h>
+#endif
+#endif
+
+void (*GrErrorCallback)( const char *string, FxBool fatal );
+
+void _doGrErrorCallback( const char *name, const char *msg, FxBool fatal )
+{
+  char buf[1024];
+  sprintf(buf,"%s:  %s.\n", name, msg);
+  GrErrorCallback(buf,fatal);
+}
+
+GR_DIENTRY(grErrorSetCallback, void,
+           ( void (*function) ( const char *string, FxBool fatal ) ))
+{
+  GDBG_INFO((80,"grErrorSetCallback(0x%x)",function));
+  GrErrorCallback = function;
+}
+
+#ifdef __WIN32__
+void
+_grErrorWindowsCallback( const char *s, FxBool fatal )
+{
+  if ( fatal )
+  {
+    GDBG_ERROR("glide",s);
+    MessageBox(NULL, s, NULL, MB_OK);
+    grSstWinClose();
+    grGlideShutdown();
+    exit(1);
+  } else {
+    OutputDebugString(s);
+  }
+}
+#endif
+
+#if defined(__OS2__)
+void
+_grErrorOs2Callback( const char *s, FxBool fatal )
+{
+  if ( fatal )
+  {
+    GDBG_ERROR("glide",s);
+    WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, s, "glide error", 0, MB_OK);
+    grSstWinClose();
+    grGlideShutdown();
+    exit(1);
+  } else {
+#ifdef GDBG_INFO_ON
+    GDBG_PRINTF((s));
+#else
+    puts( s );
+#endif
+  }
+}
+#endif
+
+void
+_grErrorDefaultCallback( const char *s, FxBool fatal )
+{
+  if ( fatal )
+  {
+    grSstWinClose();
+    grGlideShutdown();
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96) && (GLIDE_PLATFORM & GLIDE_OS_DOS32)    
+    {
+      /* Set Mode 3 before going */
+      union REGS
+        inR, outR;
+      
+      inR.w.ax = 0x0003;
+      int386(0x10, &inR, &outR);
+
+    }
+#endif
+#ifdef GDBG_INFO_ON
+    GDBG_ERROR("glide", s);
+    GDBG_PRINTF((s));
+#else
+    puts( s );
+#endif
+    exit( 1 );
+  }
+  else
+  {
+#ifdef GDBG_INFO_ON
+    GDBG_PRINTF((s));
+#else
+    puts( s );
+#endif
+  }
+}
+
+#ifdef __DOS__
+int _guHeapCheck( void )
+{
+  int i = _heapchk();
+
+  if ( i != _HEAPOK )
+    printf( "heapchk: %d\n", i );
+
+  return ( i == 0 );
+}
+#endif
+
+void
+_grAssert(char *exp, char *fileName, int lineNo)
+{
+  initRestoreVideo();
+
+  GDBG_PRINTF(("ASSERTION FAILED:\n"));
+  GDBG_PRINTF(("\tExpression:   %s\n", exp));
+  GDBG_PRINTF(("\tFile:         %s\n", fileName));
+  GDBG_PRINTF(("\tLine:         %d\n", lineNo));
+  GDBG_PRINTF(("ABNORMAL TERMINATION\n"));
+
+  exit(-1);
+
+} /* _grAssert */
Index: trunk/src/opengl/glide/sst1/glide/gglide.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gglide.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gglide.c	(revision 2885)
@@ -0,0 +1,2092 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gglide.c,v 1.1 2000-02-25 00:31:14 sandervl Exp $
+** $Log: gglide.c,v $
+** Revision 1.1  2000-02-25 00:31:14  sandervl
+** Created new Voodoo 1 Glide dir
+**
+** 
+** 78    1/21/98 2:25p Peter
+** fixed assertion muckage
+ * 
+ * 77    1/12/98 10:25p Dow
+ * H3D Stereo Support
+ * 
+ * 76    1/07/98 9:58a Jdt
+ * Include Z in datalist for GR_COMBINE_LOCAL_DEPTH...Fixes Bug 1084
+ * 
+ * 75    12/19/97 8:09a Peter
+ * fog table propogation
+ * 
+ * 74    9/24/97 7:02p Atai
+ * 1. use initStatus() instead of grSstStatus() in grBufferNumPending
+ * 2. add one p6 nudge code in grBufferSwap()
+ * 
+ * 73    9/07/97 12:14p Pgj
+ * fix bug 660
+ * 
+ * 72    9/05/97 4:46p Peter
+ * fixed fifo silliness, sorry
+ * 
+ * 71    8/19/97 8:55p Peter
+ * lots of stuff, hopefully no muckage
+ * 
+ * 70    8/17/97 10:04p Pgj
+ * Fix bug 735
+ * 
+ * 69    8/01/97 11:48a Dow
+ * Added a size check for debugging
+ * 
+ * 68    7/20/97 2:05p Dow
+ * Hopefully worked around VSYNC bug
+ * 
+ * 67    7/18/97 6:48p Jdt
+ * grGlideShutdown now unsets _GlideRoot.initialized, further open/close
+ * symmetry fix
+ * 
+ * 66    7/09/97 10:18a Dow
+ * Further Nudge Of Love adjustments
+ * 
+ * 65    7/04/97 12:08p Dow
+ * Separated SST96 & SST1 versions of grRebuildDataList, fixed chip field
+ * muckage
+ * 
+ * 64    6/30/97 6:43p Dow
+ * Added more blank lines
+ * 
+ * 63    6/29/97 11:47p Jdt
+ * Adjustments for triangle optimization
+ * 
+ * 62    6/29/97 1:58p Dow
+ * Fixed busted ifdef
+ * 
+ * 61    6/26/97 3:09p Dow
+ * protected P6 stuff
+ * 
+ * 60    6/20/97 5:52p Dow
+ * Changes to make chip field work
+ * 
+ * 59    6/19/97 7:35p Dow
+ * More P6 Stuff
+ * 
+ * 58    6/18/97 6:08p Dow
+ * Fixed bogus call to gdbg_error
+ * 
+ * 57    6/18/97 5:54p Dow
+ * P6 adjustments
+ * 
+ * 56    6/12/97 5:19p Pgj
+ * Fix bug 578
+ * 
+ * 55    5/27/97 11:37p Pgj
+ * Fix for Bug report 545
+ * 
+ * 54    5/22/97 2:18p Pgj
+ * maxx --> maxy
+ * 
+ * 53    5/11/97 11:27p Pgj
+ * bug report 1152
+ * 
+ * 52    5/04/97 12:47p Dow
+ * Moved ClipWindow sanity check to internal routine as grSstControl needs
+ * it.
+ * 
+ * 51    5/02/97 2:09p Pgj
+ * grClipWindow sanity checks coords (intersect w/screen rect)
+ * 
+ * 50    3/24/97 2:00p Dow
+ * Fixed some chip field problems
+ * 
+ * 49    3/22/97 7:04p Dow
+ * Fixed chip field
+ * 
+ * 48    3/21/97 12:58p Dow
+ * Fixed error for SST1
+ * 
+ * 47    3/21/97 12:42p Dow
+ * Made STWHints not send the Bend Over Baby Packet to FBI Jr.
+ * 
+ * 46    3/19/97 10:42p Dow
+ * Dither subtraction sense, windowsInit
+ * 
+ * 45    3/18/97 9:08p Dow
+ * Added FX_GLIDE_NO_DITHER_SUB environment variable
+ * 
+ * 44    3/17/97 6:26a Jdt
+ * Re-worked grGlideShutdown()
+ * 
+ * 43    3/07/97 2:51p Jdt
+ * Fix for SST96 register offsets.
+ * 
+ * 42    3/07/97 2:29p Dow
+ * Maybe fixed lines
+ * 
+ * 41    3/05/97 1:07p Dow
+ * Clipping and origin changes for SST98
+ * 
+ * 40    3/04/97 9:08p Dow
+ * Neutered multiplatform multiheaded monster
+ * 
+ * 39    3/01/97 2:48p Dow
+ * Moved buffer swap count increment so that it works for both VG & VR
+ * 
+ * 38    2/26/97 11:56a Jdt
+ * Updated lfb api, fixed swapping
+ * 
+ * 37    2/18/97 9:51a Jdt
+ * Removed a bunch of warnings, no functional changes.
+ * 
+ * 36    2/12/97 10:39p Hanson
+ * 
+ * 35    2/12/97 2:09p Hanson
+ * Hopefully removed the rest of my muckage. 
+ * 
+ * 34    1/14/97 10:45a Dow
+ * Added check for pending swaps to grBufferSwap for VG96
+ * Modified grBufferNumPending to work with VG96
+ * 
+ * 33    12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+ * 
+ * 32    11/17/96 11:16p Garymct
+ * Updated grSplash code to set all of the necessary state itself rather
+ * than expecting the caller to do so.
+ * 
+ * 31    11/18/96 1:37a Tarolli
+ * fixed grAlphaBlendFunction warning bug
+ * 
+ * 29    11/15/96 3:40p Jdt
+ * Fixed SST-96 build.
+ * 
+ * 28    11/15/96 3:24p Tarolli
+ * renamed version.h to rcver.h ,  added some alpha blend function
+ * checking
+**
+*/
+
+#include <string.h>
+#include <3dfx.h>
+#include <glidesys.h>
+
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+#include "fxinline.h"
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+#include <init.h>
+#endif
+
+#include "rcver.h"
+static char glideIdent[] = "@#%" VERSIONSTR ;
+
+/*---------------------------------------------------------------------------
+** grAlphaBlendFunction
+**
+** GMT: BUG if grColorMask() turns off alphaplanes then destination alpha
+**          blending wont work!
+*/
+
+GR_ENTRY(grAlphaBlendFunction, void, ( GrAlphaBlendFnc_t rgb_sf,   GrAlphaBlendFnc_t rgb_df, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df ))
+{
+  FxU32 alphamode;
+
+  GR_BEGIN("grAlphaBlendFunction",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,%d,%d)\n",rgb_sf,rgb_df,alpha_sf,alpha_df));
+
+  /* Watcom warning suppressor */
+  glideIdent[0] = glideIdent[0];
+
+  alphamode = gc->state.fbi_config.alphaMode;
+  if (alpha_sf != GR_BLEND_ONE && alpha_sf != GR_BLEND_ZERO) {
+    // GR_CHECK_W(myName, 1, "unsupported alpha source blend function");
+    alpha_sf = GR_BLEND_ONE;
+  }
+  if (alpha_df != GR_BLEND_ONE && alpha_df != GR_BLEND_ZERO) {
+    // GR_CHECK_W(myName, 1, "unsupported alpha destination blend function");
+    alpha_df = GR_BLEND_ZERO;
+  }
+  if ( rgb_sf   == GR_BLEND_ONE && rgb_df   == GR_BLEND_ZERO &&
+      alpha_sf == GR_BLEND_ONE && alpha_df == GR_BLEND_ZERO )
+    alphamode &= ~SST_ENALPHABLEND;
+  else
+    alphamode |=  SST_ENALPHABLEND;
+  
+  alphamode &= ~( SST_RGBSRCFACT | SST_RGBDSTFACT | SST_ASRCFACT | SST_ADSTFACT );
+  
+  alphamode |= ( ( ( FxU32 ) rgb_sf ) << SST_RGBSRCFACT_SHIFT ) |
+    ( ( ( FxU32 ) rgb_df ) << SST_RGBDSTFACT_SHIFT ) |
+      ( ( ( FxU32 ) alpha_sf ) << SST_ASRCFACT_SHIFT ) |
+        ( ( ( FxU32 ) alpha_df ) << SST_ADSTFACT_SHIFT );
+  
+  GR_SET( hw->alphaMode, alphamode );
+  gc->state.fbi_config.alphaMode = alphamode;
+  GR_END();
+} /* grAlphaBlendFunction */
+
+/*---------------------------------------------------------------------------
+** grAlphaCombine
+*/
+GR_ENTRY(grAlphaCombine, void, (GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, FxBool invert ))
+{
+  FxU32 fbzColorPath;
+  FxU32 oldTextureEnabled;
+
+  GR_BEGIN("grAlphaCombine",85,8);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,%d,%d,%d)\n",function,factor,local,other,invert));
+  GR_CHECK_W(myName,
+              function < GR_COMBINE_FUNCTION_ZERO ||
+              function > GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA,
+              "unsupported alpha combine function");
+  GR_CHECK_W(myName,
+              (factor & 0x7) < GR_COMBINE_FACTOR_ZERO ||
+              (factor & 0x7) > GR_COMBINE_FACTOR_TEXTURE_ALPHA ||
+              factor > GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA,
+              "unsupported alpha combine scale factor");
+
+  GR_CHECK_W(myName,
+              local < GR_COMBINE_LOCAL_ITERATED || local > GR_COMBINE_LOCAL_DEPTH,
+              "unsupported alpha combine local color");
+  GR_CHECK_W(myName,
+              other < GR_COMBINE_OTHER_ITERATED || other > GR_COMBINE_OTHER_CONSTANT,
+              "unsupported alpha combine other color");
+
+  fbzColorPath = gc->state.fbi_config.fbzColorPath;
+  oldTextureEnabled = fbzColorPath & SST_ENTEXTUREMAP;
+  fbzColorPath &= ~( SST_ENTEXTUREMAP |
+                    SST_ASELECT |
+                    SST_ALOCALSELECT |
+                    SST_CCA_ZERO_OTHER |
+                    SST_CCA_SUB_CLOCAL |
+                    SST_CCA_MSELECT |
+                    SST_CCA_REVERSE_BLEND |
+                    SST_CCA_ADD_CLOCAL |
+                    SST_CCA_ADD_ALOCAL |
+                    SST_CCA_INVERT_OUTPUT );
+  
+  /* setup reverse blending first, then strip off the the high bit */
+  if ( (factor & 0x8) == 0 )
+    fbzColorPath |= SST_CCA_REVERSE_BLEND;
+  factor &= 0x7;
+
+  /* NOTE: we use boolean OR instead of logical to avoid branches */
+  gc->state.ac_requires_texture = ( factor == GR_COMBINE_FACTOR_TEXTURE_ALPHA ) |
+                                  ( other == GR_COMBINE_OTHER_TEXTURE );
+  gc->state.ac_requires_it_alpha = ( local == GR_COMBINE_LOCAL_ITERATED ) |
+                                   ( other == GR_COMBINE_OTHER_ITERATED );
+  
+  /* setup scale factor bits */
+  fbzColorPath |= factor << SST_CCA_MSELECT_SHIFT;
+
+  /* setup local color bits */
+  fbzColorPath |= local << SST_ALOCALSELECT_SHIFT;
+  
+  /* setup other color bits */
+  fbzColorPath |= other << SST_ASELECT_SHIFT;
+  
+  
+  /* setup invert output bits */
+  if ( invert )
+    fbzColorPath |= SST_CCA_INVERT_OUTPUT;
+  
+  /* setup core color combine unit bits */
+  switch ( function ) {
+  case GR_COMBINE_FUNCTION_ZERO:
+    fbzColorPath |= SST_CCA_ZERO_OTHER;
+    break;
+    
+  case GR_COMBINE_FUNCTION_LOCAL:
+  case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
+    fbzColorPath |= SST_CCA_ZERO_OTHER | SST_CCA_ADD_ALOCAL;
+    break;
+    
+  case GR_COMBINE_FUNCTION_SCALE_OTHER:
+    break;
+    
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
+    fbzColorPath |= SST_CCA_ADD_ALOCAL;
+    break;
+    
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
+    fbzColorPath |= SST_CCA_SUB_CLOCAL;
+    break;
+    
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+    fbzColorPath |= SST_CCA_SUB_CLOCAL | SST_CCA_ADD_ALOCAL;
+    break;
+    
+  case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
+  case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+    fbzColorPath |= SST_CCA_ZERO_OTHER | SST_CCA_SUB_CLOCAL | SST_CCA_ADD_ALOCAL;
+    break;
+  }
+
+  /* if either color or alpha combine requires texture then enable it */
+  if ( gc->state.cc_requires_texture || gc->state.ac_requires_texture )
+    fbzColorPath |= SST_ENTEXTUREMAP;
+  
+  /* transition into/out of texturing ... add nopCMD */
+  if(oldTextureEnabled != (fbzColorPath & SST_ENTEXTUREMAP))
+    P6FENCE_CMD( GR_SET(hw->nopCMD,0) );
+
+   GR_SET( hw->fbzColorPath, fbzColorPath );
+  gc->state.fbi_config.fbzColorPath = fbzColorPath;
+  
+  /* setup paramIndex bits */
+  _grUpdateParamIndex();
+  GR_END_SLOPPY();  
+} /* grAlphaCombine */
+
+/*---------------------------------------------------------------------------
+** grAlphaControlsITRGBLighting
+** 
+** Determines whether the LSB of alpha controls what lighting is used--
+** Specifically whether grConstantColorValu or the interated RGB values are used
+** during TEXTURE_TIMES_itrgb & TEXTURE_TIMES_ITRGB_DELTA0 color combine modes.
+**
+*/  
+
+GR_ENTRY(grAlphaControlsITRGBLighting, void, (FxBool enable))
+{
+  FxU32 fbzColorPath;
+
+  GR_BEGIN("grAlphaControlsITRGBLighting",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",enable));
+
+  fbzColorPath = gc->state.fbi_config.fbzColorPath;
+  if ( enable ) {
+    fbzColorPath |= SST_LOCALSELECT_OVERRIDE_WITH_ATEX;
+  } else {
+    fbzColorPath &= ~SST_LOCALSELECT_OVERRIDE_WITH_ATEX;
+  }
+
+  GR_SET( hw->fbzColorPath, fbzColorPath );
+  gc->state.fbi_config.fbzColorPath = fbzColorPath;
+  GR_END();
+} /* grAlphaControlsITRGBLighting() */
+
+/*---------------------------------------------------------------------------
+** grAlphaTestFunction
+*/
+
+GR_ENTRY(grAlphaTestFunction, void, ( GrCmpFnc_t fnc ))
+{
+  FxU32 alphamode;
+
+  GR_BEGIN("grAlphaTestFunction",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",fnc));
+
+  alphamode = gc->state.fbi_config.alphaMode;
+  alphamode &= ~(SST_ALPHAFUNC | SST_ENALPHAFUNC);
+  if ( fnc != GR_CMP_ALWAYS )
+    alphamode |= ( ( fnc << SST_ALPHAFUNC_SHIFT ) | SST_ENALPHAFUNC );
+
+  GR_SET( hw->alphaMode, alphamode );
+  gc->state.fbi_config.alphaMode = alphamode;
+  GR_END();
+} /* grAlphaTestFunction */
+
+/*---------------------------------------------------------------------------
+** grAlphaTestReferenceValue
+*/
+
+GR_ENTRY(grAlphaTestReferenceValue, void, ( GrAlpha_t value ))
+{
+  FxU32 alphamode;
+
+  GR_BEGIN("grAlphaTestReferenceValue",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",value));
+
+  alphamode = gc->state.fbi_config.alphaMode;
+  alphamode &= ~SST_ALPHAREF;
+  alphamode |= ( ( ( FxU32 ) value ) << SST_ALPHAREF_SHIFT );
+  GR_SET( hw->alphaMode, alphamode );
+  gc->state.fbi_config.alphaMode = alphamode;
+  GR_END();
+} /* grAlphaTestReferenceValue */
+
+/*---------------------------------------------------------------------------
+** grBufferClear
+*/
+
+GR_ENTRY(grBufferClear, void, ( GrColor_t color, GrAlpha_t alpha, FxU16 depth ))
+{
+  GrColor_t oldc1;
+  FxU32 oldzacolor, zacolor;
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+  GR_BEGIN("grBufferClear",86,44);
+#else
+  GR_BEGIN("grBufferClear",86,24);
+#endif
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x,0x%x,0x%x)\n",color,alpha,depth));
+
+  oldc1   = gc->state.fbi_config.color1;
+  zacolor = oldzacolor = gc->state.fbi_config.zaColor;
+
+  /*
+  ** Setup source registers
+  */
+  if ( gc->state.fbi_config.fbzMode & SST_RGBWRMASK )
+  {
+    _grSwizzleColor( &color );
+    GR_SET( hw->c1, color );
+  }
+  if ( ( gc->state.fbi_config.fbzMode & ( SST_ENALPHABUFFER | SST_ZAWRMASK ) ) == ( SST_ENALPHABUFFER | SST_ZAWRMASK ) )
+  {
+    zacolor &= ~SST_ZACOLOR_ALPHA;
+    zacolor |= ( ( ( FxU32 ) alpha ) << SST_ZACOLOR_ALPHA_SHIFT );
+    GR_SET( hw->zaColor, zacolor );
+  }
+  if ( ( gc->state.fbi_config.fbzMode & ( SST_ENDEPTHBUFFER | SST_ZAWRMASK ) ) == ( SST_ENDEPTHBUFFER | SST_ZAWRMASK ) )  {
+    zacolor &= ~SST_ZACOLOR_DEPTH;
+    zacolor |= ( ( ( FxU32 ) depth ) << SST_ZACOLOR_DEPTH_SHIFT );
+    GR_SET( hw->zaColor, zacolor );
+  }
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+  /*
+  **  On SST96, it's faster if clear the buffers separately if we need
+  **  to clear both of them.
+  */
+  if (
+      (gc->state.fbi_config.fbzMode & (SST_RGBWRMASK | SST_ZAWRMASK))
+      == (SST_RGBWRMASK | SST_ZAWRMASK)
+      ) {
+    FxU32 fbzMode;
+    /* Disable ZA write and fill */
+    fbzMode = gc->state.fbi_config.fbzMode & ~SST_ZAWRMASK;
+    GR_SET(hw->fbzMode, fbzMode);
+    GR_SET(hw->fastfillCMD,1);
+
+    /* Disable RGB write mask and fill */
+    fbzMode = gc->state.fbi_config.fbzMode & ~SST_RGBWRMASK;
+    GR_SET(hw->fbzMode, fbzMode);
+    GR_SET(hw->fastfillCMD,1);
+
+    /* Restore fbzMode to previous state */
+    GR_SET(hw->fbzMode, gc->state.fbi_config.fbzMode);
+        
+  } else
+#endif
+  /*
+  ** Execute the FASTFILL command
+  */
+  P6FENCE_CMD( GR_SET(hw->fastfillCMD,1) );
+
+
+  /*
+  ** Restore C1 and ZACOLOR
+  */
+  GR_SET( hw->c1, oldc1 );
+  GR_SET( hw->zaColor, oldzacolor );
+  GR_END_SLOPPY();
+} /* grBufferClear */
+
+
+/*---------------------------------------------------------------------------
+** grBufferSwap
+**
+** NOTE:        This routine should be COMPLETELY device-independant,
+**              but it isn't right now because we need to move all the
+**              code for the splash screen into the init library.
+*/
+
+GR_ENTRY(grBufferSwap, void, ( int swapInterval ))
+{
+#define FN_NAME "grBuferSwap"
+  int vSync;
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+#ifdef GDBG_INFO_ON
+  int
+    nTries;
+#endif
+
+  int pending;
+#endif
+
+  GR_BEGIN_NOFIFOCHECK(FN_NAME,80);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",swapInterval));
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 
+  FXUNUSED( vSync );
+
+#ifdef GDBG_INFO_ON
+  nTries = 0;
+#endif
+
+  /*
+   * For improved speed we take the following steps
+   * 1. remove the status checking
+   * 2. modify grBufferNumPending so it does not need to do P6 nudge code
+   * 3. add one p6 nudge code
+   * Here is step 3.
+   * If we introduce new bugs in 2.43, please undo the above steps
+   */
+  P6_NUDGE_OF_LOVE;
+
+  pending = grBufferNumPending();
+
+  if (pending < 1 && gc->grSstRez != GR_RESOLUTION_NONE) {
+    GR_SET_EXPECTED_SIZE((9 << 2));
+    GR_SET(hw->fbzMode, (gc->state.fbi_config.fbzMode & (~(SST_RGBWRMASK | SST_ZAWRMASK))));
+    GR_SETF(hw->FvA.x, 0.f);
+    GR_SETF(hw->FvA.y, 0.f);
+    GR_SETF(hw->FvB.x, 640.f);
+    GR_SETF(hw->FvB.y, 0.f);
+    GR_SETF(hw->FvC.x, 640.f);
+    GR_SETF(hw->FvC.y, 480.f);
+    GR_SETF(hw->FtriangleCMD, 1.f);
+    GR_SET(hw->fbzMode, gc->state.fbi_config.fbzMode);
+    GR_CHECK_SIZE();
+  }
+
+  while (pending > 3) {
+#ifdef GDBG_INFO_ON
+    GDBG_INFO((86, "%s:  Checked pending %d times\n", FN_NAME,
+               ++nTries));
+    if (nTries > 10000)
+      GDBG_ERROR(FN_NAME , "Exiting after %d tries for pending\n", nTries);
+#endif /* GDBG_INFO_ON */
+    pending = grBufferNumPending();
+  } while (pending > 3);
+  
+  /* optionally display the 3Dfx powerfield logo overlay */
+  if (_GlideRoot.environment.shamelessPlug)
+    _grShamelessPlug();
+
+  initSwapBuffers( swapInterval );
+
+#ifdef H3D
+  if (GR_RESOLUTION_IS_AUTOFLIPPED(gc->grSstRez)) {
+    extern void pageflippingSwapWait(void);
+    do {
+      pending = grBufferNumPending();
+    } while (pending > 0);
+    pageflippingSwapWait();
+  }
+#endif
+
+  P6_NUDGE_OF_LOVE;
+
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
+  /* optionally display the 3Dfx powerfield logo overlay */
+  if (_GlideRoot.environment.shamelessPlug)
+    _grShamelessPlug();
+
+  /* check for environmental override */
+  if (_GlideRoot.environment.swapInterval >= 0) {
+    swapInterval = _GlideRoot.environment.swapInterval;
+  }
+
+  GR_CHECK_F(myName,
+              ( swapInterval > 255 ) || ( swapInterval < 0 ),
+              "swap_interval out of range");
+
+  /* wait until there's 6 or fewer buffer swaps pending */
+  /* the hardware counter is only 3 bits so we don't want it to overflow */
+  /* also the latency gets too long */
+  while (grBufferNumPending() > 6);
+
+  /* if the interval is non-zero turn on VSYNC waiting */
+  vSync = swapInterval > 0 ? 1 : 0;
+
+  if ((swapInterval > 0) &&
+      (_GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].sstBoard.VoodooConfig.fbiRev == 1))
+  {
+    /* Adjust for .6 micron FBI */
+    if (swapInterval == 2)
+      swapInterval = 3;
+    else if (swapInterval != 1)
+      swapInterval <<= 1;
+  } else {
+    if (swapInterval > 0) swapInterval--;
+  }
+
+  /* NOTE: we need a PCI read before and after the swap command */
+  /* but since we already called grBufferNumPending() we've done a read */
+  GR_SET_EXPECTED_SIZE(4);
+  P6FENCE_CMD( GR_SET(hw->swapbufferCMD, (swapInterval<<1) | vSync) );
+
+#ifdef GLIDE_DEBUG
+  if (_GlideRoot.environment.snapshot > 0) {
+    static char saveDBG[GDBG_MAX_LEVELS];
+    int i;
+
+    /* turn off tracing after frame 0 and the snapshot frame */
+    if (_GlideRoot.stats.bufferSwaps == 1 || 
+        _GlideRoot.stats.bufferSwaps == _GlideRoot.environment.snapshot+1)
+    {
+      for (i=1; i<GDBG_MAX_LEVELS; i++) {
+        saveDBG[i] = (char)GDBG_GET_DEBUGLEVEL(i);
+        GDBG_SET_DEBUGLEVEL(i,0);
+      }
+    }
+    /* turn on tracing after the snapshot frame */
+    if (_GlideRoot.stats.bufferSwaps == _GlideRoot.environment.snapshot) {
+      for (i=1; i<GDBG_MAX_LEVELS; i++) {
+        GDBG_SET_DEBUGLEVEL(i,saveDBG[i]);
+      }
+    }
+  }
+#endif /* GLIDE_DEBUG */
+  grSstStatus();        /* special bug workaround       */
+#else
+#    error "Need to implement swap." 
+#endif /* GLIDE_PLATFORM & GLIDE_HW_SST1 */
+
+  _GlideRoot.stats.bufferSwaps++;
+
+  GR_END();
+#undef FN_NAME  
+} /* grBufferSwap */
+
+/*---------------------------------------------------------------------------
+** grBufferNumPending
+*/
+
+GR_ENTRY(grBufferNumPending, int, (void))
+{
+  int
+    pend;                       /* Num Swaps pending */ 
+  /*
+   * For improved speed we take the following steps
+   * 1. remove the status checking
+   * 2. modify grBufferNumPending so it does not need to do P6 nudge code
+   * 3. add one p6 nudge code
+   * Here is step 2. Goto grBufferSwap() in gglide.c to continue.
+   */
+  FxU32
+    status = initStatus();
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST1)
+  pend = (status & SST_SWAPBUFPENDING) >> SST_SWAPBUFPENDING_SHIFT;
+#elif (GLIDE_PLATFORM & GLIDE_HW_SST96)
+#define SST96_SWAPPEND_SHIFT    0x4
+#define SST96_SWAPPEND_BITS     (0x7 << SST96_SWAPPEND_SHIFT)
+  pend = ((status & SST96_SWAPPEND_BITS) >> SST96_SWAPPEND_SHIFT);
+#else
+#  error "Implement BufferNumPending for this hardware"
+#endif
+
+  GDBG_INFO((86,"grBufferNumPending() => %d\n",pend));
+
+  return pend;
+
+} /* grBufferNumPending */
+
+/*---------------------------------------------------------------------------
+** grChromakeyMode
+*/
+
+GR_ENTRY(grChromakeyMode, void, ( GrChromakeyMode_t mode ))
+{
+  FxU32 fbzMode;
+
+  GR_BEGIN("grChromakeyMode",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",mode));
+
+  fbzMode = gc->state.fbi_config.fbzMode;
+  if ( mode == GR_CHROMAKEY_ENABLE )
+    fbzMode |= SST_ENCHROMAKEY;
+  else
+    fbzMode &= ~SST_ENCHROMAKEY;
+
+  GR_SET( hw->fbzMode, fbzMode );
+  gc->state.fbi_config.fbzMode = fbzMode;
+  GR_END();
+} /* grChromaKeyMode */
+
+/*---------------------------------------------------------------------------
+** grChromakeyValue
+*/
+
+GR_ENTRY(grChromakeyValue, void, ( GrColor_t color ))
+{
+  GR_BEGIN("grChromakeyValue",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x)\n",color));
+
+  _grSwizzleColor( &color );
+  GR_SET( hw->chromaKey, color );
+  gc->state.fbi_config.chromaKey = color;
+  GR_END();
+} /* grChromaKeyValue */
+
+/*---------------------------------------------------------------------------
+** _grClipNormalizeAndGenerateRegValues
+**
+** This routine normalizes clip variables to screen_width and
+** screen_height, then generates the values to be written to the
+** registers clipLeftRight and clipBottomTop.   The reason for its
+** existence is that BOTH grClipWindow() and grSstControl() need to
+** write these registers.
+*/
+void
+_grClipNormalizeAndGenerateRegValues(FxU32 minx, FxU32 miny, FxU32 maxx,
+                                     FxU32 maxy, FxU32 *clipLeftRight,
+                                     FxU32 *clipBottomTop)
+{
+#define FN_NAME "_grClipNormalizeAndGenerateRegValues"
+  GR_DCL_GC;
+
+  GDBG_INFO((41, "%s:  minx = %d, maxx = %d, miny = %d, maxy = %d\n",
+           FN_NAME, minx, maxx, miny, maxy));
+
+  /* don't allow bogus clip coords!!! */
+  if (maxx > gc->state.screen_width) maxx = gc->state.screen_width;
+  if (maxy > gc->state.screen_height) maxy = gc->state.screen_height;
+  if (minx > maxx) minx = maxx;
+  if (miny > maxy) miny = maxy;
+
+  GDBG_INFO((41, "%s: normalized  minx = %d, maxx = %d, miny = %d, maxy = %d\n",
+             FN_NAME, minx, maxx, miny, maxy));
+
+  *clipLeftRight =
+    ( minx << SST_CLIPLEFT_SHIFT ) | ( maxx << SST_CLIPRIGHT_SHIFT ); 
+
+  *clipBottomTop =
+    ( miny << SST_CLIPBOTTOM_SHIFT ) | ( maxy << SST_CLIPTOP_SHIFT );
+
+  GDBG_INFO((41, "%s:  clipLeftRight = 0x%x, clipBottomTop = 0x%x\n",
+             FN_NAME, clipLeftRight, clipBottomTop));
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+  /* Enable clipping */
+  *clipLeftRight |= 0x80000000;
+#endif  
+#undef FN_NAME 
+} /* _grClipNormalizeAndGenerateRegValues */
+
+/*---------------------------------------------------------------------------
+** grClipWindow
+*/
+GR_ENTRY(grClipWindow, void, ( FxU32 minx, FxU32 miny, FxU32 maxx,
+                              FxU32 maxy )) 
+{
+  FxU32
+    clipLeftRight,              /* SST Clipping Registers */
+    clipBottomTop;
+
+  GR_BEGIN("grClipWindow",41,8);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d %d,%d)\n",minx,miny,maxx,maxy));
+
+  _grClipNormalizeAndGenerateRegValues(minx, miny, maxx, maxy,
+                                       &clipLeftRight, &clipBottomTop);
+
+  GR_SET( hw->clipLeftRight, clipLeftRight);
+  GR_SET( hw->clipBottomTop, clipBottomTop);
+
+  gc->state.fbi_config.clipLeftRight = clipLeftRight;
+  gc->state.fbi_config.clipBottomTop = clipBottomTop;
+
+  gc->state.clipwindowf_xmin = ( float ) minx;
+  gc->state.clipwindowf_xmax = ( float ) maxx;
+  gc->state.clipwindowf_ymin = ( float ) miny;
+  gc->state.clipwindowf_ymax = ( float ) maxy;
+  GR_END();
+} /* grClipWindow */
+
+/*---------------------------------------------------------------------------
+** grColorCombine
+*/
+
+GR_ENTRY(grColorCombine, void, ( GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, FxBool invert ))
+{
+  FxU32 fbzColorPath;
+  FxU32 oldTextureEnabled;
+
+  GR_BEGIN("grColorCombine",85,8);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,%d,%d,%d)\n",function,factor,local,other,invert));
+
+  GR_CHECK_W( myName,
+               function < GR_COMBINE_FUNCTION_ZERO ||
+               function > GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA,
+               "unsupported color combine function" );
+
+  GR_CHECK_W( myName,
+              (factor & 0x7) < GR_COMBINE_FACTOR_ZERO ||
+              (factor & 0x7) > GR_COMBINE_FACTOR_TEXTURE_ALPHA ||
+              factor > GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA,
+              "unsupported color combine scale factor");
+  GR_CHECK_W( myName,
+              local < GR_COMBINE_LOCAL_ITERATED || local > GR_COMBINE_LOCAL_DEPTH,
+              "unsupported color combine local color");
+  GR_CHECK_W( myName,
+              other < GR_COMBINE_OTHER_ITERATED || other > GR_COMBINE_OTHER_CONSTANT,
+              "unsupported color combine other color");
+
+  fbzColorPath = gc->state.fbi_config.fbzColorPath;
+  oldTextureEnabled = fbzColorPath & SST_ENTEXTUREMAP;
+  fbzColorPath &= ~( SST_ENTEXTUREMAP |
+                     SST_RGBSELECT |
+                     SST_LOCALSELECT |
+                     SST_CC_ZERO_OTHER |
+                     SST_CC_SUB_CLOCAL |
+                     SST_CC_MSELECT |
+                     SST_CC_REVERSE_BLEND |
+                     SST_CC_ADD_CLOCAL |
+                     SST_CC_ADD_ALOCAL |
+                     SST_CC_INVERT_OUTPUT );
+
+  /* this is bogus, it should be done once, somewhere. */
+  fbzColorPath |= SST_PARMADJUST;
+
+  /* setup reverse blending first, then strip off the the high bit */
+  if ( (factor & 0x8) == 0 )
+    fbzColorPath |= SST_CC_REVERSE_BLEND;
+  factor &= 0x7;
+
+  /* NOTE: we use boolean OR instead of logical to avoid branches */
+  gc->state.cc_requires_texture = ( factor == GR_COMBINE_FACTOR_TEXTURE_ALPHA ) |
+                                  ( other == GR_COMBINE_OTHER_TEXTURE );
+  gc->state.cc_requires_it_rgb = ( local == GR_COMBINE_LOCAL_ITERATED ) |
+                                 ( other == GR_COMBINE_OTHER_ITERATED );
+
+  /* setup scale factor bits */
+  fbzColorPath |= factor << SST_CC_MSELECT_SHIFT;
+
+  /* setup local color bits */
+  fbzColorPath |= local << SST_LOCALSELECT_SHIFT;
+
+  /* setup other color bits */
+  fbzColorPath |= other << SST_RGBSELECT_SHIFT;
+
+  /* setup invert output bits */
+  if ( invert )
+    fbzColorPath |= SST_CC_INVERT_OUTPUT;
+
+  /* setup core color combine unit bits */
+  switch ( function )
+  {
+  case GR_COMBINE_FUNCTION_ZERO:
+    fbzColorPath |= SST_CC_ZERO_OTHER;
+    break;
+
+  case GR_COMBINE_FUNCTION_LOCAL:
+    fbzColorPath |= SST_CC_ZERO_OTHER | SST_CC_ADD_CLOCAL;
+    break;
+
+  case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
+    fbzColorPath |= SST_CC_ZERO_OTHER | SST_CC_ADD_ALOCAL;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER:
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
+    fbzColorPath |= SST_CC_ADD_CLOCAL;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
+    fbzColorPath |= SST_CC_ADD_ALOCAL;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
+    fbzColorPath |= SST_CC_SUB_CLOCAL;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
+    fbzColorPath |= SST_CC_SUB_CLOCAL | SST_CC_ADD_CLOCAL;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+    fbzColorPath |= SST_CC_SUB_CLOCAL | SST_CC_ADD_ALOCAL;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
+    fbzColorPath |= SST_CC_ZERO_OTHER | SST_CC_SUB_CLOCAL | SST_CC_ADD_CLOCAL;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+    fbzColorPath |= SST_CC_ZERO_OTHER | SST_CC_SUB_CLOCAL | SST_CC_ADD_ALOCAL;
+    break;
+  }
+
+  /* if either color or alpha combine requires texture then enable it */
+  if ( gc->state.cc_requires_texture || gc->state.ac_requires_texture )
+    fbzColorPath |= SST_ENTEXTUREMAP;
+
+  /* if we transition into/out of texturing ... add nopCMD */
+  if(oldTextureEnabled != (fbzColorPath & SST_ENTEXTUREMAP))
+    P6FENCE_CMD( GR_SET(hw->nopCMD,0) );
+
+  /* update register */
+  GR_SET( hw->fbzColorPath, fbzColorPath );
+  gc->state.fbi_config.fbzColorPath = fbzColorPath;
+
+  /* setup paramIndex bits */
+  _grUpdateParamIndex();
+
+  GR_END_SLOPPY();
+} /* grColorCombine */
+
+/*---------------------------------------------------------------------------
+** grColorMask
+*/
+
+GR_ENTRY(grColorMask, void, ( FxBool rgb, FxBool alpha ))
+{
+  FxU32 fbzMode;
+
+  GR_BEGIN("grColorMask",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x,0x%x)\n",rgb,alpha));
+
+  fbzMode = gc->state.fbi_config.fbzMode;
+  GR_CHECK_W( myName,
+              ( fbzMode & SST_ENDEPTHBUFFER ) && alpha,
+              "alpha writes enabled even though depth buffering" );
+  GR_CHECK_W( myName,
+              (gc->state.num_buffers == 3) && alpha,
+              "alpha writes enabled while triple buffering" );
+
+  if ( rgb )
+    fbzMode |= SST_RGBWRMASK;
+  else
+    fbzMode &= ~SST_RGBWRMASK;
+
+  /* GMT: BUG leave SST_ENALPHABUFFER on if dest. alpha being used */
+  /* Don't do anything if depth buffering on */
+  /* XXX Should check for triple buffering too */
+
+  if ( !(fbzMode & SST_ENDEPTHBUFFER) && (gc->state.num_buffers != 3) ) {
+    if ( alpha )
+      fbzMode |= SST_ENALPHABUFFER | SST_ZAWRMASK;
+    else
+      fbzMode &= ~(SST_ENALPHABUFFER | SST_ZAWRMASK);
+  }
+
+  GR_SET( hw->fbzMode, fbzMode );
+  gc->state.fbi_config.fbzMode = fbzMode;
+  GR_END();
+} /* grColorMask */
+
+/*---------------------------------------------------------------------------
+** grConstantColorValue
+*/
+
+GR_ENTRY(grConstantColorValue, void, ( GrColor_t color ))
+{
+  GR_BEGIN("grConstantColorValue",85,8);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x)\n",color));
+
+  _grSwizzleColor( &color );
+  GR_SET( hw->c0, color );
+  GR_SET( hw->c1, color );
+  gc->state.fbi_config.color0 = color;
+  gc->state.fbi_config.color1 = color;
+  GR_END();
+} /* grConstanColorValue */
+
+/*---------------------------------------------------------------------------
+** grConstantColorValue4
+**           GMT: obsolete routine
+**           GMT: send values to hardware immediately
+*/
+
+GR_ENTRY(grConstantColorValue4, void, ( float a, float r, float g, float b ))
+{
+  GR_BEGIN("grConstantColorValue4",85,12);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,%d,%d)\n",a,r,g,b));
+  gc->state.a = a;
+  gc->state.r = r;
+  gc->state.g = g;
+  gc->state.b = b;
+  if ( gc->state.cc_delta0mode ) {
+    GR_SETF( hw->Fr, r );
+    GR_SETF( hw->Fg, g );
+    GR_SETF( hw->Fb, b );
+  }
+  GR_END_SLOPPY();
+} /* grConstantColorValue4 */
+
+/*---------------------------------------------------------------------------
+** grCullMode
+**
+** GMT: warning - gaa.c has the guts of this in-line
+*/
+
+GR_ENTRY(grCullMode, void, ( GrCullMode_t mode ))
+{
+  GR_BEGIN_NOFIFOCHECK("grCullMode",85);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",mode));
+  gc->state.cull_mode = mode;
+  GR_END();
+} /* grCullMode */
+
+/*---------------------------------------------------------------------------
+** grDepthBiasLevel
+**
+** Sets the depth bias level.
+*/
+
+GR_ENTRY(grDepthBiasLevel, void, ( FxI16 level ))
+{
+  FxU32 zacolor;
+
+  GR_BEGIN("grDepthBiasLevel",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",level));
+
+  zacolor = gc->state.fbi_config.zaColor;
+  zacolor = ( zacolor & ~SST_ZACOLOR_DEPTH ) | (level & SST_ZACOLOR_DEPTH);
+  GR_SET( hw->zaColor, zacolor );
+  gc->state.fbi_config.zaColor = zacolor;
+  GR_END();
+} /* grDepthBiasLevel */
+
+/*---------------------------------------------------------------------------
+** grDepthBufferFunction
+*/
+
+GR_ENTRY(grDepthBufferFunction, void, ( GrCmpFnc_t fnc ))
+{
+  FxU32 fbzMode;
+
+  GR_BEGIN("grDepthBufferFunction",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",fnc));
+
+  fbzMode = gc->state.fbi_config.fbzMode;
+  fbzMode &= ~SST_ZFUNC;
+  fbzMode |= ( fnc << SST_ZFUNC_SHIFT );
+  GR_SET( hw->fbzMode, fbzMode );
+  gc->state.fbi_config.fbzMode = fbzMode;
+  GR_END();
+} /* grDepthBufferFunction */
+
+/*---------------------------------------------------------------------------
+** grDepthBufferMode
+*/
+
+GR_ENTRY(grDepthBufferMode, void, ( GrDepthBufferMode_t mode ))
+{
+  FxU32 fbzMode;
+
+  GR_BEGIN("grDepthBufferMode",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",mode));
+
+   /*
+   ** depth buffering cannot be enabled at the same time as triple buffering
+   */
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+   GR_CHECK_F( myName,
+                mode != GR_DEPTHBUFFER_DISABLE && gc->state.num_buffers == 3 && gc->fbuf_size <= 2,
+                "cannot enable depth buffer when triple buffering" );
+#endif
+   /*
+   ** depth buffering cannot be enabled on systems running at:
+   **      800x600 w/ 2MB
+   **      640x480 w/ 1MB
+   */
+   GR_CHECK_F( myName,
+                mode != GR_DEPTHBUFFER_DISABLE && !_grCanSupportDepthBuffer(),
+                "cannot enable depthbuffer with configuration" );
+
+  /* turn off all the bits and then turn them back on selectively */
+  fbzMode = gc->state.fbi_config.fbzMode;
+  fbzMode &= ~(SST_ENDEPTHBUFFER | SST_WBUFFER | SST_ENZBIAS | SST_ZCOMPARE_TO_ZACOLOR);
+
+  switch (mode) {
+  case GR_DEPTHBUFFER_DISABLE:
+    break;
+    
+  case GR_DEPTHBUFFER_ZBUFFER:
+    fbzMode |= SST_ENDEPTHBUFFER | SST_ENZBIAS;
+    break;
+
+  case GR_DEPTHBUFFER_WBUFFER:
+    fbzMode |= SST_ENDEPTHBUFFER | SST_WBUFFER | SST_ENZBIAS;
+    break;
+
+  case GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS:
+    fbzMode |= SST_ENDEPTHBUFFER | SST_ZCOMPARE_TO_ZACOLOR;
+    break;
+
+  case GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS:
+    fbzMode |= SST_ENDEPTHBUFFER | SST_WBUFFER | SST_ZCOMPARE_TO_ZACOLOR;
+    break;
+  }
+
+  /*
+  ** Update hardware and Glide state
+  */
+  GR_SET( hw->fbzMode, fbzMode);
+  gc->state.fbi_config.fbzMode = fbzMode;
+
+  _grUpdateParamIndex();
+  GR_END();
+} /* grDepthBufferMode */
+
+/*---------------------------------------------------------------------------
+** grDepthMask
+*/
+GR_ENTRY(grDepthMask, void, ( FxBool enable ))
+{
+  FxU32 fbzMode;
+
+  GR_BEGIN("grDepthMask",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",enable));
+
+  fbzMode = gc->state.fbi_config.fbzMode;
+  GR_CHECK_F( myName,
+                enable && !_grCanSupportDepthBuffer(),
+                "called in a non-depthbufferable configuration" );
+
+  if ( enable )
+    fbzMode |= SST_ZAWRMASK;
+  else
+    fbzMode &= ~SST_ZAWRMASK;
+
+  GR_SET( hw->fbzMode, fbzMode );
+  gc->state.fbi_config.fbzMode = fbzMode;
+  GR_END();
+} /* grDepthMask */
+
+/*---------------------------------------------------------------------------
+** grDisableAllEffects
+*/
+
+GR_ENTRY(grDisableAllEffects, void, ( void ))
+{
+  GDBG_INFO((87,"grDisableAllEffects()\n"));
+  grAlphaBlendFunction( GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO );
+  grAlphaTestFunction( GR_CMP_ALWAYS );
+  grChromakeyMode( GR_CHROMAKEY_DISABLE );
+  grDepthBiasLevel( 0 );
+  grDepthBufferMode( GR_DEPTHBUFFER_DISABLE );
+  grFogMode( GR_FOG_DISABLE );
+} /* grDisableAllEffects */
+
+/*---------------------------------------------------------------------------
+** grDitherMode
+*/
+
+GR_ENTRY(grDitherMode, void, ( GrDitherMode_t mode ))
+{
+  FxU32 fbzMode;
+
+  GR_BEGIN("grDitherMode",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",mode));
+
+  fbzMode = gc->state.fbi_config.fbzMode &
+            ~( SST_ENDITHER | SST_DITHER2x2 | SST_ENDITHERSUBTRACT );
+
+  switch ( mode ) {
+     case GR_DITHER_DISABLE:
+        break;
+     case GR_DITHER_2x2:
+        fbzMode |= ( SST_ENDITHER | SST_DITHER2x2 );
+        break;
+     case GR_DITHER_4x4:
+        /* test per bug 660 */
+        if (_GlideRoot.environment.disableDitherSub == FXTRUE) {
+          fbzMode |= SST_ENDITHER;
+        } else {
+          fbzMode |= (SST_ENDITHER | SST_ENDITHERSUBTRACT);
+        }
+        break;
+  }
+
+  GR_SET( hw->fbzMode, fbzMode );
+  gc->state.fbi_config.fbzMode = fbzMode;
+  GR_END();
+} /* grDitherMode */
+
+/*---------------------------------------------------------------------------
+** grFogMode
+*/
+
+GR_ENTRY(grFogMode, void, ( GrFogMode_t mode ))
+{
+  FxU32 fogmode;
+
+  GR_BEGIN("grFogMode",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",mode));
+
+  fogmode = gc->state.fbi_config.fogMode;
+  fogmode &= ~( SST_ENFOGGING | SST_FOGADD | SST_FOGMULT | SST_FOG_ALPHA | SST_FOG_Z | SST_FOG_CONSTANT );
+
+  switch ( mode & 0xFF ) {    /* switch based on lower 8 bits */
+    case GR_FOG_DISABLE:
+      break;
+    case GR_FOG_WITH_ITERATED_ALPHA:
+      fogmode |= ( SST_ENFOGGING | SST_FOG_ALPHA );
+      break;
+    case GR_FOG_WITH_ITERATED_Z:        /* Bug 735 */
+      fogmode |= ( SST_ENFOGGING | SST_FOG_Z );
+      break;
+    case GR_FOG_WITH_TABLE:
+      fogmode |= ( SST_ENFOGGING );
+  }
+  if ( mode &  GR_FOG_MULT2 ) fogmode |= SST_FOGMULT;
+  if ( mode &  GR_FOG_ADD2 ) fogmode |= SST_FOGADD;
+
+  /*
+  ** Update the hardware and Glide state
+  */
+  GR_SET( hw->fogMode, fogmode );
+  gc->state.fbi_config.fogMode = fogmode;
+
+  _grUpdateParamIndex();
+  GR_END();
+} /* grFogMode */
+
+/*---------------------------------------------------------------------------
+** grFogColorValue
+*/
+
+GR_ENTRY(grFogColorValue, void, ( GrColor_t color ))
+{
+  GR_BEGIN("grFogColorValue",85,4);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x)\n",color));
+
+  _grSwizzleColor( &color );
+  GR_SET( hw->fogColor, color );
+  gc->state.fbi_config.fogColor = color;
+  GR_END();
+} /* grFogColorValue */
+
+/*---------------------------------------------------------------------------
+** grFogTable
+*/
+
+GR_ENTRY(grFogTable, void, ( const GrFog_t fogtable[kInternalFogTableEntryCount] ))
+{
+  int i, iend = kInternalFogTableEntryCount / 2 - 1;
+  const GrFog_t *locTable = fogtable;
+
+  GR_BEGIN("grFogTable",85,kInternalFogTableEntryCount*2);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x)\n",fogtable));
+  GR_ASSERT(fogtable != NULL);
+  GR_ASSERT(kInternalFogTableEntryCount == 64);
+
+  for ( i = 0; i <= iend; i++ ) {
+    GrFog_t e0,e1,d0,d1;
+
+    e0 = locTable[0];                   /* lower entry */
+    e1 = locTable[1];                   /* upper entry */
+    d0 = (e1-e0)<<2;                    /* del0 in .2 format */
+    d1 = (i==iend) ? e1 : locTable[2];  /* don't access beyond end of table */
+    d1 = (d1-e1)<<2;                    /* del1 in .2 format */
+
+    GR_SET( hw->fogTable[i], (e1<<24) | (d1<<16) | (e0<<8) | d0);
+    locTable += 2;
+  }
+  GR_END();
+} /* grFogTable */
+
+
+
+/*-------------------------------------------------------------------
+  Function: grGlideShutdown
+  Date: 3/16
+  Implementor(s): dow, gmt, jdt
+  Library: Glide
+  Description:
+  Shutdown the Glide Library.  Iterate through all hardware and 
+  call grSstWinClose().  Call InitShutdown() which unmaps all
+  hardware from linear memory.
+  Arguments:
+  none
+  Return:
+  none
+  -------------------------------------------------------------------*/
+
+GR_ENTRY(grGlideShutdown, void, ( void ))
+{
+  _GlideRoot.windowsInit = FXFALSE;
+
+  if ( _GlideRoot.initialized ) {
+    { /* GMT: reset the counter so we can proceed without assertions */
+      GR_DCL_GC;
+      gc->counter = gc->expected_counter = 0;
+    }
+    {
+      int i;    
+      GR_BEGIN_NOFIFOCHECK("grGlideShutdown",80);
+      GDBG_INFO_MORE((gc->myLevel,"()\n"));
+      
+      for( i = 0; i < _GlideRoot.hwConfig.num_sst; i++ ) {
+        grSstSelect( i );
+        grSstWinClose();
+      }
+      
+      initClose();
+      
+      _grDisplayStats();
+      gc->grSstRez           = GR_RESOLUTION_NONE;
+      gc->grSstRefresh       = GR_REFRESH_NONE;
+      _GlideRoot.initialized = FXFALSE;
+      GR_END();
+    }
+  }
+} /* grGlideShutdown */
+
+/*---------------------------------------------------------------------------
+** grGlideSetState
+*/
+
+GR_ENTRY(grGlideSetState, void, ( const GrState *state ))
+{
+  int tmu;
+  Sstregs *tmuregs;
+
+  GR_BEGIN("grGlideSetState",87,(1+13+7*gc->num_tmu)*4+(gc->num_tmu+1)*PACKER_WORKAROUND_SIZE);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x)\n",state));
+  GR_ASSERT(state != NULL);
+
+  /* if texture mapping changed then we need to issue a NOP command*/
+  if ( (gc->state.fbi_config.fbzColorPath ^ state->fbi_config.fbzColorPath) &
+        SST_ENTEXTUREMAP)
+  {
+    P6FENCE_CMD( GR_SET(hw->nopCMD,0) );
+  }
+
+  /* copy all the state */
+  gc->state = *state;
+
+  /* Update the hardware state from the saved state */
+  GR_SET( hw->fbzColorPath, gc->state.fbi_config.fbzColorPath );
+  GR_SET( hw->fogMode, gc->state.fbi_config.fogMode );
+  GR_SET( hw->alphaMode, gc->state.fbi_config.alphaMode );
+  GR_SET( hw->fbzMode, gc->state.fbi_config.fbzMode );
+#if !(GLIDE_PLATFORM & GLIDE_HW_SST96)
+  GR_SET( hw->lfbMode, gc->state.fbi_config.lfbMode );
+#endif
+  GR_SET( hw->clipLeftRight, gc->state.fbi_config.clipLeftRight );
+  GR_SET( hw->clipBottomTop, gc->state.fbi_config.clipBottomTop );
+  GR_SET( hw->fogColor, gc->state.fbi_config.fogColor );
+  GR_SET( hw->zaColor, gc->state.fbi_config.zaColor );
+  GR_SET( hw->chromaKey, gc->state.fbi_config.chromaKey );
+  GR_SET( hw->stipple, gc->state.fbi_config.stipple );
+  GR_SET( hw->c0, gc->state.fbi_config.color0 );
+  GR_SET( hw->c1, gc->state.fbi_config.color1 );
+
+  for ( tmu = 0; tmu < gc->num_tmu; tmu++ ) {
+    tmuregs = SST_TMU(hw,tmu);
+    PACKER_WORKAROUND;
+    GR_SET( tmuregs->textureMode, gc->state.tmu_config[tmu].textureMode );
+    GR_SET( tmuregs->tLOD, gc->state.tmu_config[tmu].tLOD );
+    GR_SET( tmuregs->tDetail, gc->state.tmu_config[tmu].tDetail );
+    GR_SET( tmuregs->texBaseAddr, gc->state.tmu_config[tmu].texBaseAddr );
+    GR_SET( tmuregs->texBaseAddr1, gc->state.tmu_config[tmu].texBaseAddr_1 );
+    GR_SET( tmuregs->texBaseAddr2, gc->state.tmu_config[tmu].texBaseAddr_2 );
+    GR_SET( tmuregs->texBaseAddr38, gc->state.tmu_config[tmu].texBaseAddr_3_8 );
+  }
+  PACKER_WORKAROUND;
+
+  /* NOTE: since glide state includes things like hints and
+     all cached variables like paramIndex we needn't recompute these,
+     BUT: we do need to rebuild stuff that depends on them!!! */
+
+  _grUpdateParamIndex();
+
+  GR_END_SLOPPY();
+  
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+  if (gc->state.fbi_config.fbzMode & SST_YORIGIN)
+    grSstOrigin(GR_ORIGIN_LOWER_LEFT);
+  else
+    grSstOrigin(GR_ORIGIN_UPPER_LEFT);
+#endif
+
+} /* grGlideSetState */
+
+/*---------------------------------------------------------------------------
+** grRenderBuffer
+**
+**  Although SST1 supports triple buffering, it's a hack in the hardware,
+**  and the only drawbuffer modes supported by the fbzMode register are 0
+**  (back) and 1 (front)
+*/
+
+GR_ENTRY(grRenderBuffer, void, ( GrBuffer_t buffer ))
+{
+
+  GR_BEGIN_NOFIFOCHECK("grRenderBuffer",85);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",buffer));
+  GR_CHECK_F( myName, buffer >= GR_BUFFER_AUXBUFFER, "invalid buffer" );
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
+  {
+      FxU32 fbzMode;
+      GR_SET_EXPECTED_SIZE( 4 );
+      
+      fbzMode = gc->state.fbi_config.fbzMode;
+      fbzMode &= ~( SST_DRAWBUFFER );
+      fbzMode |= buffer == GR_BUFFER_FRONTBUFFER ? SST_DRAWBUFFER_FRONT : SST_DRAWBUFFER_BACK;
+      
+      GR_SET( hw->fbzMode, fbzMode );
+      gc->state.fbi_config.fbzMode = fbzMode;
+  }
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+  initRenderBuffer( buffer );
+#else
+#  error "No renderbuffer implementation"
+#endif
+
+  GR_END();
+} /* grRenderBuffer */
+
+GR_ENTRY(grCheckForRoom, void, (FxI32 n))
+{
+   GR_DCL_GC;
+   GR_CHECK_FOR_ROOM(n);
+}
+
+/*---------------------------------------------------------------------------
+** _grUpdateParamIndex
+**
+** Updates the paramIndex bits based on Glide state and the hints.
+**
+*/
+GR_DDFUNC(_grUpdateParamIndex, void, ( void ))
+{
+  GR_DCL_GC;
+  FxU32 paramIndex = 0;
+  FxU32 hints = gc->state.paramHints;
+  FxU32 fbzColorPath = gc->state.fbi_config.fbzColorPath;
+  FxU32 fogMode = gc->state.fbi_config.fogMode;
+  FxU32 fbzMode = gc->state.fbi_config.fbzMode;
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+  FxU32 gwHeaderNum = 0;
+  /* Set up bits for vtx a,b,c x & y */
+  gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] = GWH_VTX_BITS;
+#endif
+
+  /*
+  ** First, turn on every bit that we think we need. We can prune them
+  ** back later.
+  */
+
+  /* Turn on the texture bits based on what grTexCombine set */
+  if (fbzColorPath & SST_ENTEXTUREMAP) {
+    /* No matter what, we need oow from the main grvertex structure */
+    static FxU32 paramI_array[8] = {
+      STATE_REQUIRES_OOW_FBI,
+      STATE_REQUIRES_OOW_FBI | STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0,
+      STATE_REQUIRES_OOW_FBI | STATE_REQUIRES_W_TMU1 | STATE_REQUIRES_ST_TMU1,
+      STATE_REQUIRES_OOW_FBI | STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0 |
+      STATE_REQUIRES_W_TMU1 | STATE_REQUIRES_ST_TMU1,
+      STATE_REQUIRES_OOW_FBI | STATE_REQUIRES_W_TMU2 | STATE_REQUIRES_ST_TMU2,
+      STATE_REQUIRES_OOW_FBI | STATE_REQUIRES_W_TMU2 | STATE_REQUIRES_ST_TMU2 |
+      STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0,
+      STATE_REQUIRES_OOW_FBI | STATE_REQUIRES_W_TMU2 | STATE_REQUIRES_ST_TMU2 |
+      STATE_REQUIRES_W_TMU1 | STATE_REQUIRES_ST_TMU1,
+      STATE_REQUIRES_OOW_FBI | STATE_REQUIRES_W_TMU2 | STATE_REQUIRES_ST_TMU2 |
+      STATE_REQUIRES_W_TMU0 | STATE_REQUIRES_ST_TMU0 |
+      STATE_REQUIRES_W_TMU1 | STATE_REQUIRES_ST_TMU1
+    };
+    GR_ASSERT(gc->state.tmuMask < sizeof(paramI_array)/sizeof(paramI_array[0]));
+    paramIndex |= paramI_array[gc->state.tmuMask];
+  }  
+
+  /* See if we need iterated RGB */
+  if ( gc->state.cc_requires_it_rgb && !gc->state.cc_delta0mode ) {
+    paramIndex |= STATE_REQUIRES_IT_DRGB;
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+    gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= (GWH_RGB_BITS);
+#endif
+  }
+
+  /* See if we need to iterate alpha based on the value of
+     ac_requires_it_alpha */ 
+  if (gc->state.ac_requires_it_alpha) {
+    paramIndex |= STATE_REQUIRES_IT_ALPHA;
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+    gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_A_BITS;
+#endif
+  }
+
+  /* See what fbzColorPath contributes - BUG 1084*/
+  if ( ( fbzColorPath & SST_ALOCALSELECT ) == 
+       ( SST_ALOCAL_Z ) ) {
+      paramIndex |= STATE_REQUIRES_OOZ;
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+      gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_Z_BITS;
+#endif
+  }
+
+  /* See what fbzMode contributes */
+  if (fbzMode & SST_ENDEPTHBUFFER) {
+    if (fbzMode & SST_WBUFFER) {
+      paramIndex |= STATE_REQUIRES_OOW_FBI;
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+      gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_W_BITS;
+#endif
+    } else {
+      paramIndex |= STATE_REQUIRES_OOZ;
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+      gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_Z_BITS;
+#endif
+    }
+  }
+
+  /* See what fogMode contributes */
+  if (fogMode & SST_ENFOGGING) {
+    if (fogMode & SST_FOG_Z) {
+      paramIndex |= STATE_REQUIRES_OOZ;
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+      gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_Z_BITS;
+#endif
+    } else {
+      if (fogMode & SST_FOG_ALPHA) {
+        paramIndex |= STATE_REQUIRES_IT_ALPHA;
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+      gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_A_BITS;
+#endif
+      } else {
+        paramIndex |= STATE_REQUIRES_OOW_FBI;
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+      gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_W_BITS;
+#endif
+      }
+    }
+  }
+
+  /*
+  **  Now we know everything that needs to be iterated.  Prune back
+  **  the stuff that isn't explicitly different
+  **
+  **  NOTE: by GMT, STATE_REQUIRES_OOW_FBI is set whenever texture mapping
+  **        is enabled
+  */
+  /* Turn off W for TMU0 if we don't have a hint */
+  if (paramIndex & STATE_REQUIRES_W_TMU0) {
+    GR_ASSERT(paramIndex & STATE_REQUIRES_OOW_FBI);
+    if (!(hints & GR_STWHINT_W_DIFF_TMU0))
+      paramIndex &= ~STATE_REQUIRES_W_TMU0;
+  }
+  
+  /* Turn off ST for TMU1 if TMU0 is active and TMU1 is not different */
+  if (((paramIndex & (STATE_REQUIRES_ST_TMU0 | STATE_REQUIRES_ST_TMU1)) ==
+                     (STATE_REQUIRES_ST_TMU0 | STATE_REQUIRES_ST_TMU1)) &&
+      !(hints & GR_STWHINT_ST_DIFF_TMU1))
+    paramIndex &= ~STATE_REQUIRES_ST_TMU1;
+  
+  /* Turn off W for TMU1 if we have a previous W, and don't have a hint */ 
+  if ((paramIndex & STATE_REQUIRES_W_TMU1) && !(hints & GR_STWHINT_W_DIFF_TMU1))
+    paramIndex &= ~STATE_REQUIRES_W_TMU1;
+
+#if (GLIDE_NUM_TMU > 2)
+  /* Turn off ST for TMU1 if it's not different & any other is set up.  */ 
+  if ((paramIndex & (STATE_REQUIRES_ST_TMU0 | STATE_REQURES_ST_TMU1)) &&
+      (paramIndex & STATE_REQUIRES_ST_TMU2) &&
+      !(hints & GR_STWHINT_ST_DIFF_TMU2))
+    paramIndex &= ~STATE_REQUIRES_ST_TMU2;
+  
+  /* Turn off W for TMU2 if we have a previous W, and don't have a hint */ 
+  if ((paramIndex & STATE_REQUIRES_W_TMU2) && !(hints & GR_STWHINT_W_DIFF_TMU2))
+    paramIndex &= ~STATE_REQUIRES_W_TMU2;
+#endif
+  
+  gc->state.paramIndex = paramIndex;
+
+  _grRebuildDataList();
+
+} /* _grUpdateParamIndex */
+
+#if defined(GLIDE_USE_ALT_REGMAP)
+  #define RED   Fr_ALT
+  #define DRDX  Fdrdx_ALT
+  #define DRDY  Fdrdy_ALT
+  #define GRN   Fg_ALT
+  #define DGDX  Fdgdx_ALT
+  #define DGDY  Fdgdy_ALT
+  #define BLU   Fb_ALT
+  #define DBDX  Fdbdx_ALT
+  #define DBDY  Fdbdy_ALT
+  #define ALF   Fa_ALT
+  #define DADX  Fdadx_ALT
+  #define DADY  Fdady_ALT
+  #define Z     Fz_ALT
+  #define DZDX  Fdzdx_ALT
+  #define DZDY  Fdzdy_ALT
+  #define S     Fs_ALT
+  #define DSDX  Fdsdx_ALT
+  #define DSDY  Fdsdy_ALT
+  #define T     Ft_ALT
+  #define DTDX  Fdtdx_ALT
+  #define DTDY  Fdtdy_ALT
+
+  #define W     Fw_ALT
+  #define DWDX  Fdwdx_ALT
+  #define DWDY  Fdwdy_ALT
+#else
+
+  #define RED   Fr
+  #define DRDX  Fdrdx
+  #define DRDY  Fdrdy
+  #define GRN   Fg
+  #define DGDX  Fdgdx
+  #define DGDY  Fdgdy
+  #define BLU   Fb
+  #define DBDX  Fdbdx
+  #define DBDY  Fdbdy
+  #define ALF   Fa
+  #define DADX  Fdadx
+  #define DADY  Fdady
+  #define Z     Fz
+  #define DZDX  Fdzdx
+  #define DZDY  Fdzdy
+  #define S     Fs
+  #define DSDX  Fdsdx
+  #define DSDY  Fdsdy
+  #define T     Ft
+  #define DTDX  Fdtdx
+  #define DTDY  Fdtdy
+  #define W     Fw
+  #define DWDX  Fdwdx
+  #define DWDY  Fdwdy
+#endif
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+
+/*---------------------------------------------------------------------------
+** _grRebuildDataList
+*/
+GR_DDFUNC(_grRebuildDataList, void, ( void ))
+{
+  GR_DCL_GC;
+  GR_DCL_HW;
+  int curTriSize, params;
+  FxU32 gwHeaderNum, gwpSize;            /* header + vertices */
+  FxU32 i, packMask=1;
+  Sstregs *tmu0;
+  Sstregs *tmu1;
+    
+#ifdef GDBG_INFO_ON
+  static char *p_str[] = {"x","y","z","r","g","b","ooz","a","oow",
+                            "s0","t0","w0","s1","t1","w1","s2","t2","w2"};
+#endif
+  
+  GDBG_INFO((80,"_grRebuildDataList() paramHints=0x%x paramIndex=0x%x\n",
+             gc->state.paramHints,gc->state.paramIndex));
+  
+  curTriSize = params = 0;
+  i = gc->state.paramIndex;
+  if (_GlideRoot.CPUType == 6) packMask |= 2;
+  
+  tmu0 = SST_CHIP(hw,0xE); /* tmu 0,1,2 */
+  tmu1 = SST_CHIP(hw,0xC); /* tmu 1,2 */
+  
+  /* init group write data */
+  gwHeaderNum = 0;
+  gwpSize     = 8;   /* header + vertices */
+  /* !!! fixme - jdt
+     this won't ever change, actually, but this is the safest
+     place I can think of to init this for now */
+  gc->hwDep.sst96Dep.gwCommand = GWH_GEN_ADDRESS(&hw->FvA.x);
+  
+  /*
+     ((((FxU32)((FxU32) &hw->FvA.x) - (FxU32) gc->lfb_ptr) >> 2) | 0x100000 | ( 1L << (31) ));
+     */
+  
+  gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] = 0;
+  gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_VTX_BITS;
+  
+  if (i & STATE_REQUIRES_IT_DRGB) {
+    /* add 9 to size array for r,drdx,drdy,g,dgdx,dgdy,b,dbdx,dbdy */
+    gc->dataList[curTriSize + 0].i    = GR_VERTEX_R_OFFSET<<2;
+    gc->dataList[curTriSize + 0].addr = (float *)&hw->RED;
+    gc->dataList[curTriSize + 1].i    = GR_VERTEX_G_OFFSET<<2;
+    gc->dataList[curTriSize + 1].addr = (float *)&hw->GRN;
+    gc->dataList[curTriSize + 2].i    = GR_VERTEX_B_OFFSET<<2;
+    gc->dataList[curTriSize + 2].addr = (float *)&hw->BLU;
+    curTriSize += 3;
+    params += 3;
+
+    gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_RGB_BITS;
+    gwpSize += 9;
+  }
+  
+  if (i & STATE_REQUIRES_OOZ) {
+    gc->dataList[curTriSize + 0].i    = GR_VERTEX_OOZ_OFFSET<<2;
+    gc->dataList[curTriSize + 0].addr = (float *)&hw->Z;
+    curTriSize += 1;
+    params += 1;
+
+    gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_Z_BITS;
+    gwpSize += 3;
+  }
+  
+  if (i & STATE_REQUIRES_IT_ALPHA) {
+    gc->dataList[curTriSize + 0].i    = GR_VERTEX_A_OFFSET<<2;
+    gc->dataList[curTriSize + 0].addr = (float *)&hw->ALF;
+    curTriSize += 1;
+    params += 1;
+
+    gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_A_BITS;
+    gwpSize += 3;
+  }
+  
+  /* TMU1 --------------------------------- */
+  /* always output to ALL chips, saves from having to change CHIP field */
+  if (i & STATE_REQUIRES_ST_TMU0) {
+    gc->dataList[curTriSize + 0].i    = GR_VERTEX_SOW_TMU0_OFFSET<<2;
+    gc->dataList[curTriSize + 0].addr = (float *)&hw->S;
+    gc->dataList[curTriSize + 1].i    = GR_VERTEX_TOW_TMU0_OFFSET<<2;
+    gc->dataList[curTriSize + 1].addr = (float *)&hw->T;
+    curTriSize += 2;
+    params += 2;
+
+    gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_ST_BITS;
+    gwpSize += 6;
+  }
+  
+  /* we squeeze FBI.OOW in here for sequential writes in the simple case */
+  if (i & STATE_REQUIRES_OOW_FBI) {
+    gc->dataList[curTriSize + 0].i    = GR_VERTEX_OOW_OFFSET<<2;
+    gc->dataList[curTriSize + 0].addr = (float *)&hw->W;
+    curTriSize += 1;
+    params += 1;
+
+    gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_W_BITS;
+    gwpSize += 3;
+  }
+
+  /* NOTE: this is the first */
+  if (i & STATE_REQUIRES_W_TMU0) {
+    /* We do this a bit differently for grouped writes */
+    gc->dataList[curTriSize + 0].i    = packMask;
+    gc->dataList[curTriSize + 0].addr =
+      (float *) GWH_GEN_ADDRESS(&tmu0->FvA.x);
+    gc->dataList[curTriSize + 1].i    = GR_VERTEX_OOW_TMU0_OFFSET<<2;
+    gc->dataList[curTriSize + 1].addr = 0L;
+    
+    if (gwpSize & 1)
+      ++gwpSize;              /* Justify your love */
+    gwpSize += 5;             /* 2 header + grads */
+    
+    ++gwHeaderNum;
+    gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_W_BITS;
+    curTriSize += 2;
+    params += 1;
+  }
+  
+  gc->dataList[curTriSize++].i = 0;     /* terminate the list with 0,*      */
+  /* followed by the FtriangleCMD reg */
+  gc->dataList[curTriSize].i = packMask;/* encode P6 flag here for asm code */
+  gc->dataList[curTriSize].addr = (float *)&hw->FtriangleCMD;
+  
+  /* 6 X,Y values plus AREA = 7, plus parameters */
+  if (gwHeaderNum) {
+    if (gwpSize & 1)
+      ++gwpSize;                /* justify your love */
+
+    /* If we've had a chip field change above then we need to start a
+     ** new packet for the triangle command, so we don't put it in the
+     ** original */
+    gwpSize +=4;        /* The triangleCMD GWP constitutes 4 DWORDS */
+  } else {
+    gc->hwDep.sst96Dep.gwHeaders[gwHeaderNum] |= GWH_FTRIANGLECMD_BIT;
+    gwpSize++;                    /* Triangle Command */
+
+    if (gwpSize & 1)
+      ++gwpSize;                /* justify the fifo */
+  }    
+
+  _GlideRoot.curTriSize = gwpSize << 2; /* GR.curTriSize in bytes */
+
+  /* Need to know tri size without gradients for planar polygons */
+  _GlideRoot.curTriSizeNoGradient = _GlideRoot.curTriSize - (params<<3);
+  
+#ifdef GDBG_INFO_ON
+  GDBG_INFO((282, "DataList\n"));
+  for (i = 0; gc->dataList[i].i; i++) {
+    GDBG_INFO((282,"    dataList[%d] = %2d 0x%x [%s]\n",
+               i,gc->dataList[i].i>>2,gc->dataList[i].addr,
+               (gc->dataList[i].i & 1) ? "packer" : p_str[gc->dataList[i].i>>2]));
+  }
+#endif
+
+} /* _grRebuildDataList */
+
+#else  /* It's SST1 */
+
+/*---------------------------------------------------------------------------
+** _grRebuildDataList
+*/
+GR_DDFUNC(_grRebuildDataList, void, ( void ))
+{
+  GR_DCL_GC;
+  GR_DCL_HW;
+  int curTriSize, params, packerFlag;
+  FxU32 i, packMask=1;
+  Sstregs *tmu0;
+  Sstregs *tmu1;
+    
+#ifdef GLIDE_DEBUG
+  static char *p_str[] = {"x","y","z","r","g","b","ooz","a","oow",
+                            "s0","t0","w0","s1","t1","w1","s2","t2","w2"};
+#endif
+  
+  GDBG_INFO((80,"_grRebuildDataList() paramHints=0x%x paramIndex=0x%x\n",
+             gc->state.paramHints,gc->state.paramIndex));
+  
+  curTriSize = params = 0;
+  i = gc->state.paramIndex;
+  if (_GlideRoot.CPUType == 6) packMask |= 2;
+#ifdef GLIDE_USE_ALT_REGMAP
+  hw = SST_WRAP(hw,128);        /* wrap 128-257 are alternate
+                                   register mappings */
+#endif /* GLIDE_USE_ALT_REGMAP */
+  
+  tmu0 = SST_CHIP(hw,0xE); /* tmu 0,1,2 */
+  tmu1 = SST_CHIP(hw,0xC); /* tmu 1,2 */
+  
+  if (i & STATE_REQUIRES_IT_DRGB) {
+    /* add 9 to size array for r,drdx,drdy,g,dgdx,dgdy,b,dbdx,dbdy */
+    gc->dataList[curTriSize + 0].i    = GR_VERTEX_R_OFFSET<<2;
+    gc->dataList[curTriSize + 0].addr = (float *)&hw->RED;
+    gc->dataList[curTriSize + 1].i    = GR_VERTEX_G_OFFSET<<2;
+    gc->dataList[curTriSize + 1].addr = (float *)&hw->GRN;
+    gc->dataList[curTriSize + 2].i    = GR_VERTEX_B_OFFSET<<2;
+    gc->dataList[curTriSize + 2].addr = (float *)&hw->BLU;
+    curTriSize += 3;
+    params += 3;
+  }
+  
+  if (i & STATE_REQUIRES_OOZ) {
+    gc->dataList[curTriSize + 0].i    = GR_VERTEX_OOZ_OFFSET<<2;
+    gc->dataList[curTriSize + 0].addr = (float *)&hw->Z;
+    curTriSize += 1;
+    params += 1;
+  }
+  
+  if (i & STATE_REQUIRES_IT_ALPHA) {
+    gc->dataList[curTriSize + 0].i    = GR_VERTEX_A_OFFSET<<2;
+    gc->dataList[curTriSize + 0].addr = (float *)&hw->ALF;
+    curTriSize += 1;
+    params += 1;
+  }
+  
+  /* TMU1 --------------------------------- */
+  /* always output to ALL chips, saves from having to change CHIP field */
+  if (i & STATE_REQUIRES_ST_TMU0) {
+    gc->dataList[curTriSize + 0].i    = GR_VERTEX_SOW_TMU0_OFFSET<<2;
+    gc->dataList[curTriSize + 0].addr = (float *)&hw->S;
+    gc->dataList[curTriSize + 1].i    = GR_VERTEX_TOW_TMU0_OFFSET<<2;
+    gc->dataList[curTriSize + 1].addr = (float *)&hw->T;
+    curTriSize += 2;
+    params += 2;
+  }
+  
+  /* we squeeze FBI.OOW in here for sequential writes in the simple case */
+  if (i & STATE_REQUIRES_OOW_FBI) {
+    gc->dataList[curTriSize + 0].i    = GR_VERTEX_OOW_OFFSET<<2;
+    gc->dataList[curTriSize + 0].addr = (float *)&hw->W;
+    curTriSize += 1;
+    params += 1;
+  }
+  /* NOTE: this is the first */
+  if (i & STATE_REQUIRES_W_TMU0) {
+    gc->dataList[curTriSize + 0].i    =  packMask;
+    gc->dataList[curTriSize + 0].addr = (float *)_GlideRoot.packerFixAddress;
+    gc->dataList[curTriSize + 1].i    = GR_VERTEX_OOW_TMU0_OFFSET<<2;
+    gc->dataList[curTriSize + 1].addr = (float *)&tmu0->W;
+    curTriSize += 2;
+    params += 1;
+  }
+  
+  /* TMU1 --------------------------------- */
+  if (i & STATE_REQUIRES_ST_TMU1) {
+    gc->dataList[curTriSize + 0].i    = packMask;
+    gc->dataList[curTriSize + 0].addr = (float *)_GlideRoot.packerFixAddress;
+    packerFlag = 0;
+    gc->dataList[curTriSize + 1].i    = GR_VERTEX_SOW_TMU1_OFFSET<<2;
+    gc->dataList[curTriSize + 1].addr = (float *)&tmu1->S;
+    gc->dataList[curTriSize + 2].i    = GR_VERTEX_TOW_TMU1_OFFSET<<2;
+    gc->dataList[curTriSize + 2].addr = (float *)&tmu1->T;
+    curTriSize += 3;
+    params += 2;
+  }
+  else packerFlag = 1;
+  
+  if (i & STATE_REQUIRES_W_TMU1) {
+    if (packerFlag) {
+      gc->dataList[curTriSize + 0].i    = packMask;
+      gc->dataList[curTriSize + 0].addr = (float *)_GlideRoot.packerFixAddress;
+      curTriSize += 1;
+    }
+    gc->dataList[curTriSize + 0].i    = GR_VERTEX_OOW_TMU1_OFFSET<<2;
+    gc->dataList[curTriSize + 0].addr = (float *)&tmu1->W;
+    curTriSize += 1;
+    params += 1;
+  }
+#if (GLIDE_NUM_TMU > 2)
+  error WRITE THIS CODE;
+#endif
+  
+  /* if last write was not to chip 0 */
+  if ( SST_CHIP_MASK & (FxU32)gc->dataList[curTriSize-1].addr ) {
+    /* flag write as a packer bug fix  */
+    gc->dataList[curTriSize].i = packMask; 
+    gc->dataList[curTriSize].addr = (float *)_GlideRoot.packerFixAddress;
+    curTriSize++;
+  }
+
+  
+  gc->dataList[curTriSize++].i = 0; /* terminate the list with 0,*      */
+                                /* followed by the FtriangleCMD reg */
+  gc->dataList[curTriSize].i = packMask;/* encode P6 flag here for asm code */
+  gc->dataList[curTriSize].addr = (float *)&hw->FtriangleCMD;
+  
+  /* 6 X,Y values plus AREA = 7, plus parameters */
+  _GlideRoot.curTriSize = (6 + curTriSize + (params<<1)) <<2;
+
+  /* Need to know tri size without gradients for planar polygons */
+  _GlideRoot.curTriSizeNoGradient = _GlideRoot.curTriSize - (params<<3);
+  
+#ifdef GLIDE_DEBUG
+  GDBG_INFO((282, "DataList\n"));
+  for (i = 0; gc->dataList[i].i; i++) {
+    GDBG_INFO((282,"    dataList[%d] = %2d 0x%x [%s]\n",
+               i,gc->dataList[i].i>>2,gc->dataList[i].addr,
+               (gc->dataList[i].i & 1) ? "packer" :
+               p_str[gc->dataList[i].i>>2])); 
+  }
+#endif
+
+} /* _grRebuildDataList */
+
+#endif
+
+#if GLIDE_MULTIPLATFORM
+/*
+   _grInitializeGCFuncs - initialize the gcFuncs Structure for this
+        device.
+*/
+GR_DDFUNC(_grInitializeGCFuncs, void, (GrGC *gc))
+{
+  
+  gc->gcFuncs._grColorCombineDelta0Mode = (void *)
+    GR_DDNAME(_grColorCombineDelta0Mode); 
+  gc->gcFuncs._grRebuildDataList = (void *) GR_DDNAME(_grRebuildDataList);
+  gc->gcFuncs._grTexDetailControl = (void *) GR_DDNAME(_grTexDetailControl);
+  gc->gcFuncs._grTexDownloadNccTable = (void *)
+    GR_DDNAME(_grTexDownloadNccTable); 
+  gc->gcFuncs._grTexDownloadPalette = (void *)
+    GR_DDNAME(_grTexDownloadPalette); 
+  gc->gcFuncs._gumpTexCombineFunction = (void *)
+    GR_DDNAME(_gumpTexCombineFunction); 
+  gc->gcFuncs._grUpdateParamIndex = (void *)
+    GR_DDNAME(_grUpdateParamIndex); 
+  gc->gcFuncs._trisetup = (void *) GR_DDNAME(_trisetup); 
+  gc->gcFuncs._trisetup_nogradients = (void *)
+    GR_DDNAME(_trisetup_nogradients); 
+  gc->gcFuncs.grAADrawLine = (void *) GR_DDNAME(grAADrawLine); 
+  gc->gcFuncs.grAADrawPoint = (void *) GR_DDNAME(grAADrawPoint); 
+  gc->gcFuncs.grAADrawPolygon = (void *) GR_DDNAME(grAADrawPolygon); 
+  gc->gcFuncs.grAADrawPolygonVertexList = (void *)
+    GR_DDNAME(grAADrawPolygonVertexList); 
+  gc->gcFuncs.grAADrawTriangle = (void *) GR_DDNAME(grAADrawTriangle); 
+  gc->gcFuncs.grAlphaBlendFunction = (void *)
+    GR_DDNAME(grAlphaBlendFunction); 
+  gc->gcFuncs.grAlphaCombine = (void *) GR_DDNAME(grAlphaCombine); 
+  gc->gcFuncs.grAlphaControlsITRGBLighting = (void *)
+    GR_DDNAME(grAlphaControlsITRGBLighting); 
+  gc->gcFuncs.grAlphaTestFunction = (void *)
+    GR_DDNAME(grAlphaTestFunction); 
+  gc->gcFuncs.grAlphaTestReferenceValue = (void *)
+    GR_DDNAME(grAlphaTestReferenceValue); 
+  gc->gcFuncs.grBufferClear = (void *) GR_DDNAME(grBufferClear); 
+  gc->gcFuncs.grBufferNumPending = (void *)
+    GR_DDNAME(grBufferNumPending); 
+  gc->gcFuncs.grBufferSwap = (void *) GR_DDNAME(grBufferSwap); 
+  gc->gcFuncs.grChromakeyMode = (void *) GR_DDNAME(grChromakeyMode); 
+  gc->gcFuncs.grChromakeyValue = (void *) GR_DDNAME(grChromakeyValue); 
+  gc->gcFuncs.grClipWindow = (void *) GR_DDNAME(grClipWindow); 
+  gc->gcFuncs.grColorCombine = (void *) GR_DDNAME(grColorCombine); 
+  gc->gcFuncs.grColorMask = (void *) GR_DDNAME(grColorMask); 
+  gc->gcFuncs.grConstantColorValue = (void *)
+    GR_DDNAME(grConstantColorValue); 
+  gc->gcFuncs.grConstantColorValue4 = (void *)
+    GR_DDNAME(grConstantColorValue4); 
+  gc->gcFuncs.grCullMode = (void *) GR_DDNAME(grCullMode); 
+  gc->gcFuncs.grDepthBiasLevel = (void *) GR_DDNAME(grDepthBiasLevel); 
+  gc->gcFuncs.grDepthBufferFunction = (void *)
+    GR_DDNAME(grDepthBufferFunction); 
+  gc->gcFuncs.grDepthBufferMode = (void *) GR_DDNAME(grDepthBufferMode);
+  
+  gc->gcFuncs.grDepthMask = (void *) GR_DDNAME(grDepthMask); 
+  gc->gcFuncs.grDisableAllEffects = (void *)
+    GR_DDNAME(grDisableAllEffects); 
+  gc->gcFuncs.grDitherMode = (void *) GR_DDNAME(grDitherMode); 
+  gc->gcFuncs.grDrawLine = (void *) GR_DDNAME(grDrawLine); 
+  gc->gcFuncs.grDrawPlanarPolygon = (void *)
+    GR_DDNAME(grDrawPlanarPolygon); 
+  gc->gcFuncs.grDrawPlanarPolygonVertexList = (void *)
+    GR_DDNAME(grDrawPlanarPolygonVertexList); 
+  gc->gcFuncs.grDrawPoint = (void *) GR_DDNAME(grDrawPoint); 
+  gc->gcFuncs.grDrawPolygon = (void *) GR_DDNAME(grDrawPolygon); 
+  gc->gcFuncs.grDrawPolygonVertexList = (void *)
+    GR_DDNAME(grDrawPolygonVertexList); 
+  gc->gcFuncs.grDrawTriangle = (void *) GR_DDNAME(grDrawTriangle); 
+  gc->gcFuncs.grFogColorValue = (void *) GR_DDNAME(grFogColorValue); 
+  gc->gcFuncs.grFogMode = (void *) GR_DDNAME(grFogMode); 
+  gc->gcFuncs.grFogTable = (void *) GR_DDNAME(grFogTable); 
+  gc->gcFuncs.grGammaCorrectionValue = (void *)
+    GR_DDNAME(grGammaCorrectionValue); 
+  gc->gcFuncs.grGlideSetState = (void *) GR_DDNAME(grGlideSetState); 
+  gc->gcFuncs.grGlideShutdown = (void *) GR_DDNAME(grGlideShutdown); 
+  gc->gcFuncs.grLfbConstantAlpha = (void *)
+    GR_DDNAME(grLfbConstantAlpha); 
+  gc->gcFuncs.grLfbConstantDepth = (void *)
+    GR_DDNAME(grLfbConstantDepth); 
+  gc->gcFuncs.grLfbLock = (void *)GR_DDNAME(grLfbLock);
+  gc->gcFuncs.grLfbUnlock = (void*)GR_DDNAME(grLfbUnlock);
+  gc->gcFuncs.grLfbWriteColorFormat = (void *)
+    GR_DDNAME(grLfbWriteColorFormat); 
+  gc->gcFuncs.grLfbWriteColorSwizzle = (void *)
+    GR_DDNAME(grLfbWriteColorSwizzle); 
+  gc->gcFuncs.grRenderBuffer = (void *) GR_DDNAME(grRenderBuffer); 
+  gc->gcFuncs.grSstConfigPipeline = (void *)
+    GR_DDNAME(grSstConfigPipeline); 
+  gc->gcFuncs.grSstIdle = (void *) GR_DDNAME(grSstIdle); 
+  gc->gcFuncs.grSstIsBusy = (void *) GR_DDNAME(grSstIsBusy); 
+  gc->gcFuncs.grSstOpen = (void *) GR_DDNAME(grSstOpen); 
+  gc->gcFuncs.grSstOrigin = (void *) GR_DDNAME(grSstOrigin); 
+  gc->gcFuncs.grSstPassthruMode = (void *) GR_DDNAME(grSstPassthruMode);
+  
+  gc->gcFuncs.grSstPerfStats = (void *) GR_DDNAME(grSstPerfStats); 
+  gc->gcFuncs.grSstResetPerfStats = (void *) GR_DDNAME(grSstResetPerfStats);
+  gc->gcFuncs.grSstStatus = (void *) GR_DDNAME(grSstStatus); 
+  gc->gcFuncs.grSstVRetraceOn = (void *) GR_DDNAME(grSstVRetraceOn); 
+  gc->gcFuncs.grSstVideoLine = (void *) GR_DDNAME(grSstVideoLine); 
+  gc->gcFuncs.grTexClampMode = (void *) GR_DDNAME(grTexClampMode); 
+  gc->gcFuncs.grTexCombine = (void *) GR_DDNAME(grTexCombine); 
+  gc->gcFuncs.grTexDownloadMipMapLevelPartial = (void *)
+    GR_DDNAME(grTexDownloadMipMapLevelPartial); 
+  gc->gcFuncs.grTexFilterMode = (void *) GR_DDNAME(grTexFilterMode); 
+  gc->gcFuncs.grTexLodBiasValue = (void *) GR_DDNAME(grTexLodBiasValue);
+  gc->gcFuncs.grTexMipMapMode = (void *) GR_DDNAME(grTexMipMapMode);
+  gc->gcFuncs.grTexMultibase = (void *) GR_DDNAME(grTexMultibase); 
+  gc->gcFuncs.grTexMultibaseAddress = (void *)
+    GR_DDNAME(grTexMultibaseAddress); 
+  gc->gcFuncs.grTexNCCTable = (void *) GR_DDNAME(grTexNCCTable); 
+  gc->gcFuncs.grTexSource = (void *) GR_DDNAME(grTexSource); 
+  gc->gcFuncs.guMPDrawTriangle = (void *) GR_DDNAME(guMPDrawTriangle); 
+  gc->gcFuncs.guTexSource = (void *) GR_DDNAME(guTexSource);
+  gc->gcFuncs.ConvertAndDownloadRle=(void *) GR_DDNAME(ConvertAndDownloadRle); 
+  gc->gcFuncs.grCheckForRoom=(void *) GR_DDNAME(grCheckForRoom); 
+} /* _grInitializeGCFuncs */
+#endif
Index: trunk/src/opengl/glide/sst1/glide/glfb.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/glfb.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/glfb.c	(revision 2885)
@@ -0,0 +1,1023 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/glfb.c,v 1.1 2000-02-25 00:31:14 sandervl Exp $
+** $Log: glfb.c,v $
+** Revision 1.1  2000-02-25 00:31:14  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 23    6/30/97 10:51a Dow
+ * Changed size check in grLfbLock to warning
+ * 
+ * 22    6/03/97 3:50p Pgj
+ * fix bugs 580 and 581
+ * 
+ * 21    5/05/97 2:25p Hanson
+ * Fixed unlock bug with grLfbUnlock. On Rush it would always return
+ * false.
+ * 
+ * 20    5/02/97 9:43a Dow
+ * Changed indentation to match rest of file, made grLfbLock idle on Jr.
+ * 
+ * 19    4/08/97 12:47p Jdt
+ * Bug in grLfbUnlock()
+ * 
+ * 18    4/02/97 3:24a Hanson
+ * Fixed bug with locking read of Auxbuffer on SST1
+ * 
+ * 17    3/27/97 9:30p Hanson
+ * Fixed my mistake of masking out the no idle bit to late in the
+ * grLfbUnlock code.
+ * 
+ * 16    3/26/97 5:04p Hanson
+ * 
+ * 15    3/19/97 1:37a Jdt
+ * Added real stride computation.
+ * 
+ * 14    3/18/97 9:07p Dow
+ * Got rid of #$#%#$ // comments
+ * 
+ * 13    3/13/97 1:18a Jdt
+ * Re-wrote grLfbWriteRegion to be faster and also be nice to the fifo.
+ * Added grLfbReadRegion for sli boards.  Need an sli setup on whihc to
+ * test.
+ * 
+ * 12    3/12/97 2:54p Jdt
+ * Fixes for vg96
+ * 
+ * 11    3/12/97 11:11a Jdt
+ * Fixed format bug.  Fixed yorigin problem. Fixed locking bug.
+ * 
+ * 10    3/06/97 9:03p Jdt
+ * Removed Watcom Warning.  
+ * 
+ * 9     3/05/97 9:35p Jdt
+ * Added grLfbWriteRegion
+ * 
+ * 8     3/04/97 9:08p Dow
+ * Neutered multiplatform multiheaded monster
+ * 
+ * 7     2/26/97 11:56a Jdt
+ * changed lfb api
+ * 
+ * 6     12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+**
+*/
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+/*---------------------------------------------------------------------------
+** grLfbConstantAlpha
+*/
+GR_ENTRY(grLfbConstantAlpha, void, ( GrAlpha_t alpha ))
+{
+  GR_BEGIN_NOFIFOCHECK("grLfbConstantAlpha",82);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x)\n",alpha));
+
+  gc->state.lfb_constant_alpha = alpha;
+  GR_END();
+} /* grLfbConstantAlpha */
+
+/*---------------------------------------------------------------------------
+** grLfbConstantDepth
+*/
+GR_ENTRY(grLfbConstantDepth, void, ( FxU16 depth ))
+{
+  GR_BEGIN_NOFIFOCHECK("grLfbConstantDepth",82);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x)\n",depth));
+
+  gc->state.lfb_constant_depth = depth;
+  GR_END();
+} /* grLfbConstantDepth */
+
+
+/*-------------------------------------------------------------------
+  Function: grLfbLock
+  Date: 2/19
+  Implementor(s): jdt
+  Library: Glide
+  Description:
+  Secures a pointer to a requested frame buffer and guarantees ordered
+  access to that buffer.
+
+  Arguments:
+  type - type of lock, one of:
+            GR_LOCK_WRITE_ONLY
+            GR_LOCK_READ_ONLY
+  buffer - which buffer to lock, one of:
+            GR_BUFFER_FRONTBUFFER
+            GR_BUFFER_BACKBUFFER
+            GR_BUFFER_AUXBUFFER
+  writeMode - desired destination color format
+  origin - desired lfb origin
+  pixelPipeline - flag whether to process through pixpipe
+  info   - pointer to info structure
+  Return:
+  FXTRUE  - lock is successful
+  FXFALSE - lock fails
+  -------------------------------------------------------------------*/
+
+GR_ENTRY(grLfbLock, FxBool,( GrLock_t type, GrBuffer_t buffer,  GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,  FxBool pixelPipeline, GrLfbInfo_t *info ) ) 
+{
+  FxBool rv = FXTRUE;
+  FxU32  lockIdle;
+  
+  GR_BEGIN_NOFIFOCHECK("grLfbLock",82);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,0x%x)\n", type, buffer, info));
+  
+  GR_CHECK_F( myName, !info,
+             "Null info structure passed." );
+
+  /* changed from GR_CHECK_F to match the docuementation */
+
+  GR_CHECK_W(myName, (info->size != sizeof( GrLfbInfo_t )),
+             "Invalid size sent to grLfbLock()");
+  
+  lockIdle = !(type & GR_LFB_NOIDLE);
+  type = type & ~(GR_LFB_NOIDLE);
+  
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
+  {
+    switch( type ) {
+    case GR_LFB_READ_ONLY:
+      {
+        FxU32 lfbMode;
+
+        if ( gc->lockPtrs[type] != (FxU32)-1 ) {
+          GDBG_INFO(( 83, "Read lock failure due to existing lock" ));
+          rv = FXFALSE;
+        } else {
+          lfbMode = gc->state.fbi_config.lfbMode;
+          lfbMode &= ~( SST_LFB_READBUFSELECT | 
+                       SST_LFB_YORIGIN );
+                    
+          GR_SET_EXPECTED_SIZE( 4 );
+
+          /* You may not read-lock an SLI board */
+          if ( (gc->scanline_interleaved == FXTRUE) &&
+              (gc->lfbSliOk==1) ) {
+            GDBG_INFO((83, 
+                       "Read lock failure: read lock"
+                       " disallowed for SLI, use "
+                       "grLfbReadRegion()\n" ));
+            rv = FXFALSE;
+          }
+
+          switch( buffer ) {
+          case GR_BUFFER_FRONTBUFFER:
+            lfbMode |= SST_LFB_READFRONTBUFFER;
+            break;
+          case GR_BUFFER_BACKBUFFER:
+            lfbMode |= SST_LFB_READBACKBUFFER;
+            break;
+          case GR_BUFFER_AUXBUFFER:
+            lfbMode |= SST_LFB_READAUXBUFFER;
+            break;
+          default:
+            GR_CHECK_F( myName, 
+                       1, 
+                       "illegal buffer parameter passed" );
+            rv = FXFALSE;
+            break;
+          }
+
+          lfbMode |= ( origin )?SST_LFB_YORIGIN:0;
+
+          GR_SET( hw->lfbMode, lfbMode );
+          gc->state.fbi_config.lfbMode = lfbMode;
+
+          info->lfbPtr        = gc->lfb_ptr;
+          info->strideInBytes = gc->fbStride * 2;
+          info->origin        = origin;
+
+          if ( rv == FXTRUE )
+            gc->lockPtrs[type] = buffer;
+        }
+      }
+      break;
+    case GR_LFB_WRITE_ONLY:
+      {
+        FxU32 lfbMode, zaColor, fbzMode;
+
+                
+        if ( gc->lockPtrs[type] != (FxU32)-1 ) {
+          GDBG_INFO(( 83, "Write failure due to existing lock" ));
+          rv = FXFALSE;
+        } else {
+          GR_SET_EXPECTED_SIZE( 12 );
+                    
+          /*
+           ** Set up the constant depth register because it may have been
+           ** trashed by a call to grDepthBiasLevel (depthbiaslevel and
+           ** constant depth use the same register)
+           */
+          zaColor = gc->state.fbi_config.zaColor;
+          zaColor = ((( FxU32 ) gc->state.lfb_constant_depth ) << SST_ZACOLOR_DEPTH_SHIFT );
+          zaColor |= (gc->state.lfb_constant_alpha << SST_ZACOLOR_ALPHA_SHIFT);
+          GR_SET( hw->zaColor, zaColor );
+                    
+          /*
+           ** disable depth biasing
+           */
+          fbzMode = gc->state.fbi_config.fbzMode;
+          fbzMode &= ~( SST_ENZBIAS );
+                    
+          lfbMode = gc->state.fbi_config.lfbMode;
+          lfbMode &= ~( SST_LFB_WRITEBUFSELECT |
+                       SST_LFB_YORIGIN        |
+                       SST_LFB_FORMAT         |
+                       SST_LFB_ENPIXPIPE );
+                    
+          switch( writeMode ) {
+          case GR_LFBWRITEMODE_RESERVED1:
+          case GR_LFBWRITEMODE_RESERVED2:
+          case GR_LFBWRITEMODE_RESERVED3:
+          case GR_LFBWRITEMODE_RESERVED4:
+          case GR_LFBWRITEMODE_RESERVED5:
+          case GR_LFBWRITEMODE_RESERVED6:
+          case GR_LFBWRITEMODE_RESERVED7:
+            rv = FXFALSE;
+          }
+
+          switch( buffer ) {
+          case GR_BUFFER_FRONTBUFFER:
+            if (writeMode == GR_LFBWRITEMODE_ANY) {
+                writeMode = GR_LFBWRITEMODE_565;
+            } else if ( writeMode == GR_LFBWRITEMODE_ZA16 ) {
+              rv = FXFALSE;
+            }
+            lfbMode |= SST_LFB_WRITEFRONTBUFFER;
+            break;
+          case GR_BUFFER_BACKBUFFER:
+            if (writeMode == GR_LFBWRITEMODE_ANY) {
+                writeMode = GR_LFBWRITEMODE_565;
+            } else if ( writeMode == GR_LFBWRITEMODE_ZA16 ) {
+              rv = FXFALSE;
+            }
+            lfbMode |= SST_LFB_WRITEBACKBUFFER;
+            break;
+          case GR_BUFFER_AUXBUFFER:
+            if (writeMode == GR_LFBWRITEMODE_ANY) {
+                writeMode = GR_LFBWRITEMODE_ZA16;
+            } else if ( writeMode != GR_LFBWRITEMODE_ZA16 ) {
+              rv = FXFALSE;
+            }
+            lfbMode |= SST_LFB_WRITEFRONTBUFFER;
+            break;
+          default:
+            GR_CHECK_F( myName, 
+                       1, 
+                       "illegal buffer parameter passed" );
+            break;
+          } /* end switch(buffer) */
+
+          lfbMode |= ( writeMode << SST_LFB_FORMAT_SHIFT );
+          lfbMode |= ( origin )?SST_LFB_YORIGIN:0;
+
+          if ( pixelPipeline ) {
+            lfbMode |= SST_LFB_ENPIXPIPE;
+            fbzMode &= ~SST_YORIGIN;
+            fbzMode |= (origin)?SST_YORIGIN:0;
+          }
+
+          GR_SET( hw->lfbMode, lfbMode );
+          gc->state.fbi_config.lfbMode = lfbMode;
+
+          GR_SET( hw->fbzMode, fbzMode );
+          P6FENCE;              /* This is required to flush the write
+                                   buffers before the actual LFB writes */
+
+          /* GMT: very low-risk race condition is probable here
+             if a direct LFB read is done aftewards, the lfbMode register might
+             not have settled in yet, and the pixel may be read in the wrong
+             mode.  However, the 2 write above help reduce the chance of this.
+             The proper thing to do is to call grSstIdle() here, but that's 
+             too slow.
+             */
+
+          info->lfbPtr    = gc->lfb_ptr;
+          info->origin    = origin;
+          info->writeMode = writeMode;
+                    
+          switch( lfbMode & SST_LFB_FORMAT ) {
+          case SST_LFB_565:
+          case SST_LFB_555:
+          case SST_LFB_1555:
+          case SST_LFB_ZZ:
+            info->strideInBytes = gc->fbStride * 2;
+            break;
+          case SST_LFB_888:
+          case SST_LFB_8888:
+          case SST_LFB_Z565:
+          case SST_LFB_Z555:
+          case SST_LFB_Z1555:
+            info->strideInBytes = gc->fbStride * 4;
+            break;
+          }
+                    
+          if ( rv == FXTRUE ) 
+            gc->lockPtrs[type] = buffer;
+        }
+      }
+      break;
+    default:
+      rv = FXFALSE;
+      GDBG_INFO((gc->myLevel,  "Lock failed because of invalid lock type." ));
+      break;
+    }
+  }
+  
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+  switch( type ) {
+  case GR_LFB_READ_ONLY:
+    if ( gc->lockPtrs[type]!= (FxU32)-1 ) {
+      GDBG_INFO(( 83, "Read lock failure due to existing lock" ));
+      rv = FXFALSE;
+    } else {
+      info->lfbPtr = initGetBufferPtr( buffer, &info->strideInBytes );
+      if ( origin != GR_ORIGIN_UPPER_LEFT ) {
+        GDBG_INFO((gc->myLevel,  
+                   "Lock failed because of unsu"
+                   "pported origin." ));
+        rv = FXFALSE;
+      }
+      info->origin = GR_ORIGIN_UPPER_LEFT;
+      if ( rv == FXTRUE ) 
+        gc->lockPtrs[type] = buffer;
+    }
+    break;
+  case GR_LFB_WRITE_ONLY:
+    if ( gc->lockPtrs[type]!= (FxU32)-1 ) {
+      GDBG_INFO(( 83, "Read lock failure due to existing lock" ));
+      rv = FXFALSE;
+    } else {
+      info->lfbPtr = initGetBufferPtr( buffer, &info->strideInBytes );
+      if ( !info->lfbPtr ) {
+        GDBG_INFO((gc->myLevel,  
+                   "Lock failed because buffer doesn't exist" ));
+        rv = FXFALSE;
+      }
+      if ( origin != GR_ORIGIN_UPPER_LEFT ) {
+        GDBG_INFO((gc->myLevel,  
+                   "Lock failed because of unsupported origin." ));
+        rv = FXFALSE;
+      }
+
+      /* Voodoo Rush lfb writes don't go through the pixel pipeline */
+      switch( buffer ) {
+      case GR_BUFFER_FRONTBUFFER:
+        if (writeMode == GR_LFBWRITEMODE_ANY) {
+          writeMode = GR_LFBWRITEMODE_565;
+        } else if ( writeMode != GR_LFBWRITEMODE_565 ) {
+          rv = FXFALSE;
+        }
+        break;
+      case GR_BUFFER_BACKBUFFER:
+        if (writeMode == GR_LFBWRITEMODE_ANY) {
+          writeMode = GR_LFBWRITEMODE_565;
+        } else if ( writeMode != GR_LFBWRITEMODE_565 ) {
+          rv = FXFALSE;
+        }
+        break;
+      case GR_BUFFER_AUXBUFFER:
+        if (writeMode == GR_LFBWRITEMODE_ANY) {
+          writeMode = GR_LFBWRITEMODE_ZA16;
+        } else if ( writeMode != GR_LFBWRITEMODE_ZA16 ) {
+          rv = FXFALSE;
+        }
+        break;
+      default:
+        GR_CHECK_F( myName, 1, "illegal buffer parameter passed" );
+        break;
+      } /* end switch(buffer) */
+
+      if ( pixelPipeline ) {
+        GDBG_INFO((gc->myLevel,  
+                   "Lock failed because pixelpipeline is not available on VG96." ));
+        rv = FXFALSE;
+      }
+      info->writeMode = writeMode;
+      info->origin = GR_ORIGIN_UPPER_LEFT;
+      if ( rv == FXTRUE ) 
+        gc->lockPtrs[type] = buffer;
+      GDBG_INFO(( gc->myLevel, 
+                 "Write Lock Successful: ptr=0x%.08x stride=%.04d\n",
+                 info->lfbPtr,
+                 info->strideInBytes ));
+    }
+    break;
+  } /* end switch(type) */
+
+#else
+#  error "No lfb implementation for this platform"
+#endif
+  GR_CHECK_SIZE();
+  /* We HAVE to idle on Jr., as out-of-order LFBs are unacceptable */
+  if (
+      lockIdle ||
+      (
+       _GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].type ==
+       GR_SSTTYPE_SST96
+       )
+      )
+    grSstIdle();
+  GR_RETURN( rv );
+} /* grLfbLock */
+    
+/*-------------------------------------------------------------------
+  Function: grLfbUnlock
+  Date: 2/21
+  Implementor(s): jdt
+  Library: Glide
+  Description:
+  Unlock a previously locked buffer
+  Arguments:
+  type - type of lock ( read only/write only )
+  buffer - which buffer to unlock 
+  Return:
+  FXTRUE  - success
+  FXFALSE - failure
+  -------------------------------------------------------------------*/
+
+GR_ENTRY(grLfbUnlock, FxBool, ( GrLock_t type, GrBuffer_t buffer ) )
+{
+  FxBool rval = FXFALSE;
+  
+  GR_BEGIN_NOFIFOCHECK("grLfbUnLock",83 );
+  GDBG_INFO_MORE((gc->myLevel,"(%d, %d)\n", type, buffer ));
+  
+  type = type & ~(GR_LFB_NOIDLE);
+  
+  GR_CHECK_F( myName, 
+             type != GR_LFB_WRITE_ONLY &&
+             type != GR_LFB_READ_ONLY,
+             "Bad type" );
+  
+  GR_CHECK_F( myName, 
+             buffer != GR_BUFFER_FRONTBUFFER &&
+             buffer != GR_BUFFER_BACKBUFFER  &&
+             buffer != GR_BUFFER_AUXBUFFER,
+             "Bad buffer" );
+  
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )  
+  if ( gc->lockPtrs[type] == (FxU32)buffer ) {
+    rval = FXTRUE;
+
+    if ( gc->scanline_interleaved == FXTRUE ) {
+      GR_SET_EXPECTED_SIZE( 12 );
+    } else {
+      GR_SET_EXPECTED_SIZE( 8 );
+    }
+
+    /* Restore depth bias level */
+    GR_SET( hw->zaColor, gc->state.fbi_config.zaColor );
+  
+    /* turn back on depth biasing */
+    GR_SET( hw->fbzMode, gc->state.fbi_config.fbzMode );
+
+    if ( gc->scanline_interleaved == FXTRUE ) 
+      GR_SET( hw->nopCMD, 0x0 );
+
+    gc->lockPtrs[type] = (FxU32)-1;
+  } else {
+    GDBG_INFO((gc->myLevel, "Unlock failed because there was no matching lock" ));
+    rval = FXFALSE;
+  }
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+  if ( gc->lockPtrs[type] == (FxU32)buffer ) {
+    rval = FXTRUE;
+
+    gc->lockPtrs[type] = (FxU32)-1;
+  } else {
+    GDBG_INFO((gc->myLevel, "Unlock failed because there was no matching lock" ));
+    rval = FXFALSE;
+  }
+#endif
+  GR_RETURN( rval );
+} /* grLfbUnlock */
+
+
+/*---------------------------------------------------------------------------
+** grLfbWriteColorFormat
+**
+*/
+
+GR_ENTRY(grLfbWriteColorFormat, void, (GrColorFormat_t colorFormat))
+{
+#if !(GLIDE_PLATFORM & GLIDE_HW_SST96)
+  FxU32 lfbMode;
+
+  GR_BEGIN("grLfbWriteColorFormat",82,8);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",colorFormat));
+
+  GR_CHECK_F(myName,
+              colorFormat < 0 || colorFormat > 0x3,
+              "invalid color format");
+
+  lfbMode = gc->state.fbi_config.lfbMode;
+  lfbMode &= ~SST_LFB_RGBALANES;
+  lfbMode |= (colorFormat << SST_LFB_RGBALANES_SHIFT);
+
+  GR_SET( hw->lfbMode, lfbMode );
+  gc->state.fbi_config.lfbMode = lfbMode;
+  if ( gc->scanline_interleaved == FXTRUE ) 
+    GR_SET( hw-> nopCMD, 0x0 );
+  GR_END_SLOPPY();
+#else
+  return;
+#endif
+} /* grLfbWriteColorFormat */
+
+
+/*---------------------------------------------------------------------------
+**  grLfbWriteColorSwizzle  - set up SST for byte swizzling and word swapping
+**
+**  Registers/Bits Affected:
+**  lfbMode:  bit(11), bit(12)
+**
+**  WARNING:  GMT: SST_LFB_WRITE_SWAP16 changes pixel addressing!!!
+*/
+
+GR_ENTRY(grLfbWriteColorSwizzle, void, (FxBool swizzleBytes, FxBool swapWords))
+{
+#if !(GLIDE_PLATFORM & GLIDE_HW_SST96)
+  FxU32 lfbMode;
+
+  GR_BEGIN("grLfbWriteColorSwizzle",82,8);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d)\n",swizzleBytes,swapWords));
+
+  /* Clear out the bits we'll set back if appropriate */
+  lfbMode = gc->state.fbi_config.lfbMode;
+  lfbMode &= ~(SST_LFB_WRITE_SWAP16 | SST_LFB_WRITE_BYTESWAP);
+
+  if (swizzleBytes)
+    lfbMode |= SST_LFB_WRITE_BYTESWAP;
+
+  if (swapWords)
+    lfbMode |= SST_LFB_WRITE_SWAP16;
+
+  GR_SET( hw->lfbMode, lfbMode );
+  gc->state.fbi_config.lfbMode = lfbMode;
+  if ( gc->scanline_interleaved == FXTRUE ) 
+    GR_SET( hw-> nopCMD, 0x0 );
+  GR_END_SLOPPY();
+#else
+  return;
+#endif
+} /* grLfbWriteColorSwizzle */
+
+/*-------------------------------------------------------------------
+  Function: grLfbWriteRegion
+  Date: 3/5
+  Implementor(s): jdt
+  Library: Glide
+  Description:
+  Write a pixel rectangle to the frame buffer as efficiently as possible
+  Arguments:
+  dst_buffer  - buffer to which to copy data
+  dst_x,dst_y - destination image start coordinates
+  src_format  - data format of source image
+  src_width, src_height 
+              - dimensions of source image
+  src_stride  - stride of source image in bytes, not meaningful
+                for RLE images
+  src_data    - pointer to source data memory           
+  Return:
+  FXTRUE  succeed
+  FXFALSE fail
+  -------------------------------------------------------------------*/
+GR_ENTRY(grLfbWriteRegion, FxBool, ( GrBuffer_t dst_buffer, 
+                                     FxU32 dst_x, FxU32 dst_y, 
+                                     GrLfbSrcFmt_t src_format, 
+                                     FxU32 src_width, FxU32 src_height, 
+                                     FxI32 src_stride, void *src_data ))
+{
+  FxBool           rv = FXTRUE;
+  GrLfbInfo_t      info;
+  GrLfbWriteMode_t writeMode;
+  
+  GR_BEGIN_NOFIFOCHECK("grLfbWriteRegion",82);
+  GDBG_INFO_MORE((gc->myLevel,
+                  "(0x%x,%d,%d,%d,%d,%d,%d,0x%x)\n", 
+                  dst_buffer, dst_x, dst_y, 
+                  src_format, src_width, src_height,
+                  src_stride, src_data ));
+  
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
+  if ( src_format == GR_LFB_SRC_FMT_RLE16 ) 
+    writeMode = GR_LFBWRITEMODE_565;
+  else 
+    writeMode = src_format;
+  
+  info.size = sizeof( info );
+  
+  if ( grLfbLock( GR_LFB_WRITE_ONLY | GR_LFB_NOIDLE, 
+                 dst_buffer, 
+                 writeMode,
+                 GR_ORIGIN_UPPER_LEFT,
+                 FXFALSE,
+                 &info ) ) {
+    FxU32 *srcData;             /* Tracking Source Pointer */
+    FxU32 *dstData;             /* Tracking Destination Pointer */
+    FxU32 *end;                 /* Demarks End of each Scanline */
+    FxI32 srcJump;              /* bytes to next scanline */
+    FxU32 dstJump;              /* bytes to next scanline */
+    FxU32 length;               /* bytes to copy in scanline */
+    FxU32 scanline;             /* scanline number */
+    int   aligned;              /* word aligned? */
+    
+    
+    srcData = ( FxU32 * ) src_data;
+    dstData = ( FxU32 * ) ( ((char*)info.lfbPtr)+
+                           (dst_y*info.strideInBytes) );
+    scanline = src_height;
+    
+    switch( src_format ) {
+      /* 16-bit aligned */
+    case GR_LFB_SRC_FMT_565:
+    case GR_LFB_SRC_FMT_555:
+    case GR_LFB_SRC_FMT_1555:
+    case GR_LFB_SRC_FMT_ZA16:
+      dstData = (FxU32*)(((FxU16*)dstData) + dst_x);
+      length  = src_width * 2;
+      aligned = !((int)dstData&0x2);
+      srcJump = src_stride - length;
+      dstJump = info.strideInBytes - length;
+      if ( aligned ) {
+        while( scanline-- ) {
+          GR_SET_EXPECTED_SIZE(length);
+          end = (FxU32*)((char*)srcData + length - 2);
+          while( srcData < end ) {
+            GR_SET( dstData[0], srcData[0] );
+            dstData++;
+            srcData++;
+          }
+                    
+          if ( ((int)length) & 0x2 ) {
+            GR_SET16( (*(FxU16*)&(dstData[0])),
+                     (*(FxU16*)&(srcData[0])) );
+            dstData = (FxU32*)(((FxU16*)dstData) + 1 );
+            srcData = (FxU32*)(((FxU16*)srcData) + 1 );
+          }
+                    
+          dstData = (FxU32*)(((char*)dstData)+dstJump);
+          srcData = (FxU32*)(((char*)srcData)+srcJump);
+          GR_CHECK_SIZE_SLOPPY();
+        }
+      } else {
+        while( scanline-- ) {
+          GR_SET_EXPECTED_SIZE(length);
+          end = (FxU32*)((char*)srcData + length - 2);
+                    
+          GR_SET16( (*(FxU16*)&(dstData[0])),
+                   (*(FxU16*)&(srcData[0])) );
+          dstData = (FxU32*)(((FxU16*)dstData) + 1 );
+          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
+                    
+          while( srcData < end ) {
+            GR_SET( dstData[0], srcData[0] );
+            dstData++;
+            srcData++;
+          }
+                    
+          if ( !(length & 0x2) ) {
+            GR_SET16( (*(FxU16*)&(dstData[0])),
+                     (*(FxU16*)&(srcData[0])) );
+            dstData = (FxU32*)(((FxU16*)dstData) + 1 );
+            srcData = (FxU32*)(((FxU16*)srcData) + 1 );
+          }
+                    
+          dstData = (FxU32*)(((char*)dstData)+dstJump);
+          srcData = (FxU32*)(((char*)srcData)+srcJump);
+          GR_CHECK_SIZE_SLOPPY();
+        }
+      }
+      break;
+      /* 32-bit aligned */
+    case GR_LFB_SRC_FMT_888:
+    case GR_LFB_SRC_FMT_8888:
+    case GR_LFB_SRC_FMT_565_DEPTH:
+    case GR_LFB_SRC_FMT_555_DEPTH:
+    case GR_LFB_SRC_FMT_1555_DEPTH:
+      dstData = ((FxU32*)dstData) + dst_x;
+      length  = src_width * 4;
+      srcJump = src_stride - length;
+      dstJump = info.strideInBytes - length;
+      while( scanline-- ) {
+        GR_SET_EXPECTED_SIZE(length);
+        end = (FxU32*)((char*)srcData + length);
+        while( srcData < end ) {
+          GR_SET( dstData[0], srcData[0] );
+          dstData++;
+          srcData++;
+        }
+        dstData = (FxU32*)(((char*)dstData)+dstJump);
+        srcData = (FxU32*)(((char*)srcData)+srcJump);
+        GR_CHECK_SIZE_SLOPPY();
+      }
+      break;
+    case GR_LFB_SRC_FMT_RLE16:
+      /* needs to be implemented */
+      rv = FXFALSE;
+      break;
+    }
+    grLfbUnlock( GR_LFB_WRITE_ONLY, dst_buffer );
+  } else {
+    rv = FXFALSE;
+  }
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+  if ( src_format == GR_LFB_SRC_FMT_RLE16 ) {
+    rv = FXFALSE;
+    GR_RETURN( rv );
+  } else 
+    writeMode = src_format;
+  
+  info.size = sizeof( info );
+  
+  if ( grLfbLock( GR_LFB_WRITE_ONLY,
+                 dst_buffer, 
+                 writeMode,
+                 GR_ORIGIN_UPPER_LEFT,
+                 FXFALSE,
+                 &info ) ) {
+    FxU32 *srcData;             /* Tracking Source Pointer */
+    FxU32 *dstData;             /* Tracking Destination Pointer */
+    FxU32 *end;                 /* Demarks End of each Scanline */
+    FxI32 srcJump;              /* bytes to next scanline */
+    FxU32 dstJump;              /* bytes to next scanline */
+    FxU32 length;               /* bytes to copy in scanline */
+    FxU32 scanline;             /* scanline number */
+    int   aligned;              /* word aligned? */
+    
+    
+    srcData = ( FxU32 * ) src_data;
+    dstData = ( FxU32 * ) ( ((char*)info.lfbPtr)+
+                           (dst_y*info.strideInBytes)+
+                           (dst_x<<1));
+    scanline = src_height;
+    length  = src_width * 2;
+    aligned = !((int)dstData&0x2);
+    srcJump = src_stride - length;
+    dstJump = info.strideInBytes - length;
+    if ( aligned ) {
+      while( scanline-- ) {
+        end = (FxU32*)((char*)srcData + length - 2);
+        while( srcData < end ) 
+          *dstData++ = *srcData++;
+                
+        if ( ((int)length) & 0x2 ) {
+          *(FxU16*)dstData = *(FxU16*)srcData;
+          dstData = (FxU32*)(((FxU16*)dstData) + 1 );
+          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
+        }
+                
+        dstData = (FxU32*)(((char*)dstData)+dstJump);
+        srcData = (FxU32*)(((char*)srcData)+srcJump);
+      }
+    } else {
+      while( scanline-- ) {
+        end = (FxU32*)((char*)srcData + length - 2);
+                
+        *(FxU16*)dstData = *(FxU16*)srcData;
+        dstData = (FxU32*)(((FxU16*)dstData) + 1 );
+        srcData = (FxU32*)(((FxU16*)srcData) + 1 );
+                
+        while( srcData < end ) 
+          *dstData++ = *srcData++;
+                
+        if ( !(((int)length) & 0x2) ) {
+          *(FxU16*)dstData = *(FxU16*)srcData;
+          dstData = (FxU32*)(((FxU16*)dstData) + 1 );
+          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
+        }
+                
+        dstData = (FxU32*)(((char*)dstData)+dstJump);
+        srcData = (FxU32*)(((char*)srcData)+srcJump);
+      }
+    }
+    grLfbUnlock( GR_LFB_WRITE_ONLY, dst_buffer );
+  } else {
+    rv = FXFALSE;
+  }
+#else 
+#  error "No grLfbWriteRegion Implementation for this platform"     
+#endif
+  GR_RETURN( rv );
+} /* grLfbWriteRegion */
+
+
+/*-------------------------------------------------------------------
+  Function: grLfbReadRegion
+  Date: 3/12
+  Implementor(s): jdt
+  Library: Glide
+  Description:
+  Grab a rectangle from the frame buffer into user supplied memory
+  Arguments:
+  src_buffer - buffer to read from 
+  src_x      - x coordinate of upper left corner rectangle to read
+  src_y      - y coordinate of upper left corner of rectangle to read
+  src_width  - width of rectangle to read
+  src_height - height of rectangle to read
+  dst_stride - distance between scanlines in destination buffer
+  dst_data   - pointer to user memory in which to place image
+  Return:
+  FXTRUE - success
+  FXFALSE - failure
+  -------------------------------------------------------------------*/
+GR_ENTRY(grLfbReadRegion, FxBool, ( GrBuffer_t src_buffer, 
+                                    FxU32 src_x, FxU32 src_y, 
+                                    FxU32 src_width, FxU32 src_height, 
+                                    FxU32 dst_stride, void *dst_data ))
+{
+  FxBool rv = FXTRUE;
+  GrLfbInfo_t info;
+  
+  GR_BEGIN_NOFIFOCHECK("grLfbReadRegion",82);
+  GDBG_INFO_MORE((gc->myLevel,
+                  "(0x%x,%d,%d,%d,%d,%d,0x%x)\n",
+                  src_buffer, src_x, src_y,
+                  src_width, src_height, dst_stride, dst_data ));
+  
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
+  gc->lfbSliOk = 1;
+  info.size = sizeof( info );
+  if ( grLfbLock( GR_LFB_READ_ONLY,
+                 src_buffer, 
+                 GR_LFBWRITEMODE_ANY,
+                 GR_ORIGIN_UPPER_LEFT,
+                 FXFALSE,
+                 &info ) ) {
+    FxU32 *srcData;             /* Tracking Source Pointer */
+    FxU32 *dstData;             /* Tracking Destination Pointer */
+    FxU32 *end;                 /* Demarks End of each Scanline */
+    FxU32 srcJump;              /* bytes to next scanline */
+    FxU32 dstJump;              /* bytes to next scanline */
+    FxU32 length;               /* bytes to copy in scanline */
+    FxU32 scanline;             /* scanline number */
+    int   aligned;              /* word aligned? */
+    FxU32 odd;                  /* is src_y odd? ( for sli ) */
+    
+    dstData = ( FxU32 * ) dst_data;
+    srcData = ( FxU32 * ) ( ((char*)info.lfbPtr)+
+                           (src_y*info.strideInBytes) +
+                           (src_x<<1) );
+    scanline = src_height;
+    length   = src_width * 2;
+    dstJump  = dst_stride - length;
+    srcJump  = info.strideInBytes - length;
+    aligned  = !((int)srcData&0x2);
+    odd      = (src_y+src_height) & 0x1;
+    
+    if ( aligned ) {
+      while( scanline-- ) {
+        end = (FxU32*)((char*)srcData + length - 2);
+
+        if(gc->scanline_interleaved == FXTRUE) {
+          if((scanline+odd) & 0x1)
+            sst1InitSliPciOwner(gc->base_ptr, SST_SLI_MASTER_OWNPCI);
+          else
+            sst1InitSliPciOwner(gc->base_ptr, SST_SLI_SLAVE_OWNPCI);
+        }
+
+        while( srcData < end ) 
+          *dstData++ = *srcData++;
+                
+        if ( ((int)length) & 0x2 ) {
+          (*(FxU16*)dstData) = (*(FxU16*)srcData);
+          dstData = (FxU32*)(((FxU16*)dstData) + 1 );
+          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
+        }
+                
+        dstData = (FxU32*)(((char*)dstData)+dstJump);
+        srcData = (FxU32*)(((char*)srcData)+srcJump);
+      }
+    } else {
+      while( scanline-- ) {
+        end = (FxU32*)((char*)srcData + length - 2);
+                
+        if(gc->scanline_interleaved == FXTRUE) {
+          if((scanline+odd) & 0x1)
+            sst1InitSliPciOwner(gc->base_ptr, SST_SLI_MASTER_OWNPCI);
+          else
+            sst1InitSliPciOwner(gc->base_ptr, SST_SLI_SLAVE_OWNPCI);
+        }
+
+        (*(FxU16*)dstData) = (*(FxU16*)srcData);
+        dstData = (FxU32*)(((FxU16*)dstData) + 1 );
+        srcData = (FxU32*)(((FxU16*)srcData) + 1 );
+
+        while( srcData < end )
+          *dstData++ = *srcData++;
+
+        if ( !(((int)length) & 0x2) ) {
+          (*(FxU16*)dstData) = (*(FxU16*)srcData);
+          dstData = (FxU32*)(((FxU16*)dstData) + 1 );
+          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
+        }
+                
+        dstData = (FxU32*)(((char*)dstData)+dstJump);
+        srcData = (FxU32*)(((char*)srcData)+srcJump);
+      }
+    }
+    grLfbUnlock( GR_LFB_READ_ONLY, src_buffer );
+    if ( gc->scanline_interleaved ) 
+      sst1InitSliPciOwner( gc->base_ptr, SST_SLI_MASTER_OWNPCI );
+  } else {
+    rv = FXFALSE;
+  }
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+  info.size = sizeof( info );
+  if ( grLfbLock( GR_LFB_READ_ONLY,
+                 src_buffer, 
+                 GR_LFBWRITEMODE_ANY,
+                 GR_ORIGIN_UPPER_LEFT,
+                 FXFALSE,
+                 &info ) ) {
+    FxU32 *srcData;             /* Tracking Source Pointer */
+    FxU32 *dstData;             /* Tracking Destination Pointer */
+    FxU32 *end;                 /* Demarks End of each Scanline */
+    FxU32 srcJump;              /* bytes to next scanline */
+    FxU32 dstJump;              /* bytes to next scanline */
+    FxU32 length;               /* bytes to copy in scanline */
+    FxU32 scanline;             /* scanline number */
+    int   aligned;              /* word aligned? */
+    
+    dstData = ( FxU32 * ) dst_data;
+    srcData = ( FxU32 * ) ( ((char*)info.lfbPtr)+
+                           (src_y*info.strideInBytes) +
+                           (src_x<<1) );
+    scanline = src_height;
+    length   = src_width * 2;
+    dstJump  = dst_stride - length;
+    srcJump  = info.strideInBytes - length;
+    aligned  = !((int)srcData&0x2);
+    
+    if ( aligned ) {
+      while( scanline-- ) {
+        end = (FxU32*)((char*)srcData + length - 2);
+
+        while( srcData < end ) 
+          *dstData++ = *srcData++;
+                
+        if ( ((int)length) & 0x2 ) {
+          (*(FxU16*)dstData) = (*(FxU16*)srcData);
+          dstData = (FxU32*)(((FxU16*)dstData) + 1 );
+          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
+        }
+                
+        dstData = (FxU32*)(((char*)dstData)+dstJump);
+        srcData = (FxU32*)(((char*)srcData)+srcJump);
+      }
+    } else {
+      while( scanline-- ) {
+        end = (FxU32*)((char*)srcData + length - 2);
+                
+        (*(FxU16*)dstData) = (*(FxU16*)srcData);
+        dstData = (FxU32*)(((FxU16*)dstData) + 1 );
+        srcData = (FxU32*)(((FxU16*)srcData) + 1 );
+
+        while( srcData < end )
+          *dstData++ = *srcData++;
+
+        if ( !(((int)length) & 0x2) ) {
+          (*(FxU16*)dstData) = (*(FxU16*)srcData);
+          dstData = (FxU32*)(((FxU16*)dstData) + 1 );
+          srcData = (FxU32*)(((FxU16*)srcData) + 1 );
+        }
+                
+        dstData = (FxU32*)(((char*)dstData)+dstJump);
+        srcData = (FxU32*)(((char*)srcData)+srcJump);
+      }
+    }
+    grLfbUnlock( GR_LFB_READ_ONLY, src_buffer );
+  } else {
+    rv = FXFALSE;
+  }
+#else 
+#  error "No grLfbReadRegion Implementation for this platform"     
+#endif
+  GR_RETURN( rv );
+}/* grLfbReadRegion */
+
Index: trunk/src/opengl/glide/sst1/glide/glide.h
===================================================================
--- trunk/src/opengl/glide/sst1/glide/glide.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/glide.h	(revision 2885)
@@ -0,0 +1,1522 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+*/
+
+/*
+** GLIDE.H
+**
+** The following #defines are relevant when using Glide:
+**
+** One of the following "platform constants" must be defined during
+** compilation:
+**
+**            __DOS__           Defined for 32-bit DOS applications
+**            __WIN32__         Defined for 32-bit Windows applications
+**            __sparc__         Defined for Sun Solaris/SunOS
+**            __linux__         Defined for Linux applications
+**            __IRIX__          Defined for SGI Irix applications
+**
+*/
+#ifndef __GLIDE_H__
+#define __GLIDE_H__
+
+#include <3dfx.h>
+#include <glidesys.h>
+#include <sst1vid.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** -----------------------------------------------------------------------
+** TYPE DEFINITIONS
+** -----------------------------------------------------------------------
+*/
+typedef FxU32 GrColor_t;
+typedef FxU8  GrAlpha_t;
+typedef FxU32 GrMipMapId_t;
+typedef FxU8  GrFog_t;
+#ifdef __WIN32OS2__
+typedef void (* FX_CALL GrProc)();
+#else
+typedef void (FX_CALL *GrProc)();
+#endif
+
+/*
+** -----------------------------------------------------------------------
+** CONSTANTS AND TYPES
+** -----------------------------------------------------------------------
+*/
+#define MAX_NUM_SST            4
+#define MAX_MIPMAPS_PER_SST    1024
+
+//#ifndef GLIDE_LIB
+#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
+#define GR_FOG_TABLE_SIZE      128
+#else /* !(defined(GLIDE3) && defined(GLIDE3_ALPHA)) */
+#define GR_FOG_TABLE_SIZE      64
+#endif /* !(defined(GLIDE3) && defined(GLIDE3_ALPHA)) */
+//#endif /* GLIDE_LIB */
+
+#define GR_NULL_MIPMAP_HANDLE  ((GrMipMapId_t) -1)
+#define GR_ZDEPTHVALUE_NEAREST  0xFFFF
+#define GR_ZDEPTHVALUE_FARTHEST 0x0000
+#define GR_WDEPTHVALUE_NEAREST  0x0000
+#define GR_WDEPTHVALUE_FARTHEST 0xFFFF
+
+#define GR_MIPMAPLEVELMASK_EVEN  FXBIT(0)
+#define GR_MIPMAPLEVELMASK_ODD  FXBIT(1)
+#define GR_MIPMAPLEVELMASK_BOTH (GR_MIPMAPLEVELMASK_EVEN | GR_MIPMAPLEVELMASK_ODD )
+
+#define GR_LODBIAS_BILINEAR     0.5
+#define GR_LODBIAS_TRILINEAR    0.0
+
+typedef FxI32 GrChipID_t;
+#define GR_TMU0         0x0
+#define GR_TMU1         0x1
+#define GR_TMU2         0x2
+#define GR_FBI          0x3
+
+typedef FxI32 GrCombineFunction_t;
+#define GR_COMBINE_FUNCTION_ZERO        0x0
+#define GR_COMBINE_FUNCTION_NONE        GR_COMBINE_FUNCTION_ZERO
+#define GR_COMBINE_FUNCTION_LOCAL       0x1
+#define GR_COMBINE_FUNCTION_LOCAL_ALPHA 0x2
+#define GR_COMBINE_FUNCTION_SCALE_OTHER 0x3
+#define GR_COMBINE_FUNCTION_BLEND_OTHER GR_COMBINE_FUNCTION_SCALE_OTHER
+#define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL 0x4
+#define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA 0x5 
+#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL 0x6
+#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL 0x7
+#define GR_COMBINE_FUNCTION_BLEND GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL
+#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x8
+#define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL 0x9
+#define GR_COMBINE_FUNCTION_BLEND_LOCAL GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL
+#define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x10
+
+typedef FxI32 GrCombineFactor_t;
+#define GR_COMBINE_FACTOR_ZERO          0x0
+#define GR_COMBINE_FACTOR_NONE          GR_COMBINE_FACTOR_ZERO
+#define GR_COMBINE_FACTOR_LOCAL         0x1
+#define GR_COMBINE_FACTOR_OTHER_ALPHA   0x2
+#define GR_COMBINE_FACTOR_LOCAL_ALPHA   0x3
+#define GR_COMBINE_FACTOR_TEXTURE_ALPHA 0x4
+#define GR_COMBINE_FACTOR_TEXTURE_RGB   0x5
+#define GR_COMBINE_FACTOR_DETAIL_FACTOR GR_COMBINE_FACTOR_TEXTURE_ALPHA
+#define GR_COMBINE_FACTOR_LOD_FRACTION  0x5
+#define GR_COMBINE_FACTOR_ONE           0x8
+#define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL 0x9
+#define GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA 0xa
+#define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA 0xb
+#define GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA 0xc
+#define GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA
+#define GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION 0xd
+
+
+typedef FxI32 GrCombineLocal_t;
+#define GR_COMBINE_LOCAL_ITERATED 0x0
+#define GR_COMBINE_LOCAL_CONSTANT 0x1
+#define GR_COMBINE_LOCAL_NONE GR_COMBINE_LOCAL_CONSTANT
+#define GR_COMBINE_LOCAL_DEPTH  0x2
+
+typedef FxI32 GrCombineOther_t;
+#define GR_COMBINE_OTHER_ITERATED 0x0
+#define GR_COMBINE_OTHER_TEXTURE 0x1
+#define GR_COMBINE_OTHER_CONSTANT 0x2
+#define GR_COMBINE_OTHER_NONE GR_COMBINE_OTHER_CONSTANT
+
+
+typedef FxI32 GrAlphaSource_t;
+#define GR_ALPHASOURCE_CC_ALPHA 0x0
+#define GR_ALPHASOURCE_ITERATED_ALPHA 0x1
+#define GR_ALPHASOURCE_TEXTURE_ALPHA 0x2
+#define GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA 0x3
+
+
+typedef FxI32 GrColorCombineFnc_t;
+#define GR_COLORCOMBINE_ZERO 0x0
+#define GR_COLORCOMBINE_CCRGB 0x1
+#define GR_COLORCOMBINE_ITRGB 0x2
+#define GR_COLORCOMBINE_ITRGB_DELTA0 0x3
+#define GR_COLORCOMBINE_DECAL_TEXTURE 0x4
+#define GR_COLORCOMBINE_TEXTURE_TIMES_CCRGB 0x5
+#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB 0x6
+#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_DELTA0 0x7
+#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_ADD_ALPHA 0x8
+#define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA 0x9
+#define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA_ADD_ITRGB 0xa
+#define GR_COLORCOMBINE_TEXTURE_ADD_ITRGB 0xb
+#define GR_COLORCOMBINE_TEXTURE_SUB_ITRGB 0xc
+#define GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA 0xd
+#define GR_COLORCOMBINE_DIFF_SPEC_A 0xe
+#define GR_COLORCOMBINE_DIFF_SPEC_B 0xf
+#define GR_COLORCOMBINE_ONE 0x10
+
+typedef FxI32 GrAlphaBlendFnc_t;
+#define GR_BLEND_ZERO 0x0
+#define GR_BLEND_SRC_ALPHA 0x1
+#define GR_BLEND_SRC_COLOR 0x2
+#define GR_BLEND_DST_COLOR GR_BLEND_SRC_COLOR
+#define GR_BLEND_DST_ALPHA 0x3 
+#define GR_BLEND_ONE 0x4
+#define GR_BLEND_ONE_MINUS_SRC_ALPHA 0x5
+#define GR_BLEND_ONE_MINUS_SRC_COLOR 0x6
+#define GR_BLEND_ONE_MINUS_DST_COLOR GR_BLEND_ONE_MINUS_SRC_COLOR 
+#define GR_BLEND_ONE_MINUS_DST_ALPHA 0x7
+#define GR_BLEND_RESERVED_8 0x8
+#define GR_BLEND_RESERVED_9 0x9
+#define GR_BLEND_RESERVED_A 0xa
+#define GR_BLEND_RESERVED_B 0xb
+#define GR_BLEND_RESERVED_C 0xc
+#define GR_BLEND_RESERVED_D 0xd
+#define GR_BLEND_RESERVED_E 0xe
+#define GR_BLEND_ALPHA_SATURATE 0xf
+#define GR_BLEND_PREFOG_COLOR GR_BLEND_ALPHA_SATURATE
+
+typedef FxI32 GrAspectRatio_t;
+#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
+//#define GLIDE3_DEBUG
+#ifdef GLIDE3_DEBUG
+#define GR_ASPECT_8x1 0x0       /* 8W x 1H */
+#define GR_ASPECT_4x1 0x1       /* 4W x 1H */
+#define GR_ASPECT_2x1 0x2       /* 2W x 1H */
+#define GR_ASPECT_1x1 0x3       /* 1W x 1H */
+#define GR_ASPECT_1x2 0x4       /* 1W x 2H */
+#define GR_ASPECT_1x4 0x5       /* 1W x 4H */
+#define GR_ASPECT_1x8 0x6       /* 1W x 8H */
+#else
+#define GR_ASPECT_8x1   3       /* 8W x 1H */
+#define GR_ASPECT_4x1   2       /* 4W x 1H */
+#define GR_ASPECT_2x1   1       /* 2W x 1H */
+#define GR_ASPECT_1x1   0       /* 1W x 1H */
+#define GR_ASPECT_1x2  -1       /* 1W x 2H */
+#define GR_ASPECT_1x4  -2       /* 1W x 4H */
+#define GR_ASPECT_1x8  -3       /* 1W x 8H */
+#endif /* GLIDE3_DEBUG */
+#else
+#define GR_ASPECT_8x1 0x0       /* 8W x 1H */
+#define GR_ASPECT_4x1 0x1       /* 4W x 1H */
+#define GR_ASPECT_2x1 0x2       /* 2W x 1H */
+#define GR_ASPECT_1x1 0x3       /* 1W x 1H */
+#define GR_ASPECT_1x2 0x4       /* 1W x 2H */
+#define GR_ASPECT_1x4 0x5       /* 1W x 4H */
+#define GR_ASPECT_1x8 0x6       /* 1W x 8H */
+#endif
+
+typedef FxI32 GrBuffer_t;
+#define GR_BUFFER_FRONTBUFFER   0x0
+#define GR_BUFFER_BACKBUFFER    0x1
+#define GR_BUFFER_AUXBUFFER     0x2
+#define GR_BUFFER_DEPTHBUFFER   0x3
+#define GR_BUFFER_ALPHABUFFER   0x4
+#define GR_BUFFER_TRIPLEBUFFER  0x5
+
+typedef FxI32 GrChromakeyMode_t;
+#define GR_CHROMAKEY_DISABLE    0x0
+#define GR_CHROMAKEY_ENABLE     0x1
+
+#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
+typedef FxI32 GrChromaRangeMode_t;
+#define GR_CHROMARANGE_RGB_ANY  0x0
+#define GR_CHROMARANGE_RGb_ANY  0x1
+#define GR_CHROMARANGE_RgB_ANY  0x2
+#define GR_CHROMARANGE_Rgb_ANY  0x3
+#define GR_CHROMARANGE_rGB_ANY  0x4
+#define GR_CHROMARANGE_rGb_ANY  0x5
+#define GR_CHROMARANGE_rgB_ANY  0x6
+#define GR_CHROMARANGE_rgb_ANY  0x7
+#define GR_CHROMARANGE_RGB_ALL  0x8
+#define GR_CHROMARANGE_RGb_ALL  0x9
+#define GR_CHROMARANGE_RgB_ALL  0xa
+#define GR_CHROMARANGE_Rgb_ALL  0xb
+#define GR_CHROMARANGE_rGB_ALL  0xc
+#define GR_CHROMARANGE_rGb_ALL  0xd
+#define GR_CHROMARANGE_rgB_ALL  0xe
+#define GR_CHROMARANGE_rgb_ALL  0xf
+#endif
+
+typedef FxI32 GrCmpFnc_t;
+#define GR_CMP_NEVER    0x0
+#define GR_CMP_LESS     0x1
+#define GR_CMP_EQUAL    0x2
+#define GR_CMP_LEQUAL   0x3
+#define GR_CMP_GREATER  0x4
+#define GR_CMP_NOTEQUAL 0x5
+#define GR_CMP_GEQUAL   0x6
+#define GR_CMP_ALWAYS   0x7
+
+typedef FxI32 GrColorFormat_t;
+#define GR_COLORFORMAT_ARGB     0x0
+#define GR_COLORFORMAT_ABGR     0x1
+
+#define GR_COLORFORMAT_RGBA     0x2
+#define GR_COLORFORMAT_BGRA     0x3
+
+typedef FxI32 GrCullMode_t;
+#define GR_CULL_DISABLE         0x0
+#define GR_CULL_NEGATIVE        0x1
+#define GR_CULL_POSITIVE        0x2
+
+typedef FxI32 GrDepthBufferMode_t;
+#define GR_DEPTHBUFFER_DISABLE                  0x0
+#define GR_DEPTHBUFFER_ZBUFFER                  0x1
+#define GR_DEPTHBUFFER_WBUFFER                  0x2
+#define GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS  0x3
+#define GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS  0x4
+
+typedef FxI32 GrDitherMode_t;
+#define GR_DITHER_DISABLE       0x0
+#define GR_DITHER_2x2           0x1
+#define GR_DITHER_4x4           0x2
+
+typedef FxI32 GrFogMode_t;
+#define GR_FOG_DISABLE             0x0
+#define GR_FOG_WITH_ITERATED_ALPHA 0x1
+#define GR_FOG_WITH_TABLE          0x2
+#define GR_FOG_WITH_ITERATED_Z     0x3          /* Bug 735 */
+#define GR_FOG_MULT2               0x100
+#define GR_FOG_ADD2                0x200
+
+typedef FxU32 GrLock_t;
+#define GR_LFB_READ_ONLY  0x00
+#define GR_LFB_WRITE_ONLY 0x01
+#define GR_LFB_IDLE       0x00
+#define GR_LFB_NOIDLE     0x10
+
+typedef FxI32 GrLfbBypassMode_t;
+#define GR_LFBBYPASS_DISABLE    0x0
+#define GR_LFBBYPASS_ENABLE     0x1
+
+typedef FxI32 GrLfbWriteMode_t;
+#define GR_LFBWRITEMODE_565        0x0 /* RGB:RGB */
+#define GR_LFBWRITEMODE_555        0x1 /* RGB:RGB */
+#define GR_LFBWRITEMODE_1555       0x2 /* ARGB:ARGB */
+#define GR_LFBWRITEMODE_RESERVED1  0x3
+#define GR_LFBWRITEMODE_888        0x4 /* RGB */
+#define GR_LFBWRITEMODE_8888       0x5 /* ARGB */
+#define GR_LFBWRITEMODE_RESERVED2  0x6
+#define GR_LFBWRITEMODE_RESERVED3  0x7
+#define GR_LFBWRITEMODE_RESERVED4  0x8
+#define GR_LFBWRITEMODE_RESERVED5  0x9
+#define GR_LFBWRITEMODE_RESERVED6  0xa
+#define GR_LFBWRITEMODE_RESERVED7  0xb
+#define GR_LFBWRITEMODE_565_DEPTH  0xc /* RGB:DEPTH */
+#define GR_LFBWRITEMODE_555_DEPTH  0xd /* RGB:DEPTH */
+#define GR_LFBWRITEMODE_1555_DEPTH 0xe /* ARGB:DEPTH */
+#define GR_LFBWRITEMODE_ZA16       0xf /* DEPTH:DEPTH */
+#define GR_LFBWRITEMODE_ANY        0xFF
+
+
+typedef FxI32 GrOriginLocation_t;
+#define GR_ORIGIN_UPPER_LEFT    0x0
+#define GR_ORIGIN_LOWER_LEFT    0x1
+#define GR_ORIGIN_ANY           0xFF
+
+typedef struct {
+    int                size;
+    void               *lfbPtr;
+    FxU32              strideInBytes;        
+    GrLfbWriteMode_t   writeMode;
+    GrOriginLocation_t origin;
+} GrLfbInfo_t;
+
+typedef FxI32 GrLOD_t;
+#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
+#ifdef GLIDE3_DEBUG
+#define GR_LOD_256              0x0
+#define GR_LOD_128              0x1
+#define GR_LOD_64               0x2
+#define GR_LOD_32               0x3
+#define GR_LOD_16               0x4
+#define GR_LOD_8                0x5
+#define GR_LOD_4                0x6
+#define GR_LOD_2                0x7
+#define GR_LOD_1                0x8
+#else
+#define GR_LOD_256              0x8
+#define GR_LOD_128              0x7
+#define GR_LOD_64               0x6
+#define GR_LOD_32               0x5
+#define GR_LOD_16               0x4
+#define GR_LOD_8                0x3
+#define GR_LOD_4                0x2
+#define GR_LOD_2                0x1
+#define GR_LOD_1                0x0
+#endif /* GLIDE3_DEBUG */
+#else
+#define GR_LOD_256              0x0
+#define GR_LOD_128              0x1
+#define GR_LOD_64               0x2
+#define GR_LOD_32               0x3
+#define GR_LOD_16               0x4
+#define GR_LOD_8                0x5
+#define GR_LOD_4                0x6
+#define GR_LOD_2                0x7
+#define GR_LOD_1                0x8
+#endif
+
+typedef FxI32 GrMipMapMode_t;
+#define GR_MIPMAP_DISABLE               0x0 /* no mip mapping  */
+#define GR_MIPMAP_NEAREST               0x1 /* use nearest mipmap */
+#define GR_MIPMAP_NEAREST_DITHER        0x2 /* GR_MIPMAP_NEAREST + LOD dith */
+
+
+typedef FxI32 GrSmoothingMode_t;
+#define GR_SMOOTHING_DISABLE    0x0
+#define GR_SMOOTHING_ENABLE     0x1
+
+typedef FxI32 GrTextureClampMode_t;
+#define GR_TEXTURECLAMP_WRAP    0x0
+#define GR_TEXTURECLAMP_CLAMP   0x1
+
+typedef FxI32 GrTextureCombineFnc_t;
+#define GR_TEXTURECOMBINE_ZERO          0x0 /* texout = 0 */
+#define GR_TEXTURECOMBINE_DECAL         0x1 /* texout = texthis */
+#define GR_TEXTURECOMBINE_OTHER         0x2 /* this TMU in passthru mode */
+#define GR_TEXTURECOMBINE_ADD           0x3 /* tout = tthis + t(this+1) */
+#define GR_TEXTURECOMBINE_MULTIPLY      0x4 /* texout = tthis * t(this+1) */
+#define GR_TEXTURECOMBINE_SUBTRACT      0x5 /* Sutract from upstream TMU */
+#define GR_TEXTURECOMBINE_DETAIL        0x6 /* detail--detail on tthis */
+#define GR_TEXTURECOMBINE_DETAIL_OTHER  0x7 /* detail--detail on tthis+1 */
+#define GR_TEXTURECOMBINE_TRILINEAR_ODD 0x8 /* trilinear--odd levels tthis*/
+#define GR_TEXTURECOMBINE_TRILINEAR_EVEN 0x9 /*trilinear--even levels tthis*/
+#define GR_TEXTURECOMBINE_ONE           0xa /* texout = 0xFFFFFFFF */
+
+typedef FxI32 GrTextureFilterMode_t;
+#define GR_TEXTUREFILTER_POINT_SAMPLED  0x0
+#define GR_TEXTUREFILTER_BILINEAR       0x1
+
+typedef FxI32 GrTextureFormat_t;
+#define GR_TEXFMT_8BIT                  0x0
+#define GR_TEXFMT_RGB_332 GR_TEXFMT_8BIT
+#define GR_TEXFMT_YIQ_422               0x1
+#define GR_TEXFMT_ALPHA_8               0x2 /* (0..0xFF) alpha     */
+#define GR_TEXFMT_INTENSITY_8           0x3 /* (0..0xFF) intensity */
+#define GR_TEXFMT_ALPHA_INTENSITY_44    0x4
+#define GR_TEXFMT_P_8                   0x5 /* 8-bit palette */
+#define GR_TEXFMT_RSVD0                 0x6
+#define GR_TEXFMT_RSVD1                 0x7
+#define GR_TEXFMT_16BIT                 0x8
+#define GR_TEXFMT_ARGB_8332 GR_TEXFMT_16BIT
+#define GR_TEXFMT_AYIQ_8422             0x9
+#define GR_TEXFMT_RGB_565               0xa
+#define GR_TEXFMT_ARGB_1555             0xb
+#define GR_TEXFMT_ARGB_4444             0xc
+#define GR_TEXFMT_ALPHA_INTENSITY_88    0xd
+#define GR_TEXFMT_AP_88                 0xe /* 8-bit alpha 8-bit palette */
+#define GR_TEXFMT_RSVD2                 0xf
+
+typedef FxU32 GrTexTable_t;
+#define GR_TEXTABLE_NCC0    0x0
+#define GR_TEXTABLE_NCC1    0x1
+#define GR_TEXTABLE_PALETTE 0x2
+
+typedef FxU32 GrNCCTable_t;
+#define GR_NCCTABLE_NCC0    0x0
+#define GR_NCCTABLE_NCC1    0x1
+
+typedef FxU32 GrTexBaseRange_t;
+#define GR_TEXBASE_256      0x0
+#define GR_TEXBASE_128      0x1
+#define GR_TEXBASE_64       0x2
+#define GR_TEXBASE_32_TO_1  0x3
+
+#ifdef GLIDE3
+
+#define GLIDE3_VERTEX_LAYOUT 1
+
+typedef FxU32 GrEnableMode_t;
+#define GR_MODE_DISABLE     0x0
+#define GR_MODE_ENABLE      0x1
+
+#define GR_AA_ORDERED            0x01
+#define GR_ALLOW_MIPMAP_DITHER   0x02
+#define GR_SHAMELESS_PLUG        0x03
+#define GR_VIDEO_SMOOTHING       0x04
+
+typedef FxU32 GrCoordinateSpaceMode_t;
+#define GR_WINDOW_COORDS    0x00
+#define GR_CLIP_COORDS      0x01
+
+#endif
+
+#ifdef GLIDE3
+#ifdef GLIDE3_ALPHA
+#define GLIDE3_EXTRA_STATE      392
+#else
+#define GLIDE3_EXTRA_STATE      216
+#endif
+#else
+#define GLIDE3_EXTRA_STATE      0
+#endif
+
+#define GLIDE_STATE_PAD_SIZE 312 + GLIDE3_EXTRA_STATE 
+
+#ifdef GLIDE_LIB
+typedef struct _GrState_s GrState;
+#else
+typedef struct _GrState_s {
+  char pad[GLIDE_STATE_PAD_SIZE];
+} GrState;
+#endif
+
+#ifdef GLIDE3
+/* Types of data in strips */
+#define GR_FLOAT        0
+#define GR_U8           1
+
+/* Parameters for strips */
+#define GR_PARAM_XY       0x01
+#define GR_PARAM_Z        0x02
+#define GR_PARAM_W        0x03
+#define GR_PARAM_Q        0x04
+
+#define GR_PARAM_A        0x10
+#define GR_PARAM_A0       GR_PARAM_A
+#define GR_PARAM_A1       GR_PARAM_A+1
+#define GR_PARAM_A2       GR_PARAM_A+2
+#define GR_PARAM_A3       GR_PARAM_A+3
+#define GR_PARAM_A4       GR_PARAM_A+4
+#define GR_PARAM_A5       GR_PARAM_A+5
+#define GR_PARAM_A6       GR_PARAM_A+6
+#define GR_PARAM_A7       GR_PARAM_A+7
+
+#define GR_PARAM_RGB      0x20
+#define GR_PARAM_RGB0     GR_PARAM_RGB
+#define GR_PARAM_RGB1     GR_PARAM_RGB+1
+#define GR_PARAM_RGB2     GR_PARAM_RGB+2
+#define GR_PARAM_RGB3     GR_PARAM_RGB+3
+#define GR_PARAM_RGB4     GR_PARAM_RGB+4
+#define GR_PARAM_RGB5     GR_PARAM_RGB+5
+#define GR_PARAM_RGB6     GR_PARAM_RGB+6
+#define GR_PARAM_RGB7     GR_PARAM_RGB+7
+
+#define GR_PARAM_PARGB    0x30
+#define GR_PARAM_PARGB0   GR_PARAM_PARGB
+#define GR_PARAM_PARGB1   GR_PARAM_PARGB+1
+#define GR_PARAM_PARGB2   GR_PARAM_PARGB+2
+#define GR_PARAM_PARGB3   GR_PARAM_PARGB+3
+#define GR_PARAM_PARGB4   GR_PARAM_PARGB+4
+#define GR_PARAM_PARGB5   GR_PARAM_PARGB+5
+#define GR_PARAM_PARGB6   GR_PARAM_PARGB+6
+#define GR_PARAM_PARGB7   GR_PARAM_PARGB+7
+
+#define GR_PARAM_ST0      0x40
+#define GR_PARAM_ST1      GR_PARAM_ST0+1
+#define GR_PARAM_ST2      GR_PARAM_ST0+2
+#define GR_PARAM_ST3      GR_PARAM_ST0+3
+#define GR_PARAM_ST4      GR_PARAM_ST0+4
+#define GR_PARAM_ST5      GR_PARAM_ST0+5
+#define GR_PARAM_ST6      GR_PARAM_ST0+6
+#define GR_PARAM_ST7      GR_PARAM_ST0+7
+
+#define GR_PARAM_Q0       0x50
+#define GR_PARAM_Q1       GR_PARAM_Q0+1
+#define GR_PARAM_Q2       GR_PARAM_Q0+2
+#define GR_PARAM_Q3       GR_PARAM_Q0+3
+#define GR_PARAM_Q4       GR_PARAM_Q0+4
+#define GR_PARAM_Q5       GR_PARAM_Q0+5
+#define GR_PARAM_Q6       GR_PARAM_Q0+6
+#define GR_PARAM_Q7       GR_PARAM_Q0+7
+
+#define GR_PARAM_DISABLE  0x00
+#define GR_PARAM_ENABLE   0x01
+
+/* Componenets for strips */
+/* vertex */
+#define GR_VERTEX_XYZ   3
+#define GR_VERTEX_XYZW  4
+/* Color */
+#define GR_COLOR_RGB    3
+#define GR_COLOR_RGBA   4
+/* Texture */
+#define GR_TEX_NONE     0
+#define GR_TEX_ST       2
+#define GR_TEX_STW      3
+
+/* grDrawVertexArray primitive type */
+#define GR_POINTS               0
+#define GR_LINE_STRIP           1
+#define GR_LINES                2
+#define GR_POLYGON              3
+#define GR_TRIANGLE_STRIP       4
+#define GR_TRIANGLE_FAN         5
+#define GR_TRIANGLES            6
+
+
+/* Stuff for grGet/grReset */
+#define GR_BITS_DEPTH                   0x01
+#define GR_BITS_RGBA                    0x02
+#define GR_FIFO_FULLNESS                0x03
+#define GR_FOG_TABLE_ENTRIES            0x04
+#define GR_GAMMA_TABLE_ENTRIES          0x05
+#define GR_IS_BUSY                      0x06
+#define GR_LFB_PIXEL_PIPE               0x07
+#define GR_MAX_TEXTURE_SIZE             0x08
+#define GR_MAX_TEXTURE_ASPECT_RATIO     0x09
+#define GR_MEMORY_FB                    0x0a
+#define GR_MEMORY_TMU                   0x0b
+#define GR_MEMORY_UMA                   0x0c
+#define GR_NUM_BOARDS                   0x0d
+#define GR_NUM_POWER_OF_TWO_TEXTURES    0x0e
+#define GR_NUM_FB                       0x0f
+#define GR_NUM_TMU                      0x10
+#define GR_PENDING_BUFFERSWAPS          0x11
+#define GR_REVISION_FB                  0x12
+#define GR_REVISION_TMU                 0x13
+#define GR_STATS_LINES                  0x14  /* grSet/grReset */
+#define GR_STATS_PIXELS_AFUNC_FAIL      0x15
+#define GR_STATS_PIXELS_CHROMA_FAIL     0x16
+#define GR_STATS_PIXELS_DEPTHFUNC_FAIL  0x17
+#define GR_STATS_PIXELS_IN              0x18
+#define GR_STATS_PIXELS_OUT             0x19
+#define GR_STATS_PIXELS                 0x1a  /* grReset */
+#define GR_STATS_POINTS                 0x1b  /* grSet/grReset */
+#define GR_STATS_TRIANGLES_IN           0x1c
+#define GR_STATS_TRIANGLES_OUT          0x1d
+#define GR_STATS_TRIANGLES              0x1e  /* grReset */
+#define GR_SWAP_HISTORY                 0x1f
+#define GR_TEXTURE_ALIGN                0x20
+#define GR_VIDEO_POSITION               0x21
+#define GR_VIEWPORT                     0x22
+#define GR_WDEPTH_MIN_MAX               0x23
+#define GR_ZDEPTH_MIN_MAX               0x24
+
+/* stuff for grGetString */
+#define GR_EXTENSION                    0xa0
+#define GR_HARDWARE                     0xa1
+#define GR_RENDERER                     0xa2
+#define GR_VENDOR                       0xa3
+#define GR_VERSION                      0xa4
+
+#endif
+
+/*
+** -----------------------------------------------------------------------
+** STRUCTURES
+** -----------------------------------------------------------------------
+*/
+
+#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
+#ifdef GLIDE3_DEBUG
+typedef struct {
+    GrLOD_t           smallLod;
+    GrLOD_t           largeLod;
+    GrAspectRatio_t   aspectRatio;
+    GrTextureFormat_t format;
+    void              *data;
+} GrTexInfo;
+#else
+typedef struct {
+    GrLOD_t           smallLodLog2;
+    GrLOD_t           largeLodLog2;
+    GrAspectRatio_t   aspectRatioLog2;
+    GrTextureFormat_t format;
+    void              *data;
+} GrTexInfo;
+#endif /* GLIDE3_DEBUG */
+#else
+typedef struct {
+    GrLOD_t           smallLod;
+    GrLOD_t           largeLod;
+    GrAspectRatio_t   aspectRatio;
+    GrTextureFormat_t format;
+    void              *data;
+} GrTexInfo;
+#endif
+
+#ifndef GLIDE3_ALPHA
+/*
+** 3DF texture file structs
+*/
+
+typedef struct
+{
+  FxU32               width, height;
+  int                 small_lod, large_lod;
+  GrAspectRatio_t     aspect_ratio;
+  GrTextureFormat_t   format;
+} Gu3dfHeader;
+
+typedef struct
+{
+  FxU8  yRGB[16];
+  FxI16 iRGB[4][3];
+  FxI16 qRGB[4][3];
+  FxU32 packed_data[12];
+} GuNccTable;
+
+typedef struct {
+    FxU32 data[256];
+} GuTexPalette;
+
+typedef union {
+    GuNccTable   nccTable;
+    GuTexPalette palette;
+} GuTexTable;
+
+typedef struct
+{
+  Gu3dfHeader  header;
+  GuTexTable   table;
+  void        *data;
+  FxU32        mem_required;    /* memory required for mip map in bytes. */
+} Gu3dfInfo;
+
+typedef struct
+{
+  int           sst;                    /* SST where this texture map was stored  */
+  FxBool        valid;                  /* set when this table entry is allocated*/
+  int           width, height;
+  GrAspectRatio_t aspect_ratio;         /* aspect ratio of the mip map.  */
+  void          *data;                  /* actual texture data  */
+
+  GrTextureFormat_t  format;                    /* format of the texture table */
+  GrMipMapMode_t     mipmap_mode;               /* mip map mode for this texture */
+  GrTextureFilterMode_t   magfilter_mode;       /* filtering to be used when magnified */
+  GrTextureFilterMode_t   minfilter_mode;       /* filtering to be used with minified  */
+  GrTextureClampMode_t    s_clamp_mode;         /* how this texture should be clamped in s */
+  GrTextureClampMode_t    t_clamp_mode;         /* how this texture should be clamped in t */
+  FxU32         tLOD;                   /* Register value for tLOD register */ 
+  FxU32         tTextureMode;           /* Register value for tTextureMode register
+                                           not including non-texture specific bits */
+  FxU32         lod_bias;               /* LOD bias of the mip map in preshifted 4.2*/
+  GrLOD_t       lod_min, lod_max;       /* largest and smallest levels of detail  */
+  int           tmu;                    /* tmu on which this texture resides */
+  FxU32         odd_even_mask;          /* mask specifying levels on this tmu  */
+  FxU32         tmu_base_address;       /* base addr (in TMU mem) of this texture */
+  FxBool        trilinear;              /* should we blend by lod? */
+
+  GuNccTable    ncc_table;              /* NCC compression table (optional) */
+} GrMipMapInfo;
+#endif
+
+typedef int GrSstType;
+#define GR_SSTTYPE_VOODOO    0
+#define GR_SSTTYPE_SST96     1
+#define GR_SSTTYPE_AT3D      2
+#define GR_SSTTYPE_Voodoo2   3
+
+typedef struct GrTMUConfig_St {
+  int    tmuRev;                /* Rev of Texelfx chip */
+  int    tmuRam;                /* 1, 2, or 4 MB */
+} GrTMUConfig_t;
+
+typedef struct GrVoodooConfig_St {
+  int    fbRam;                         /* 1, 2, or 4 MB */
+  int    fbiRev;                        /* Rev of Pixelfx chip */
+  int    nTexelfx;                      /* How many texelFX chips are there? */
+  FxBool sliDetect;                     /* Is it a scan-line interleaved board? */
+  GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU];   /* Configuration of the Texelfx chips */
+} GrVoodooConfig_t;
+
+typedef struct GrSst96Config_St {
+  int   fbRam;                  /* How much? */
+  int   nTexelfx;
+  GrTMUConfig_t tmuConfig;
+} GrSst96Config_t;
+
+typedef GrVoodooConfig_t GrVoodoo2Config_t;
+
+typedef struct GrAT3DConfig_St {
+  int   rev;
+} GrAT3DConfig_t;
+
+typedef struct {
+  int num_sst;                  /* # of HW units in the system */
+  struct {
+    GrSstType type;             /* Which hardware is it? */
+    union SstBoard_u {
+      GrVoodooConfig_t  VoodooConfig;
+      GrSst96Config_t   SST96Config;
+      GrAT3DConfig_t    AT3DConfig;
+      GrVoodoo2Config_t Voodoo2Config;
+    } sstBoard;
+  } SSTs[MAX_NUM_SST];          /* configuration for each board */
+} GrHwConfiguration;
+
+typedef struct GrSstPerfStats_s {
+  FxU32  pixelsIn;              /* # pixels processed (minus buffer clears) */
+  FxU32  chromaFail;            /* # pixels not drawn due to chroma key */ 
+  FxU32  zFuncFail;             /* # pixels not drawn due to Z comparison */
+  FxU32  aFuncFail;             /* # pixels not drawn due to alpha comparison */
+  FxU32  pixelsOut;             /* # pixels drawn (including buffer clears) */
+} GrSstPerfStats_t;
+
+
+typedef struct {
+  float  sow;                   /* s texture ordinate (s over w) */
+  float  tow;                   /* t texture ordinate (t over w) */  
+  float  oow;                   /* 1/w (used mipmapping - really 0xfff/w) */
+}  GrTmuVertex;
+
+/*
+** GrVertex
+** If these are changed the C & assembly language trisetup routines MUST
+** be changed, for they will no longer work.
+*/
+#if !GLIDE3_VERTEX_LAYOUT
+typedef struct
+{
+  float x, y, z;                /* X, Y, and Z of scrn space -- Z is ignored */
+  float r, g, b;                /* R, G, B, ([0..255.0]) */
+  float ooz;                    /* 65535/Z (used for Z-buffering) */
+  float a;                      /* Alpha [0..255.0] */
+  float oow;                    /* 1/W (used for W-buffering, texturing) */
+  GrTmuVertex  tmuvtx[GLIDE_NUM_TMU];
+} GrVertex;
+
+#define GR_VERTEX_X_OFFSET              0
+#define GR_VERTEX_Y_OFFSET              1
+#define GR_VERTEX_Z_OFFSET              2
+#define GR_VERTEX_R_OFFSET              3
+#define GR_VERTEX_G_OFFSET              4
+#define GR_VERTEX_B_OFFSET              5
+#define GR_VERTEX_OOZ_OFFSET            6
+#define GR_VERTEX_A_OFFSET              7
+#define GR_VERTEX_OOW_OFFSET            8
+
+#else /* GLIDE3_VERTEX_LAYOUT */
+typedef struct
+{
+  float x, y;         /* X and Y in screen space */
+  float ooz;          /* 65535/Z (used for Z-buffering) */
+  float oow;          /* 1/W (used for W-buffering, texturing) */
+  float r, g, b, a;   /* R, G, B, A [0..255.0] */
+  float z;            /* Z is ignored */
+  GrTmuVertex  tmuvtx[GLIDE_NUM_TMU];
+} GrVertex;
+
+#define GR_VERTEX_X_OFFSET              0
+#define GR_VERTEX_Y_OFFSET              1
+#define GR_VERTEX_OOZ_OFFSET            2
+#define GR_VERTEX_OOW_OFFSET            3
+#define GR_VERTEX_R_OFFSET              4
+#define GR_VERTEX_G_OFFSET              5
+#define GR_VERTEX_B_OFFSET              6
+#define GR_VERTEX_A_OFFSET              7
+#define GR_VERTEX_Z_OFFSET              8
+
+#endif /* GLIDE3_VERTEX_LAYOUT */
+
+#define GR_VERTEX_SOW_TMU0_OFFSET       9
+#define GR_VERTEX_TOW_TMU0_OFFSET       10
+#define GR_VERTEX_OOW_TMU0_OFFSET       11
+#define GR_VERTEX_SOW_TMU1_OFFSET       12
+#define GR_VERTEX_TOW_TMU1_OFFSET       13
+#define GR_VERTEX_OOW_TMU1_OFFSET       14
+
+#if (GLIDE_NUM_TMU > 2)
+#define GR_VERTEX_SOW_TMU2_OFFSET       15
+#define GR_VERTEX_TOW_TMU2_OFFSET       16
+#define GR_VERTEX_OOW_TMU2_OFFSET       17
+#endif
+
+typedef FxU32 GrLfbSrcFmt_t;
+#define GR_LFB_SRC_FMT_565          0x00
+#define GR_LFB_SRC_FMT_555          0x01
+#define GR_LFB_SRC_FMT_1555         0x02
+#define GR_LFB_SRC_FMT_888          0x04
+#define GR_LFB_SRC_FMT_8888         0x05
+#define GR_LFB_SRC_FMT_565_DEPTH    0x0c
+#define GR_LFB_SRC_FMT_555_DEPTH    0x0d
+#define GR_LFB_SRC_FMT_1555_DEPTH   0x0e
+#define GR_LFB_SRC_FMT_ZA16         0x0f
+#define GR_LFB_SRC_FMT_RLE16        0x80
+
+typedef FxI32 GrPassthruMode_t;
+#define GR_PASSTHRU_SHOW_VGA    0x0
+#define GR_PASSTHRU_SHOW_SST1   0x1
+
+typedef FxU32 GrHint_t;
+#define GR_HINTTYPE_MIN                 0
+#define GR_HINT_STWHINT                 0
+#define GR_HINT_FIFOCHECKHINT           1
+#define GR_HINT_FPUPRECISION            2
+#define GR_HINT_ALLOW_MIPMAP_DITHER     3
+#define GR_HINT_LFB_WRITE               4
+#define GR_HINT_LFB_PROTECT             5
+#define GR_HINT_LFB_RESET               6
+#define GR_HINTTYPE_MAX                 GR_HINT_LFB_RESET
+#ifdef H3D
+#define GR_HINT_H3DENABLE               GR_HINTTYPE_MAX
+#undef  GR_HINTTYPE_MAX
+#define GR_HINTTYPE_MAX                 GR_HIT_H3DENABLE
+#endif
+
+typedef FxU32 GrSTWHint_t;
+#define GR_STWHINT_W_DIFF_FBI   FXBIT(0)
+#define GR_STWHINT_W_DIFF_TMU0  FXBIT(1)
+#define GR_STWHINT_ST_DIFF_TMU0 FXBIT(2)
+#define GR_STWHINT_W_DIFF_TMU1  FXBIT(3)
+#define GR_STWHINT_ST_DIFF_TMU1 FXBIT(4)
+#define GR_STWHINT_W_DIFF_TMU2  FXBIT(5)
+#define GR_STWHINT_ST_DIFF_TMU2 FXBIT(6)
+
+typedef FxU32 GrControl_t;
+#define GR_CONTROL_ACTIVATE   0x1
+#define GR_CONTROL_DEACTIVATE 0x2
+#define GR_CONTROL_RESIZE     0x3
+#define GR_CONTROL_MOVE       0x4
+
+#define GR_GENERATE_FIFOCHECK_HINT_MASK(swHWM, swLWM) \
+  (((swHWM & 0xffff) << 16) | (swLWM & 0xffff))
+
+/*
+** -----------------------------------------------------------------------
+** FUNCTION PROTOTYPES
+** -----------------------------------------------------------------------
+*/
+#ifndef FX_GLIDE_NO_FUNC_PROTO
+/*
+** rendering functions
+*/
+
+#ifndef GLIDE3_ALPHA
+
+FX_ENTRY void FX_CALL
+grDrawPlanarPolygon( int nverts, const int ilist[], const GrVertex vlist[] );
+
+FX_ENTRY void FX_CALL
+grDrawPlanarPolygonVertexList( int nverts, const GrVertex vlist[] );
+
+FX_ENTRY void FX_CALL
+grDrawPolygon( int nverts, const int ilist[], const GrVertex vlist[] );
+
+FX_ENTRY void FX_CALL
+grDrawPolygonVertexList( int nverts, const GrVertex vlist[] );
+
+#endif /* !GLIDE3_ALPHA */
+
+#ifdef GLIDE3
+FX_ENTRY void FX_CALL
+grDrawPoint( void *pt );
+
+FX_ENTRY void FX_CALL
+grDrawLine( void *v1, void *v2 );
+
+FX_ENTRY void FX_CALL
+grDrawTriangle( void *a, void *b, void *c );
+
+#else
+FX_ENTRY void FX_CALL
+grDrawPoint( const GrVertex *pt );
+
+FX_ENTRY void FX_CALL
+grDrawLine( const GrVertex *v1, const GrVertex *v2 );
+
+FX_ENTRY void FX_CALL
+grDrawTriangle( const GrVertex *a, const GrVertex *b, const GrVertex *c );
+#endif
+
+/*
+** buffer management
+*/
+FX_ENTRY void FX_CALL
+grBufferClear( GrColor_t color, GrAlpha_t alpha, FxU16 depth );
+
+#ifndef GLIDE3_ALPHA
+FX_ENTRY int FX_CALL
+grBufferNumPending( void );
+#endif /* !GLIDE3_ALPHA */
+
+FX_ENTRY void FX_CALL
+grBufferSwap( int swap_interval );
+
+FX_ENTRY void FX_CALL
+grRenderBuffer( GrBuffer_t buffer );
+
+/*
+** error management
+*/
+typedef void (*GrErrorCallbackFnc_t)( const char *string, FxBool fatal );
+
+FX_ENTRY void FX_CALL 
+grErrorSetCallback( GrErrorCallbackFnc_t fnc );
+
+/*
+** SST routines
+*/
+#ifdef GLIDE3
+FX_ENTRY void FX_CALL 
+grFinish(void);
+#endif
+
+#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
+FX_ENTRY void FX_CALL 
+grFlush(void);
+#endif
+
+#ifndef GLIDE3_ALPHA
+FX_ENTRY void FX_CALL 
+grSstIdle(void);
+
+FX_ENTRY FxU32 FX_CALL 
+grSstVideoLine( void );
+
+FX_ENTRY FxBool FX_CALL 
+grSstVRetraceOn( void );
+
+FX_ENTRY FxBool FX_CALL 
+grSstIsBusy( void );
+#endif /* !GLIDE3_ALPHA */
+
+FX_ENTRY FxBool FX_CALL 
+grSstWinOpen(
+          FxU32                hWnd,
+          GrScreenResolution_t screen_resolution,
+          GrScreenRefresh_t    refresh_rate,
+          GrColorFormat_t      color_format,
+          GrOriginLocation_t   origin_location,
+          int                  nColBuffers,
+          int                  nAuxBuffers);
+
+FX_ENTRY void FX_CALL
+grSstWinClose( void );
+
+FX_ENTRY FxBool FX_CALL
+grSstControl( FxU32 code );
+
+#ifndef GLIDE3_ALPHA
+FX_ENTRY FxBool FX_CALL 
+grSstQueryHardware( GrHwConfiguration *hwconfig );
+
+FX_ENTRY FxBool FX_CALL 
+grSstQueryBoards( GrHwConfiguration *hwconfig );
+#endif /* !GLIDE3_ALPHA */
+
+FX_ENTRY void FX_CALL
+grSstOrigin(GrOriginLocation_t  origin);
+
+FX_ENTRY void FX_CALL 
+grSstSelect( int which_sst );
+
+#ifndef GLIDE3_ALPHA
+FX_ENTRY FxU32 FX_CALL 
+grSstScreenHeight( void );
+
+FX_ENTRY FxU32 FX_CALL 
+grSstScreenWidth( void );
+
+FX_ENTRY FxU32 FX_CALL 
+grSstStatus( void );
+#endif /* !GLIDE3_ALPHA */
+
+/*
+**  Drawing Statistics
+*/
+#ifndef GLIDE3_ALPHA
+FX_ENTRY void FX_CALL
+grSstPerfStats(GrSstPerfStats_t *pStats);
+
+FX_ENTRY void FX_CALL
+grSstResetPerfStats(void);
+#endif /* !GLIDE3_ALPHA */
+
+FX_ENTRY void FX_CALL
+grResetTriStats();
+
+FX_ENTRY void FX_CALL
+grTriStats(FxU32 *trisProcessed, FxU32 *trisDrawn);
+
+/*
+** Glide configuration and special effect maintenance functions
+*/
+FX_ENTRY void FX_CALL
+grAlphaBlendFunction(
+                     GrAlphaBlendFnc_t rgb_sf,   GrAlphaBlendFnc_t rgb_df,
+                     GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df
+                     );
+
+FX_ENTRY void FX_CALL
+grAlphaCombine(
+               GrCombineFunction_t function, GrCombineFactor_t factor,
+               GrCombineLocal_t local, GrCombineOther_t other,
+               FxBool invert
+               );
+
+FX_ENTRY void FX_CALL
+grAlphaControlsITRGBLighting( FxBool enable );
+
+FX_ENTRY void FX_CALL
+grAlphaTestFunction( GrCmpFnc_t function );
+
+FX_ENTRY void FX_CALL
+grAlphaTestReferenceValue( GrAlpha_t value );
+
+FX_ENTRY void FX_CALL 
+grChromakeyMode( GrChromakeyMode_t mode );
+
+FX_ENTRY void FX_CALL 
+grChromakeyValue( GrColor_t value );
+
+FX_ENTRY void FX_CALL 
+grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy );
+
+FX_ENTRY void FX_CALL 
+grColorCombine(
+               GrCombineFunction_t function, GrCombineFactor_t factor,
+               GrCombineLocal_t local, GrCombineOther_t other,
+               FxBool invert );
+
+FX_ENTRY void FX_CALL
+grColorMask( FxBool rgb, FxBool a );
+
+FX_ENTRY void FX_CALL 
+grCullMode( GrCullMode_t mode );
+
+FX_ENTRY void FX_CALL 
+grConstantColorValue( GrColor_t value );
+
+FX_ENTRY void FX_CALL 
+grConstantColorValue4( float a, float r, float g, float b );
+
+FX_ENTRY void FX_CALL 
+grDepthBiasLevel( FxI16 level );
+
+FX_ENTRY void FX_CALL 
+grDepthBufferFunction( GrCmpFnc_t function );
+
+FX_ENTRY void FX_CALL 
+grDepthBufferMode( GrDepthBufferMode_t mode );
+
+FX_ENTRY void FX_CALL 
+grDepthMask( FxBool mask );
+
+FX_ENTRY void FX_CALL 
+grDisableAllEffects( void );
+
+FX_ENTRY void FX_CALL 
+grDitherMode( GrDitherMode_t mode );
+
+FX_ENTRY void FX_CALL 
+grFogColorValue( GrColor_t fogcolor );
+
+FX_ENTRY void FX_CALL 
+grFogMode( GrFogMode_t mode );
+
+FX_ENTRY void FX_CALL 
+grFogTable( const GrFog_t ft[] );
+
+FX_ENTRY void FX_CALL 
+grGammaCorrectionValue( float value );
+
+#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
+FX_ENTRY void FX_CALL 
+grLoadGammaTable( FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
+#endif
+
+FX_ENTRY void FX_CALL
+grSplash(float x, float y, float width, float height, FxU32 frame);
+
+#ifdef GLIDE3
+FX_ENTRY FxBool FX_CALL 
+grGet( FxU32 pname, FxU32 plength, FxI32 *params );
+
+FX_ENTRY const char * FX_CALL 
+grGetString( FxU32 pname );
+
+FX_ENTRY FxBool FX_CALL 
+grReset( FxU32 what );
+
+FX_ENTRY GrProc FX_CALL
+grGetProcAddress( char *procName );
+
+FX_ENTRY void FX_CALL 
+grEnable( GrEnableMode_t mode );
+
+FX_ENTRY void FX_CALL 
+grDisable( GrEnableMode_t mode );
+
+FX_ENTRY void FX_CALL 
+grCoordinateSpace( GrCoordinateSpaceMode_t mode );
+
+FX_ENTRY void FX_CALL 
+grDepthRange( FxFloat n, FxFloat f );
+
+FX_ENTRY void FX_CALL 
+grViewport( FxI32 x, FxI32 y, FxI32 width, FxI32 height );
+
+#endif
+/*
+** texture mapping control functions
+*/
+FX_ENTRY FxU32 FX_CALL 
+grTexCalcMemRequired(
+                     GrLOD_t lodmin, GrLOD_t lodmax,
+                     GrAspectRatio_t aspect, GrTextureFormat_t fmt);
+
+FX_ENTRY FxU32 FX_CALL 
+grTexTextureMemRequired( FxU32     evenOdd,
+                                 GrTexInfo *info   );
+
+FX_ENTRY FxU32 FX_CALL 
+grTexMinAddress( GrChipID_t tmu );
+
+
+FX_ENTRY FxU32 FX_CALL 
+grTexMaxAddress( GrChipID_t tmu );
+
+
+#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
+FX_ENTRY void FX_CALL 
+grTexNCCTable( GrNCCTable_t table );
+#else
+FX_ENTRY void FX_CALL 
+grTexNCCTable( GrChipID_t tmu, GrNCCTable_t table );
+#endif
+
+FX_ENTRY void FX_CALL 
+grTexSource( GrChipID_t tmu,
+             FxU32      startAddress,
+             FxU32      evenOdd,
+             GrTexInfo  *info );
+
+FX_ENTRY void FX_CALL 
+grTexClampMode(
+               GrChipID_t tmu,
+               GrTextureClampMode_t s_clampmode,
+               GrTextureClampMode_t t_clampmode
+               );
+
+FX_ENTRY void FX_CALL 
+grTexCombine(
+             GrChipID_t tmu,
+             GrCombineFunction_t rgb_function,
+             GrCombineFactor_t rgb_factor, 
+             GrCombineFunction_t alpha_function,
+             GrCombineFactor_t alpha_factor,
+             FxBool rgb_invert,
+             FxBool alpha_invert
+             );
+
+#ifndef GLIDE3_ALPHA
+FX_ENTRY void FX_CALL 
+grTexCombineFunction(
+                     GrChipID_t tmu,
+                     GrTextureCombineFnc_t fnc
+                     );
+#endif
+
+FX_ENTRY void FX_CALL 
+grTexDetailControl(
+                   GrChipID_t tmu,
+                   int lod_bias,
+                   FxU8 detail_scale,
+                   float detail_max
+                   );
+
+FX_ENTRY void FX_CALL 
+grTexFilterMode(
+                GrChipID_t tmu,
+                GrTextureFilterMode_t minfilter_mode,
+                GrTextureFilterMode_t magfilter_mode
+                );
+
+
+FX_ENTRY void FX_CALL 
+grTexLodBiasValue(GrChipID_t tmu, float bias );
+
+FX_ENTRY void FX_CALL 
+grTexDownloadMipMap( GrChipID_t tmu,
+                     FxU32      startAddress,
+                     FxU32      evenOdd,
+                     GrTexInfo  *info );
+
+FX_ENTRY void FX_CALL 
+grTexDownloadMipMapLevel( GrChipID_t        tmu,
+                          FxU32             startAddress,
+                          GrLOD_t           thisLod,
+                          GrLOD_t           largeLod,
+                          GrAspectRatio_t   aspectRatio,
+                          GrTextureFormat_t format,
+                          FxU32             evenOdd,
+                          void              *data );
+
+FX_ENTRY void FX_CALL 
+grTexDownloadMipMapLevelPartial( GrChipID_t        tmu,
+                                 FxU32             startAddress,
+                                 GrLOD_t           thisLod,
+                                 GrLOD_t           largeLod,
+                                 GrAspectRatio_t   aspectRatio,
+                                 GrTextureFormat_t format,
+                                 FxU32             evenOdd,
+                                 void              *data,
+                                 int               start,
+                                 int               end );
+
+
+FX_ENTRY void FX_CALL 
+ConvertAndDownloadRle( GrChipID_t        tmu,
+                        FxU32             startAddress,
+                        GrLOD_t           thisLod,
+                        GrLOD_t           largeLod,
+                        GrAspectRatio_t   aspectRatio,
+                        GrTextureFormat_t format,
+                        FxU32             evenOdd,
+                        FxU8              *bm_data,
+                        long              bm_h,
+                        FxU32             u0,
+                        FxU32             v0,
+                        FxU32             width,
+                        FxU32             height,
+                        FxU32             dest_width,
+                        FxU32             dest_height,
+                        FxU16             *tlut);
+
+FX_ENTRY void FX_CALL 
+grCheckForRoom(FxI32 n);
+
+#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
+FX_ENTRY void FX_CALL
+grTexDownloadTable( GrTexTable_t type, 
+                    void         *data );
+
+FX_ENTRY void FX_CALL
+grTexDownloadTablePartial( GrTexTable_t type, 
+                           void         *data,
+                           int          start,
+                           int          end );
+#else
+FX_ENTRY void FX_CALL
+grTexDownloadTable( GrChipID_t   tmu,
+                    GrTexTable_t type, 
+                    void         *data );
+
+FX_ENTRY void FX_CALL
+grTexDownloadTablePartial( GrChipID_t   tmu,
+                           GrTexTable_t type, 
+                           void         *data,
+                           int          start,
+                           int          end );
+#endif
+
+FX_ENTRY void FX_CALL 
+grTexMipMapMode( GrChipID_t     tmu, 
+                 GrMipMapMode_t mode,
+                 FxBool         lodBlend );
+
+FX_ENTRY void FX_CALL 
+grTexMultibase( GrChipID_t tmu,
+                FxBool     enable );
+
+FX_ENTRY void FX_CALL
+grTexMultibaseAddress( GrChipID_t       tmu,
+                       GrTexBaseRange_t range,
+                       FxU32            startAddress,
+                       FxU32            evenOdd,
+                       GrTexInfo        *info );
+
+/*
+** utility texture functions
+*/
+
+#ifndef GLIDE3_ALPHA
+FX_ENTRY GrMipMapId_t FX_CALL 
+guTexAllocateMemory(
+                    GrChipID_t tmu,
+                    FxU8 odd_even_mask,
+                    int width, int height,
+                    GrTextureFormat_t fmt,
+                    GrMipMapMode_t mm_mode,
+                    GrLOD_t smallest_lod, GrLOD_t largest_lod,
+                    GrAspectRatio_t aspect,
+                    GrTextureClampMode_t s_clamp_mode,
+                    GrTextureClampMode_t t_clamp_mode,
+                    GrTextureFilterMode_t minfilter_mode,
+                    GrTextureFilterMode_t magfilter_mode,
+                    float lod_bias,
+                    FxBool trilinear
+                    );
+
+FX_ENTRY FxBool FX_CALL 
+guTexChangeAttributes(
+                      GrMipMapId_t mmid,
+                      int width, int height,
+                      GrTextureFormat_t fmt,
+                      GrMipMapMode_t mm_mode,
+                      GrLOD_t smallest_lod, GrLOD_t largest_lod,
+                      GrAspectRatio_t aspect,
+                      GrTextureClampMode_t s_clamp_mode,
+                      GrTextureClampMode_t t_clamp_mode,
+                      GrTextureFilterMode_t minFilterMode,
+                      GrTextureFilterMode_t magFilterMode
+                      );
+
+FX_ENTRY void FX_CALL 
+guTexCombineFunction(
+                     GrChipID_t tmu,
+                     GrTextureCombineFnc_t fnc
+                     );
+
+FX_ENTRY GrMipMapId_t FX_CALL 
+guTexGetCurrentMipMap( GrChipID_t tmu );
+
+FX_ENTRY GrMipMapInfo * FX_CALL 
+guTexGetMipMapInfo( GrMipMapId_t mmid );
+
+FX_ENTRY FxU32 FX_CALL 
+guTexMemQueryAvail( GrChipID_t tmu );
+
+FX_ENTRY void FX_CALL 
+guTexMemReset( void );
+
+FX_ENTRY void FX_CALL 
+guTexDownloadMipMap(
+                    GrMipMapId_t mmid,
+                    const void *src,
+                    const GuNccTable *table
+                    );
+
+FX_ENTRY void FX_CALL 
+guTexDownloadMipMapLevel(
+                         GrMipMapId_t mmid,
+                         GrLOD_t lod,
+                         const void **src
+                         );
+FX_ENTRY void FX_CALL 
+guTexSource( GrMipMapId_t id );
+#endif /* !GLIDE3_ALPHA */
+
+/*
+** linear frame buffer functions
+*/
+
+FX_ENTRY FxBool FX_CALL
+grLfbLock( GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode,
+           GrOriginLocation_t origin, FxBool pixelPipeline, 
+           GrLfbInfo_t *info );
+
+FX_ENTRY FxBool FX_CALL
+grLfbUnlock( GrLock_t type, GrBuffer_t buffer );
+
+FX_ENTRY void FX_CALL 
+grLfbConstantAlpha( GrAlpha_t alpha );
+
+FX_ENTRY void FX_CALL 
+grLfbConstantDepth( FxU16 depth );
+
+FX_ENTRY void FX_CALL 
+grLfbWriteColorSwizzle(FxBool swizzleBytes, FxBool swapWords);
+
+FX_ENTRY void FX_CALL
+grLfbWriteColorFormat(GrColorFormat_t colorFormat);
+
+#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
+FX_ENTRY FxBool FX_CALL
+grLfbWriteRegion( GrBuffer_t dst_buffer, 
+                  FxU32 dst_x, FxU32 dst_y, 
+                  GrLfbSrcFmt_t src_format, 
+                  FxU32 src_width, FxU32 src_height, 
+                  FxBool pixelPipeline,
+                  FxI32 src_stride, void *src_data );
+#else
+FX_ENTRY FxBool FX_CALL
+grLfbWriteRegion( GrBuffer_t dst_buffer, 
+                  FxU32 dst_x, FxU32 dst_y, 
+                  GrLfbSrcFmt_t src_format, 
+                  FxU32 src_width, FxU32 src_height, 
+                  FxI32 src_stride, void *src_data );
+#endif
+
+FX_ENTRY FxBool FX_CALL
+grLfbReadRegion( GrBuffer_t src_buffer,
+                 FxU32 src_x, FxU32 src_y,
+                 FxU32 src_width, FxU32 src_height,
+                 FxU32 dst_stride, void *dst_data );
+
+
+/*
+**  Antialiasing Functions
+*/
+
+#ifndef GLIDE3_ALPHA
+
+FX_ENTRY void FX_CALL
+grAADrawLine(const GrVertex *v1, const GrVertex *v2);
+
+FX_ENTRY void FX_CALL
+grAADrawPoint(const GrVertex *pt );
+
+FX_ENTRY void FX_CALL
+grAADrawPolygon(const int nverts, const int ilist[], const GrVertex vlist[]);
+
+FX_ENTRY void FX_CALL
+grAADrawPolygonVertexList(const int nverts, const GrVertex vlist[]);
+#endif /* !GLIDE3_ALPHA */
+
+FX_ENTRY void FX_CALL
+grAADrawTriangle(
+                 const GrVertex *a, const GrVertex *b, const GrVertex *c,
+                 FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias
+                 );
+
+/*
+** glide management functions
+*/
+FX_ENTRY void FX_CALL
+grGlideInit( void );
+
+FX_ENTRY void FX_CALL
+grGlideShutdown( void );
+
+#ifndef GLIDE3_ALPHA
+FX_ENTRY void FX_CALL
+grGlideGetVersion( char version[80] );
+#endif /* !GLIDE3_ALPHA */
+
+FX_ENTRY void FX_CALL
+grGlideGetState( GrState *state );
+
+FX_ENTRY void FX_CALL
+grGlideSetState( const GrState *state );
+
+#ifndef GLIDE3_ALPHA
+FX_ENTRY void FX_CALL
+grGlideShamelessPlug(const FxBool on);
+
+FX_ENTRY void FX_CALL
+grHints(GrHint_t hintType, FxU32 hintMask);
+#endif /* !GLIDE3_ALPHA */
+
+#ifdef GLIDE3
+FX_ENTRY void FX_CALL
+grVertexLayout(FxU32 param, FxI32 offset, FxU32 mode);
+
+FX_ENTRY void FX_CALL 
+grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers);
+
+FX_ENTRY void FX_CALL 
+grDrawVertexArrayLinear(FxU32 mode, FxU32 Count, void *pointers, FxU32 stride);
+
+FX_ENTRY void FX_CALL 
+grDrawVertexArrayLinear(FxU32 mode, FxU32 Count, void *pointers, FxU32 stride);
+
+#endif
+
+#endif /* FX_GLIDE_NO_FUNC_PROTO */
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <glideutl.h>
+
+#endif /* __GLIDE_H__ */
Index: trunk/src/opengl/glide/sst1/glide/glide.rc
===================================================================
--- trunk/src/opengl/glide/sst1/glide/glide.rc	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/glide.rc	(revision 2885)
@@ -0,0 +1,72 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/Attic/glide.rc,v 1.1 2000-02-25 00:31:15 sandervl Exp $
+** $Log: glide.rc,v $
+** Revision 1.1  2000-02-25 00:31:15  sandervl
+** Created new Voodoo 1 Glide dir
+**
+** Revision 1.1  2000/02/18 10:43:08  sandervl
+** Created Voodoo 1 Glide dir
+**
+*/
+
+#define OFFICIAL   1 
+#define FINAL      1 
+
+#include <fxver.h>
+#include "rcver.h"
+//#include "fxbldno.h"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+1 VERSIONINFO
+ FILEVERSION MANVERSION, MANREVISION, 0, 1
+ PRODUCTVERSION MANVERSION, MANREVISION, 0, 1
+ FILEFLAGSMASK 0x0030003FL
+ FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
+
+ FILEOS VOS_DOS_WINDOWS32
+ FILETYPE VFT_DRV
+ FILESUBTYPE VFT2_DRV_INSTALLABLE
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904E4"
+        BEGIN
+            VALUE "CompanyName", "3Dfx Interactive, Inc.\0"
+            VALUE "FileDescription", "3Dfx Interactive, Inc. Glide DLL\0"
+            VALUE "FileVersion", "2.46\0"
+            VALUE "InternalName", "glide2x.dll\0"
+            VALUE "LegalCopyright", "Copyright \251 3Dfx Interactive, Inc. 1997\0"
+            VALUE "OriginalFilename", "glide2x.dll\0"
+            VALUE "ProductName", "Glide(tm) for Voodoo Graphics\251 and OS/2 Warp\0"
+            VALUE "ProductVersion", "2.46\0"
+            VALUE "Graphics Subsystem", "Voodoo Graphics(tm)\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        /* the following line should be extended for localized versions */
+        VALUE "Translation", 0x409, 1252
+    END
+END
Index: trunk/src/opengl/glide/sst1/glide/glidesys.h
===================================================================
--- trunk/src/opengl/glide/sst1/glide/glidesys.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/glidesys.h	(revision 2885)
@@ -0,0 +1,113 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/glidesys.h,v 1.1 2000-02-25 00:31:16 sandervl Exp $
+** $Log: glidesys.h,v $
+** Revision 1.1  2000-02-25 00:31:16  sandervl
+** Created new Voodoo 1 Glide dir
+**
+*/
+#ifndef __GLIDESYS_H__
+#define __GLIDESYS_H__
+
+/*
+n** -----------------------------------------------------------------------
+** COMPILER/ENVIRONMENT CONFIGURATION
+** -----------------------------------------------------------------------
+*/
+
+/* Endianness is stored in bits [30:31] */
+#define GLIDE_ENDIAN_SHIFT      30
+#define GLIDE_ENDIAN_LITTLE     (0x1 << GLIDE_ENDIAN_SHIFT)
+#define GLIDE_ENDIAN_BIG        (0x2 << GLIDE_ENDIAN_SHIFT)
+
+/* OS is stored in bits [0:6] */
+#define GLIDE_OS_SHIFT          0
+#define GLIDE_OS_UNIX           0x1
+#define GLIDE_OS_DOS32          0x2
+#define GLIDE_OS_WIN32          0x4
+#define GLIDE_OS_SYSTEM7        0x8
+#define GLIDE_OS_OS2            0x10
+#define GLIDE_OS_OTHER          0x20 /* For Proprietary Arcade HW */
+
+#define GLIDE_SST_SHIFT         7
+#define GLIDE_SST_HW            (0x2 << GLIDE_SST_SHIFT )
+
+/* Hardware Type is stored in bits [9:12] */
+#define GLIDE_HW_SHIFT          9
+#define GLIDE_HW_SST1           (0x1 << GLIDE_HW_SHIFT)
+#define GLIDE_HW_SST96          (0x2 << GLIDE_HW_SHIFT)
+#define GLIDE_HW_SSTH3          (0x4 << GLIDE_HW_SHIFT)
+
+/*
+** Make sure we handle all instances of WIN32
+*/
+#ifndef __WIN32__
+#  if defined ( _WIN32 ) || defined (WIN32) || defined(__NT__)
+#    define __WIN32__
+#  endif
+#endif
+
+/* We need two checks on the OS: one for endian, the other for OS */
+/* Check for endianness */
+#if defined(__IRIX__) || defined(__sparc__) || defined(MACOS)
+#  define GLIDE_ENDIAN    GLIDE_ENDIAN_BIG
+#else
+#  define GLIDE_ENDIAN GLIDE_ENDIAN_LITTLE
+#endif
+
+/* Check for OS */
+#if defined(__IRIX__) || defined(__sparc__) || defined(__linux__)
+#  define GLIDE_OS        GLIDE_OS_UNIX
+#elif defined(__DOS__)
+#  define GLIDE_OS        GLIDE_OS_DOS32
+#elif defined(__WIN32__)
+#  define GLIDE_OS        GLIDE_OS_WIN32
+#elif defined(__OS2__) || defined(_OS2_)
+#  define GLIDE_OS        GLIDE_OS_OS2
+#endif
+
+#define GLIDE_SST     GLIDE_SST_HW
+
+
+/* Check for type of hardware */
+#ifdef SST96
+#  define GLIDE_HW        GLIDE_HW_SST96
+#elif defined(SSTH3)
+#  define GLIDE_HW        GLIDE_HW_SSTH3
+#else /* Default to SST1 */
+#  define GLIDE_HW        GLIDE_HW_SST1
+#endif
+
+
+#define GLIDE_PLATFORM (GLIDE_ENDIAN | GLIDE_OS | GLIDE_SST | GLIDE_HW)
+
+/*
+** Control the number of TMUs
+*/
+#ifndef GLIDE_NUM_TMU
+#  define GLIDE_NUM_TMU 2
+#endif
+
+
+#if ( ( GLIDE_NUM_TMU < 0 ) && ( GLIDE_NUM_TMU > 3 ) )
+#  error "GLIDE_NUM_TMU set to an invalid value"
+#endif
+
+#endif /* __GLIDESYS_H__ */
Index: trunk/src/opengl/glide/sst1/glide/glideutl.h
===================================================================
--- trunk/src/opengl/glide/sst1/glide/glideutl.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/glideutl.h	(revision 2885)
@@ -0,0 +1,189 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/glideutl.h,v 1.1 2000-02-25 00:31:16 sandervl Exp $
+** $Log: glideutl.h,v $
+** Revision 1.1  2000-02-25 00:31:16  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 11    1/07/98 11:18a Atai
+ * remove GrMipMapInfo and GrGC.mm_table in glide3
+ * 
+ * 10    1/06/98 6:47p Atai
+ * undo grSplash and remove gu routines
+ * 
+ * 9     1/05/98 6:04p Atai
+ * move 3df gu related data structure from glide.h to glideutl.h
+ * 
+ * 8     12/18/97 2:13p Peter
+ * fogTable cataclysm
+ * 
+ * 7     12/15/97 5:52p Atai
+ * disable obsolete glide2 api for glide3
+ * 
+ * 6     8/14/97 5:32p Pgj
+ * remove dead code per GMT
+ * 
+ * 5     6/12/97 5:19p Pgj
+ * Fix bug 578
+ * 
+ * 4     3/05/97 9:36p Jdt
+ * Removed guFbWriteRegion added guEncodeRLE16
+ * 
+ * 3     1/16/97 3:45p Dow
+ * Embedded fn protos in ifndef FX_GLIDE_NO_FUNC_PROTO 
+*/
+
+/* Glide Utility routines */
+
+#ifndef __GLIDEUTL_H__
+#define __GLIDEUTL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
+/*
+** 3DF texture file structs
+*/
+
+typedef struct
+{
+  FxU32               width, height;
+  int                 small_lod, large_lod;
+  GrAspectRatio_t     aspect_ratio;
+  GrTextureFormat_t   format;
+} Gu3dfHeader;
+
+typedef struct
+{
+  FxU8  yRGB[16];
+  FxI16 iRGB[4][3];
+  FxI16 qRGB[4][3];
+  FxU32 packed_data[12];
+} GuNccTable;
+
+typedef struct {
+    FxU32 data[256];
+} GuTexPalette;
+
+typedef union {
+    GuNccTable   nccTable;
+    GuTexPalette palette;
+} GuTexTable;
+
+typedef struct
+{
+  Gu3dfHeader  header;
+  GuTexTable   table;
+  void        *data;
+  FxU32        mem_required;    /* memory required for mip map in bytes. */
+} Gu3dfInfo;
+
+#endif
+
+#ifndef FX_GLIDE_NO_FUNC_PROTO
+/*
+** rendering functions
+*/
+
+#ifndef GLIDE3_ALPHA
+FX_ENTRY void FX_CALL
+guAADrawTriangleWithClip( const GrVertex *a, const GrVertex
+                         *b, const GrVertex *c);
+
+FX_ENTRY void FX_CALL
+guDrawTriangleWithClip(
+                       const GrVertex *a,
+                       const GrVertex *b,
+                       const GrVertex *c
+                       );
+
+FX_ENTRY void FX_CALL
+guDrawPolygonVertexListWithClip( int nverts, const GrVertex vlist[] );
+
+/*
+** hi-level rendering utility functions
+*/
+FX_ENTRY void FX_CALL
+guAlphaSource( GrAlphaSource_t mode );
+
+FX_ENTRY void FX_CALL
+guColorCombineFunction( GrColorCombineFnc_t fnc );
+
+FX_ENTRY int FX_CALL
+guEncodeRLE16( void *dst, 
+               void *src, 
+               FxU32 width, 
+               FxU32 height );
+
+FX_ENTRY FxU16 * FX_CALL
+guTexCreateColorMipMap( void );
+#endif /* !GLIDE3_ALPHA */
+
+#ifdef GLIDE3
+FX_ENTRY void FX_CALL 
+guGammaCorrectionRGB( FxFloat red, FxFloat green, FxFloat blue );
+#endif
+
+/*
+** fog stuff
+*/
+FX_ENTRY float FX_CALL
+guFogTableIndexToW( int i );
+
+FX_ENTRY void FX_CALL
+guFogGenerateExp( GrFog_t fogtable[], float density );
+
+FX_ENTRY void FX_CALL
+guFogGenerateExp2( GrFog_t fogtable[], float density );
+
+FX_ENTRY void FX_CALL
+guFogGenerateLinear(GrFog_t fogtable[],
+                    float nearZ, float farZ );
+
+/*
+** endian stuff
+*/
+#ifndef GLIDE3_ALPHA
+FX_ENTRY FxU32 FX_CALL
+guEndianSwapWords( FxU32 value );
+
+FX_ENTRY FxU16 FX_CALL
+guEndianSwapBytes( FxU16 value );
+#endif /* !GLIDE3_ALPHA */
+
+/*
+** hi-level texture manipulation tools.
+*/
+FX_ENTRY FxBool FX_CALL
+gu3dfGetInfo( const char *filename, Gu3dfInfo *info );
+
+FX_ENTRY FxBool FX_CALL
+gu3dfLoad( const char *filename, Gu3dfInfo *data );
+
+#endif /* FX_GLIDE_NO_FUNC_PROTO */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __GLIDEUTL_H__ */
Index: trunk/src/opengl/glide/sst1/glide/gmovie.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gmovie.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gmovie.c	(revision 2885)
@@ -0,0 +1,52 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gmovie.c,v 1.1 2000-02-25 00:31:16 sandervl Exp $
+** $Log: gmovie.c,v $
+** Revision 1.1  2000-02-25 00:31:16  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 3     3/09/97 10:31a Dow
+ * Added GR_DIENTRY for di glide functions
+**
+*/
+#include <string.h>
+
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+GR_DIENTRY(guMovieStart, void, ( void ))
+{
+   GrErrorCallback( "guMovieStart:  unsupported on SST hardware", FXFALSE );
+}
+
+GR_DIENTRY(guMovieStop, void, ( void ))
+{
+   GrErrorCallback( "guMovieStop:  unsupported on SST hardware", FXFALSE );
+}
+
+GR_DIENTRY(guMovieSetName, void, ( const char *name ))
+{
+   GrErrorCallback( "guMovieSetName:  unsupported on SST hardware", FXFALSE );
+}
+
Index: trunk/src/opengl/glide/sst1/glide/gpci.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gpci.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gpci.c	(revision 2885)
@@ -0,0 +1,1033 @@
+/*
+ ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ ** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ ** 
+ ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ ** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ ** THE UNITED STATES.  
+ ** 
+ ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+ **
+ ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gpci.c,v 1.1 2000-02-25 00:31:17 sandervl Exp $
+ ** $Log: gpci.c,v $
+ ** Revision 1.1  2000-02-25 00:31:17  sandervl
+ ** Created new Voodoo 1 Glide dir
+ **
+ * 
+ * 45    11/01/97 12:11p Pgj
+ * glide.dll ---> glide2x.dll
+ * 
+ * 44    10/21/97 8:20p Atai
+ * initialize vid timing to NLLL
+ * 
+ * 43    8/18/97 3:11p Atai
+ * fix vg96 fb ram configuration
+ * 
+ * 42    7/18/97 5:30p Jdt
+ * Fixes for open/shutdown symmetry
+ * 
+ * 41    7/12/97 4:58p Dow
+ * Added DllMain
+ * 
+ * 40    7/07/97 8:33a Jdt
+ * New tracing macros.
+ * 
+ * 39    6/19/97 7:35p Dow
+ * More P6 Stuff
+ * 
+ * 38    5/27/97 2:03p Dow
+ * added new env variable
+ * 
+ * 37    5/19/97 7:35p Pgj
+ * Print cogent error message if h/w not found
+ * 
+ * 36    4/15/97 12:59p Dow
+ * Bandaid for SST96/P6
+ * 
+ * 35    4/13/97 8:11p Jdt
+ * Change in init.h
+ * 
+ * 34    4/13/97 2:06p Pgj
+ * eliminate all anonymous unions (use hwDep)
+ * 
+ * 33    3/24/97 7:37p Dow
+ * Now sets n tmus for hwConfig
+ * 
+ * 32    3/18/97 9:08p Dow
+ * Added FX_GLIDE_NO_DITHER_SUB environment variable
+ * 
+ * 31    3/17/97 6:27a Jdt
+ * Removed enumCB and pass 0 to enumHardware.
+ * 
+ * 30    3/16/97 12:51a Jdt
+ * fix num_sst when detecting vg96
+ * 
+ * 29    3/16/97 12:39a Jdt
+ * Programmatic type-os
+ * 
+ * 28    3/16/97 12:19a Jdt
+ * Completely re-wrote grSstDetectResources
+ * 
+ * 27    3/06/97 4:54p Dow
+ * Fixed SLI
+ * 
+ * 26    3/04/97 9:08p Dow
+ * Neutered multiplatform multiheaded monster
+ * 
+ * 25    3/02/97 7:05p Dow
+ * Changes to support DOS DLLs
+ * 
+ * 24    2/26/97 2:18p Dow
+ * moved all debug set macros to __cdecl
+ * 
+ * 23    2/26/97 11:57a Jdt
+ * Fixed stack bug, fixed splash screen bug
+ * 
+ * 22    2/19/97 4:42p Dow
+ * Fixed debug build for Watcom
+ * 
+ * 21    2/18/97 10:39a Dow
+ * Added call to initRegisters for AT3D
+ * 
+ * 20    2/18/97 9:51a Jdt
+ * Did some casting to remove warnings.
+ * 
+ * 19    2/14/97 12:55p Dow
+ * moved vg96 fifo wrap into init code
+ * 
+ * 18    2/12/97 8:15p Dow
+ * Fixed VG base_pointe
+ * 
+ * 17    2/12/97 9:20a Dow
+ * Fixed Watcom error wrt GDBG_ERROR call
+ * 
+ * 16    2/11/97 6:59p Dow
+ * Changes to support vid tiles and ser status
+ * 
+ * 15    1/18/97 11:48p Dow
+ * Re-added error callback set
+ * Added support for GMT's register debugging
+ * 
+ * 14    1/14/97 6:41p Dow
+ * 
+ * 13    12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+**
+*/
+
+#include <stdio.h>
+#include <string.h>
+
+#include <3dfx.h>
+#include <glidesys.h>
+
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+#include <sst1vid.h>
+
+#include <init.h>
+
+#if (GLIDE_PLATFORM & GLIDE_OS_WIN32) || defined(__WIN32OS2__)
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+BOOL WINAPI 
+DllMain(HANDLE hInst, ULONG  ul_reason_for_call, LPVOID lpReserved) 
+{
+  switch( ul_reason_for_call ) {
+  case DLL_PROCESS_DETACH:
+    GDBG_INFO((80, "DllMain: DLL_PROCESS_DETACH\n"));
+    grGlideShutdown();
+    break;
+  case DLL_PROCESS_ATTACH:
+    GDBG_INFO((80, "DllMain: DLL_PROCESS_DETACH\n"));
+    break;
+  case DLL_THREAD_ATTACH:
+    GDBG_INFO((80, "DllMain: DLL_PROCESS_DETACH\n"));
+    break;
+  case DLL_THREAD_DETACH:
+    GDBG_INFO((80, "DllMain: DLL_PROCESS_DETACH\n"));
+    break;
+  default:
+    GDBG_INFO((80, "DllMain: Unhandled message.\n"));
+    break;
+  }
+  
+  return TRUE;
+
+} /* DllMain */
+
+
+#endif
+
+/*-------------------------------------------------------------------
+  Function: _grSstDetectResources
+  Date: --
+  Implementor(s): Dow, Gmt, Jdt
+  Library: Glide
+  Description:
+  Discover devices on the PCI bus.
+  Discover configuration of detected devices.
+  Initialize all Glide GC's 
+  
+  Recognized devices depend upon compile time flags
+  
+  This code should NOT initialize the hardware 
+  any more than is necessary for discovery of 
+  configuration
+  
+  Arguments: none
+  Return: 
+  FXTRUE  - at least one device was detected
+  FXFALSE - no devices were detected.
+  -------------------------------------------------------------------*/
+FxBool 
+_grSstDetectResources(void)
+{
+  InitDeviceInfo info;
+  int ctx, device;
+  FxBool rv = FXFALSE;
+
+  GDBG_INFO((280,"_grSstDetectResources()\n"));
+
+  initEnumHardware( 0 );
+
+  _GlideRoot.hwConfig.num_sst = 0;
+  for( ctx = 0, device = 0; 
+      device < INIT_MAX_DEVICES; 
+      device++ ) {
+    if ( initGetDeviceInfo( device, &info ) ) {
+#if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
+      if ( info.hwClass == INIT_VOODOO ) {
+        int tmu;
+        
+        _GlideRoot.hwConfig.SSTs[ctx].type = GR_SSTTYPE_VOODOO;
+        
+        _GlideRoot.GCs[ctx].base_ptr  = (FxU32 *)info.hwDep.vgInfo.vgBaseAddr;
+        _GlideRoot.GCs[ctx].reg_ptr   = (FxU32 *)info.hwDep.vgInfo.vgBaseAddr;
+        _GlideRoot.GCs[ctx].lfb_ptr   = (FxU32 *)SST_LFB_ADDRESS(info.hwDep.vgInfo.vgBaseAddr);
+        _GlideRoot.GCs[ctx].tex_ptr   = (FxU32 *)SST_TEX_ADDRESS(info.hwDep.vgInfo.vgBaseAddr);
+        _GlideRoot.GCs[ctx].slave_ptr = (FxU32 *)info.hwDep.vgInfo.slaveBaseAddr;
+        _GlideRoot.GCs[ctx].grSstRez  = GR_RESOLUTION_NONE;
+
+        _GlideRoot.GCs[ctx].scanline_interleaved = info.hwDep.vgInfo.sliDetect;
+        _GlideRoot.GCs[ctx].grSstRefresh         = GR_REFRESH_NONE;
+        _GlideRoot.GCs[ctx].num_tmu              = info.hwDep.vgInfo.nTFX;
+        _GlideRoot.GCs[ctx].fbuf_size            = info.hwDep.vgInfo.pfxRam;
+        _GlideRoot.GCs[ctx].vidTimings           = NULL;
+        
+        _GlideRoot.hwConfig.num_sst++;
+        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.fbiRev = 
+          info.hwDep.vgInfo.pfxRev;
+        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.fbRam =
+          info.hwDep.vgInfo.pfxRam;
+        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.sliDetect =
+          info.hwDep.vgInfo.sliDetect;
+        
+        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.nTexelfx = 
+          info.hwDep.vgInfo.nTFX;
+
+        for (tmu = 0; tmu < _GlideRoot.GCs[ctx].num_tmu; tmu++) {
+          _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.tmuConfig[tmu].tmuRam =
+            info.hwDep.vgInfo.tfxRam;
+          _GlideRoot.hwConfig.SSTs[ctx].sstBoard.VoodooConfig.tmuConfig[tmu].tmuRev =
+            info.hwDep.vgInfo.tfxRev;
+          
+          memset(&_GlideRoot.GCs[ctx].tmu_state[tmu], 0, sizeof(_GlideRoot.GCs[ctx].tmu_state[tmu]));
+          _GlideRoot.GCs[ctx].tmu_state[tmu].ncc_mmids[0] = GR_NULL_MIPMAP_HANDLE;
+          _GlideRoot.GCs[ctx].tmu_state[tmu].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE;
+          _GlideRoot.GCs[ctx].tmu_state[tmu].total_mem    = info.hwDep.vgInfo.tfxRam<<20;
+        }
+        rv = FXTRUE;
+        ctx++;
+      }
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+      if ( info.hwClass == INIT_VG96 ) {
+        _GlideRoot.hwConfig.SSTs[ctx].type = GR_SSTTYPE_SST96;
+
+        _GlideRoot.GCs[ctx].base_ptr  = (FxU32 *)info.hwDep.vg96Info.vg96BaseAddr;
+        _GlideRoot.GCs[ctx].reg_ptr   = (FxU32 *)SST96_REG_PTR(info.hwDep.vg96Info.vg96BaseAddr);
+        _GlideRoot.GCs[ctx].lfb_ptr   = (FxU32 *)SST96_LFB_PTR(info.hwDep.vg96Info.vg96BaseAddr);
+        _GlideRoot.GCs[ctx].tex_ptr   = (FxU32 *)SST96_TEX_PTR(info.hwDep.vg96Info.vg96BaseAddr);
+        _GlideRoot.GCs[ctx].slave_ptr = 0;
+
+        _GlideRoot.GCs[ctx].grSstRez     = GR_RESOLUTION_NONE;
+        _GlideRoot.GCs[ctx].grSstRefresh = GR_REFRESH_NONE;
+
+        _GlideRoot.GCs[ctx].scanline_interleaved = FXFALSE;
+        _GlideRoot.GCs[ctx].num_tmu              = info.hwDep.vg96Info.nTFX;
+        _GlideRoot.GCs[ctx].fbuf_size            = info.hwDep.vg96Info.vg96Ram;
+
+        _GlideRoot.hwConfig.num_sst++;
+        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.nTexelfx = 
+          info.hwDep.vg96Info.nTFX;
+        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.fbRam = 
+          info.hwDep.vg96Info.vg96Ram >> 20;
+        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.tmuConfig.tmuRev =
+          info.hwDep.vg96Info.tfxRev;
+        _GlideRoot.hwConfig.SSTs[ctx].sstBoard.SST96Config.tmuConfig.tmuRam =
+          info.hwDep.vg96Info.tfxRam;
+        memset(&_GlideRoot.GCs[ctx].tmu_state[0], 0, sizeof(_GlideRoot.GCs[ctx].tmu_state[0]));
+
+        _GlideRoot.GCs[ctx].tmu_state[0].ncc_mmids[0] = GR_NULL_MIPMAP_HANDLE;
+        _GlideRoot.GCs[ctx].tmu_state[0].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE;
+        _GlideRoot.GCs[ctx].tmu_state[0].total_mem    = info.hwDep.vg96Info.tfxRam<<20;
+        
+        _GlideRoot.GCs[ctx].hwDep.sst96Dep.serialStatus     = 
+          (FxU32*)info.regs.hwDep.VG96RegDesc.serialStatus;
+        _GlideRoot.GCs[ctx].hwDep.sst96Dep.fifoApertureBase = 
+          (FxU32*)info.regs.hwDep.VG96RegDesc.fifoApertureBase;
+
+        initDeviceSelect( ctx );
+        initSetWriteMethod( _grSst96Store32 );
+        rv = FXTRUE;
+        ctx++;
+      }
+#else
+#error "Need to define detection parameters for this device"    
+#endif
+    } else {
+      break;
+    }
+  }
+  
+  return rv;
+} /* _grSstDetectResources */
+
+
+static void
+displayBoardInfo( int i, GrHwConfiguration *hwc )
+{
+  if (hwc->SSTs[i].type == GR_SSTTYPE_VOODOO) {
+    int tmuNum;
+
+    GDBG_INFO((80,"SST board %d: 3Dfx Voodoo Graphics\n", i));
+    GDBG_INFO((80,"\tPixelfx rev %d with %d MB Frame Buffer\n",
+               hwc->SSTs[i].sstBoard.VoodooConfig.fbiRev,
+               hwc->SSTs[i].sstBoard.VoodooConfig.fbRam
+               ));
+    GDBG_INFO((80,"\t%d Texelfx chips:\n",
+               hwc->SSTs[i].sstBoard.VoodooConfig.nTexelfx
+               ));
+    if (hwc->SSTs[i].sstBoard.VoodooConfig.sliDetect)
+      GDBG_INFO((80,"\tScanline Interleaved\n"));
+    for (tmuNum = 0;
+         tmuNum < hwc->SSTs[i].sstBoard.VoodooConfig.nTexelfx;
+         tmuNum++ )
+      {
+        GDBG_INFO((80,"\t\tTexelfx %d: Rev %d, %d MB Texture\n", tmuNum,
+                   hwc->SSTs[i].sstBoard.VoodooConfig.tmuConfig[tmuNum].tmuRev,
+                   hwc->SSTs[i].sstBoard.VoodooConfig.tmuConfig[tmuNum].tmuRam
+                   ));
+      }
+  } else if (hwc->SSTs[i].type == GR_SSTTYPE_SST96) {
+    GDBG_INFO((80,"SST board %d: 3Dfx Voodoo Rush\n", i));
+    GDBG_INFO((80,"\tFBI Jr. with %d MB Frame Buffer\n",
+               hwc->SSTs[i].sstBoard.SST96Config.fbRam
+               ));
+    GDBG_INFO((80,"\tTexelfx chips:  1\n"));
+
+  }
+  else
+    GDBG_INFO((80,"error: SSTs %d: unknown type\n",i));
+} /* displayBoardInfo */
+
+
+extern FxU32 _cpu_detect_asm(void);
+
+#if defined(FX_DLL_ENABLE) && (GLIDE_PLATFORM & GLIDE_OS_WIN32)
+#include <windows.h>
+#endif
+
+void
+_GlideInitEnvironment( void )
+{
+  int i;
+
+  if ( _GlideRoot.initialized ) /* only execute once */
+    return;
+  GDBG_INIT();                  /* init the GDEBUG libraray */
+  GDBG_INFO((80,"_GlideInitEnvironment()\n"));
+
+#ifdef __WIN32__
+  grErrorSetCallback(_grErrorWindowsCallback);
+#else
+#ifdef __OS2__
+  grErrorSetCallback(_grErrorOs2Callback);
+#else
+  grErrorSetCallback(_grErrorDefaultCallback);
+#endif /* __OS2__ */
+#endif /* __WIN32__ */
+
+#ifdef GLIDE_DEBUG
+  GDBG_INFO((0,"GLIDE DEBUG LIBRARY\n")); /* unconditional display */
+#endif
+
+#if defined(FX_DLL_ENABLE) && (GLIDE_PLATFORM & GLIDE_OS_WIN32)
+  {                             /* GMT: display the DLL pathname for sanity checking */
+    char buf[132];
+    if (GetModuleFileName(GetModuleHandle("glide2x.dll"),buf,sizeof(buf))) {
+#ifdef GLIDE_DEBUG
+      GDBG_INFO((0,"DLL path: %s\n",buf)); /* unconditional display */
+#else
+      GDBG_INFO((80,"DLL path: %s\n",buf));
+#endif
+    } /* silent failure */
+  }
+#endif
+
+  _GlideRoot.CPUType = _cpu_detect_asm();
+
+  if (getenv("FX_CPU")) _GlideRoot.CPUType = atoi(getenv("FX_CPU"));
+  _GlideRoot.environment.triBoundsCheck = 
+    getenv("FX_GLIDE_BOUNDS_CHECK") != NULL;
+  _GlideRoot.environment.swapInterval = -1;
+  _GlideRoot.environment.swFifoLWM = -1;
+  _GlideRoot.environment.noSplash = 
+    getenv("FX_GLIDE_NO_SPLASH") != NULL;
+  _GlideRoot.environment.shamelessPlug = 
+    getenv("FX_GLIDE_SHAMELESS_PLUG") != NULL;
+  if (getenv("FX_GLIDE_LWM"))
+    _GlideRoot.environment.swFifoLWM = atoi(getenv("FX_GLIDE_LWM"));
+  if (getenv("FX_GLIDE_SWAPINTERVAL")) {
+    _GlideRoot.environment.swapInterval = 
+      atoi(getenv("FX_GLIDE_SWAPINTERVAL"));
+    if (_GlideRoot.environment.swapInterval < 0)
+      _GlideRoot.environment.swapInterval = 0;
+  }
+
+  if (getenv("FX_GLIDE_IGNORE_REOPEN"))
+    _GlideRoot.environment.ignoreReopen = FXTRUE;
+
+  if (getenv("FX_GLIDE_NO_DITHER_SUB")) {
+    _GlideRoot.environment.disableDitherSub = FXTRUE;
+  }
+
+  if (getenv("FX_SNAPSHOT"))
+    _GlideRoot.environment.snapshot = atoi(getenv("FX_SNAPSHOT"));
+  
+  GDBG_INFO((80,"    triBoundsCheck: %d\n",_GlideRoot.environment.triBoundsCheck));
+  GDBG_INFO((80,"      swapInterval: %d\n",_GlideRoot.environment.swapInterval));
+  GDBG_INFO((80,"          noSplash: %d\n",_GlideRoot.environment.noSplash));
+  GDBG_INFO((80,"     shamelessPlug: %d\n",_GlideRoot.environment.shamelessPlug));
+  GDBG_INFO((80,"        rsrchFlags: %d\n",_GlideRoot.environment.rsrchFlags));
+  GDBG_INFO((80,"               cpu: %d\n",_GlideRoot.CPUType));
+  GDBG_INFO((80,"          snapshot: %d\n",_GlideRoot.environment.snapshot));
+  GDBG_INFO((80,"  disableDitherSub: %d\n",_GlideRoot.environment.disableDitherSub));  
+  /* GMT: BUG these are hardware dependent and really should come from the init code */
+  _GlideRoot.stats.minMemFIFOFree = 0xffff;
+  _GlideRoot.stats.minPciFIFOFree = 0x3f;
+
+  /* constant pool */
+  _GlideRoot.pool.f0   =   0.0F;
+  _GlideRoot.pool.fHalf=   0.5F;
+  _GlideRoot.pool.f1   =   1.0F;
+  _GlideRoot.pool.f255 = 255.0F;
+  _GlideRoot.pool.f256 = 256.0F;
+
+  _GlideRoot.current_sst = 0;   /* make sure there's a valid GC */
+  _GlideRoot.curGC = &_GlideRoot.GCs[0]; /* just for 'booting' the library */
+  if (!_grSstDetectResources()) {
+    char s[128];
+#ifndef __linux__
+    sprintf(s,
+            "_GlideInitEnvironment: glide2x.dll expected %s, none detected\n",
+            GLIDE_DRIVER_NAME);
+#else
+    sprintf(s,
+            "_GlideInitEnvironment: libglide2x.so expected %s, none detected\n",
+            GLIDE_DRIVER_NAME);
+#endif
+    GrErrorCallback(s, FXTRUE);
+  }
+
+  /* GMT: this isn't really necessary since GlideRoot is static */
+  for (i = 0; i < _GlideRoot.hwConfig.num_sst; i++) {
+    _GlideRoot.GCs[i].mm_table.free_mmid = 0;
+    displayBoardInfo( i, &_GlideRoot.hwConfig );
+  }
+
+  _grMipMapInit();
+  _GlideRoot.initialized = FXTRUE; /* save this for the end */
+
+} /* _GlideInitEnvironment */
+
+
+
+
+#if defined(GLIDE_DEBUG)
+
+/* GMT: tracing utilities */
+
+/* STOLEN FROM SST.C */
+/*----------------------------------------------------------------------
+  An array of SST register info
+  ----------------------------------------------------------------------*/
+typedef struct {
+  char *name;
+} regInfo;
+
+static regInfo regsInfo[] = {
+  "STATUS",
+  "reserved0",
+  "vA.x",
+  "vA.y",
+  "vB.x",
+  "vB.y",
+  "vC.x",
+  "vC.y",
+
+  "R",
+  "G",
+  "B",
+  "Z",
+  "A",
+  "S",
+  "T",
+  "W",
+
+  "DRDX",
+  "DGDX",
+  "DBDX",
+  "DZDX",
+  "DADX",
+  "DSDX",
+  "DTDX",
+  "DWDX",
+
+  "DRDY",
+  "DGDY",
+  "DBDY",
+  "DZDY",
+  "DADY",
+  "DSDY",
+  "DTDY",
+  "DWDY",
+
+  "triangleCMD",
+  "reserved1",
+  "FvA.x",
+  "FvA.y",
+  "FvB.x",
+  "FvB.y",
+  "FvC.x",
+  "FvC.y",
+
+  "FR",
+  "FG",
+  "FB",
+  "FZ",
+  "FA",
+  "FS",
+  "FT",
+  "FW",
+
+  "FDRDX",
+  "FDGDX",
+  "FDBDX",
+  "FDZDX",
+  "FDADX",
+  "FDSDX",
+  "FDTDX",
+  "FDWDX",
+
+  "FDRDY",
+  "FDGDY",
+  "FDBDY",
+  "FDZDY",
+  "FDADY",
+  "FDSDY",
+  "FDTDY",
+  "FDWDY",
+
+  "FtriangleCMD",
+  "FBZCOLORPATH",
+  "FOGMODE",
+  "ALPHAMODE",
+  "FBZMODE",
+  "LFBMODE",
+  "CLIPLEFTRIGHT",
+  "CLIPBOTTOMTOP",
+
+  "nopCMD",
+  "fastfillCMD",
+  "swapbufCMD",
+  "FOGCOLOR",
+  "ZACOLOR",
+  "CHROMAKEY",
+  "reserved2",
+  "reserved3",
+
+  "STIPPLE",
+  "C0",
+  "C1",
+  "pixelsIN",
+  "chromaFAIL",
+  "zfuncFAIL",
+  "afuncFAIL",
+  "pixelsOUT",
+
+  "FOGTABLE[0]",
+  "FOGTABLE[1]",
+  "FOGTABLE[2]",
+  "FOGTABLE[3]",
+  "FOGTABLE[4]",
+  "FOGTABLE[5]",
+  "FOGTABLE[6]",
+  "FOGTABLE[7]",
+  "FOGTABLE[8]",
+  "FOGTABLE[9]",
+  "FOGTABLE[10]",
+  "FOGTABLE[11]",
+  "FOGTABLE[12]",
+  "FOGTABLE[13]",
+  "FOGTABLE[14]",
+  "FOGTABLE[15]",
+  "FOGTABLE[16]",
+  "FOGTABLE[17]",
+  "FOGTABLE[18]",
+  "FOGTABLE[19]",
+  "FOGTABLE[20]",
+  "FOGTABLE[21]",
+  "FOGTABLE[22]",
+  "FOGTABLE[23]",
+  "FOGTABLE[24]",
+  "FOGTABLE[25]",
+  "FOGTABLE[26]",
+  "FOGTABLE[27]",
+  "FOGTABLE[28]",
+  "FOGTABLE[29]",
+  "FOGTABLE[30]",
+  "FOGTABLE[31]",
+
+  "reserved_0",
+  "reserved_1",
+  "reserved_2",
+  "reserved_3",
+  "reserved_4",
+  "reserved_5",
+  "reserved_6",
+  "reserved_7",
+
+  "PCIINTERRUPT",
+  "VRETRACE",
+  "BACKPORCH",
+  "VIDEODIMENS",
+  "FBIINIT0",
+  "FBIINIT1",
+  "FBIINIT2",
+  "FBIINIT3",
+
+  "HSYNC",
+  "VSYNC",
+  "CLUTDATA",
+  "DACDATA",
+
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+  "reserved",
+
+  "CHROMARANGE",
+  "CLIPLEFTRIGHT1",
+  "CLIPTOPBOTTOM1",
+  "COLBUFSETUP",
+  "AUXBUFSETUP",
+  "TEXCHIPSEL",
+  "SWAPPENDCMD",
+  "reserved96",
+        
+  "reserved96",
+  "reserved96",
+  "reserved96",
+  "reserved96",
+  "reserved96",
+  "reserved96",
+  "reserved96",
+  "reserved96",
+
+
+  "TEXTUREMODE",
+  "TLOD",
+  "TDETAIL",
+  "TEXBASEADDR",
+  "TEXBASEADDR1",
+  "TEXBASEADDR2",
+  "TEXBASEADDR38",
+  "TREXINIT0",
+
+  "TREXINIT1",
+  "NCCTABLE0[0]",
+  "NCCTABLE0[1]",
+  "NCCTABLE0[2]",
+  "NCCTABLE0[3]",
+  "NCCTABLE0[4]",
+  "NCCTABLE0[5]",
+  "NCCTABLE0[6]",
+  "NCCTABLE0[7]",
+  "NCCTABLE0[8]",
+  "NCCTABLE0[9]",
+  "NCCTABLE0[10]",
+  "NCCTABLE0[11]",
+
+  "NCCTABLE1[0]",
+  "NCCTABLE1[1]",
+  "NCCTABLE1[2]",
+  "NCCTABLE1[3]",
+  "NCCTABLE1[4]",
+  "NCCTABLE1[5]",
+  "NCCTABLE1[6]",
+  "NCCTABLE1[7]",
+  "NCCTABLE1[8]",
+  "NCCTABLE1[9]",
+  "NCCTABLE1[10]",
+  "NCCTABLE1[11]",
+};
+
+#define MAXREGADDR sizeof(regsInfo)/sizeof(regInfo)
+
+static FxU32 last_addr = 0;             /* TEX trace optimizer */
+
+FxU32 GR_CDECL
+_GR_GET(void *addr)
+{
+  GR_DCL_GC;
+  FxU32 chip, data, iaddr = (FxU32) addr;
+
+  data = GET(*(FxU32 *)addr);
+  iaddr = iaddr - (FxU32)gc->base_ptr + 0x10000000;
+  chip = (iaddr >> 10) & 0xF;
+  if (iaddr < 0x10000000) {     /* sanity check */
+    GDBG_ERROR("GET","bad address(<chip)=0x%x  data=%d(0x%08x)\n",
+                     iaddr,data,data);
+  }
+  if (iaddr & 3)
+    GDBG_ERROR("GET","unaligned address=0x%x\n", iaddr);
+
+  if (iaddr & 0x400000) {   /* are we in LFB territory? */
+    GDBG_INFO((120,"       GET(0x%x,%11d(0x%08x)) 0\tLFB\n",
+                               iaddr,data,data));
+  }
+  else {                        
+    /* check for valid register read */
+    int reg;
+    regInfo *ri;
+
+    if (chip != 0)
+      GDBG_ERROR("GET","CHIP #%d bad address=0x%x\n", chip,iaddr);
+    reg = (iaddr >> 2) & 0xFF;       /* get offset into SST */
+    ri = regsInfo+reg;
+    if (reg < MAXREGADDR) {
+      GDBG_INFO((120,"       GET(0x%x,%11d(0x%08x)) %d\t%s\n",
+                                 iaddr,data,data, chip,ri->name));
+    }
+    else
+      GDBG_ERROR("GET","bad register address=0x%x\n", reg<<2);
+  }
+  return data;
+} /* _GR_GET */
+
+void GR_CDECL
+_GR_SET(void *addr, unsigned long data)
+{
+  GR_DCL_GC;
+  FxU32 chip, iaddr = (FxU32) addr;
+
+  iaddr = iaddr - (FxU32)gc->base_ptr + 0x10000000;
+  if (iaddr < 0x10000000) {       /* sanity check */
+    GDBG_ERROR("SET","bad address(<chip)=0x%x  data=%d(0x%08x)\n",
+                     iaddr,data,data);
+  }
+  if (iaddr & 3)
+    GDBG_ERROR("SET","unaligned address=0x%x\n", iaddr);
+
+  if (iaddr & 0x800000) {        /* are we in TEX territory? */
+    chip = ((iaddr) >> 21) & 0x3;       /* grab bits 22:21 */
+    if (chip == 3) {
+      if (((iaddr>>17)&0x3F) == 0x31) {
+        GDBG_INFO((120,"       SET(0x%x,%11d(0x%08x)) %d\tPACKER\n",
+                                   iaddr,data,data,chip));
+      }
+    }
+    else {
+        if (GDBG_GET_DEBUGLEVEL(195)) { /* optimized TEX data trace */
+            if (iaddr == last_addr+4)
+                GDBG_PRINTF(("T+4 %x\n",        data));
+            else
+                GDBG_PRINTF(("TEX %x %x\n",     iaddr,data));
+        }
+    }
+  }
+  else if (iaddr & 0x400000) {  /* are we in LFB territory? */
+    GDBG_INFO((120,"       SET(0x%x,%11d(0x%08x)) 0\tLFB\n",
+                               iaddr,data,data));
+  }
+  else {                        
+    /* check for valid register read */
+    int reg;
+    regInfo *ri;
+
+    chip = (iaddr >> 10) & 0xF;
+    reg = (iaddr >> 2) & 0xFF;       /* get offset into SST */
+    ri = regsInfo+reg;
+    if (reg < MAXREGADDR) {
+      GDBG_INFO((120,"       SET(0x%x,%11d(0x%08x)) %d\t%s\n",
+                                 iaddr,data,data, chip,ri->name));
+    }
+    else
+      GDBG_ERROR("SET","CHIP #%d bad register address=0x%x, data=%d(x%x)\n",
+                        chip,reg<<2,data,data);
+  }
+  last_addr = iaddr;
+} /* _GR_SET */
+
+void GR_CDECL
+_GR_SETF(void *addr, float data)
+{
+  _GR_SET(addr,*(unsigned long *)&data);
+} /* _GR_SETF */
+
+void GR_CDECL
+_GR_SET16(void *addr, unsigned short data)
+{
+  GR_DCL_GC;
+  FxU32 iaddr = (FxU32)addr;
+  iaddr = iaddr - (FxU32)gc->base_ptr + 0x10000000;
+  GDBG_INFO((120,"       SET16(0x%x,%11d(0x%08x)) 0\tLFB16\n",iaddr,data,data));
+  last_addr = 0;
+} /* _GR_SET16 */
+
+#endif /* defined(GLIDE_DEBUG) */
+
+#if defined( GLIDE_DEBUG ) && ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 
+
+extern char *regNames[];
+
+static FxU32 thisMask;
+static FxU32 thisWrite;
+static FxU32 maxWrites;
+
+void GR_CDECL
+_GR_SET_GW_CMD( volatile void *addr, unsigned long data ) {
+    GR_DCL_GC;
+
+    /* validate pointer range */
+    {
+        FxU32 min = (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoVirt;
+        FxU32 max = min + (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoMax;
+        if ( ((FxU32)addr) < min || ((FxU32)addr) > max ) {
+            GDBG_ERROR( "SET GW CMD", 
+                        "Fifo address 0x%x out of range(0x%x, 0x%x)\n",
+                        addr, 
+                        gc->fifoData.hwDep.vg96FIFOData.fifoVirt,
+                        gc->fifoData.hwDep.vg96FIFOData.fifoMax );
+        }
+                    
+    }
+    /* validate alignment */
+    if ( ((FxU32)addr) & 0x7 ) {
+        GDBG_ERROR( "SET GW CMD",
+                    "Fifo address 0x%x is not 8 byte aligned\n",
+                    addr );
+    }
+    /* validate enable bit */
+    if ( ! (data&0x80000000) ) { 
+        GDBG_ERROR( "SET GW CMD",
+                    "Fifo command 0x%x missing flag bit\n",
+                    data );
+    }
+    /* validate reserved bits */
+    if ( data&0x7fE00300 ) { 
+        GDBG_ERROR( "SET GW CMD",
+                    "Fifo command 0x%x reserved bits set!\n",
+                    data );
+    }
+
+    GDBG_INFO((128, 
+               "Writing Group Write Command: 0x%x\n",
+               data ));
+    GDBG_INFO((128, 
+               "  FIFO ADDR: 0x%.08x\n", addr ));
+    /* dump chip field */
+    {
+        FxU32 field = ( (data<<2) & 0xf0000 ) >> 16;
+        GDBG_INFO((128, "  Chip Field: 0x%x\n", field ));
+    } 
+    /* dump wrap field */
+    {
+        FxU32 field = ( (data<<2) & 0x0f000 ) >> 12;
+        GDBG_INFO((128, "  Wrap Field: 0x%x\n", field ));
+    }
+    /* dump register */
+    {
+        FxU32 reg = ( data & 0xff );
+        GDBG_INFO((128, "  Register:   %s(0x%x)\n", regNames[reg], reg ));
+    }
+    *(FxU32*)addr = data;
+}
+
+void GR_CDECL
+_GR_SET_GW_HEADER( volatile void *addr, unsigned long data ) {
+  GR_DCL_GC;
+
+  /* validate pointer range */
+  {
+    FxU32 min = (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoVirt;
+    FxU32 max = min + (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoMax;
+    if ( ((FxU32)addr) < min || ((FxU32)addr) > max ) {
+      GDBG_ERROR( "SET GW CMD", 
+                 "Fifo address 0x%x out of range(0x%x, 0x%x)\n",
+                 addr, 
+                 gc->fifoData.hwDep.vg96FIFOData.fifoVirt,
+                 gc->fifoData.hwDep.vg96FIFOData.fifoMax );
+    }
+                    
+  }
+  /* validate alignment */
+  if ( ((FxU32)addr) & 0x3 ) {
+    GDBG_ERROR( "SET GW HEADER",
+               "Fifo address 0x%x is not DWORD aligned\n",
+               addr );
+  }
+  GDBG_INFO((128, 
+             "Writing Group Write Header: 0x%x\n",
+             data ));
+  GDBG_INFO((128, 
+             "  FIFO ADDR: 0x%.08x\n", addr ));
+  /* validate bits - at least one must be set*/
+  {
+    FxU32 val, bits, reg;
+    val = data;
+    bits = 0;
+    reg  = 2;
+    while( val ) {
+      if ( val & 1 ) {
+        bits++;
+        GDBG_INFO((128, "  Register: %s\n", regNames[reg] ));
+      }
+      val>>=1;
+      reg++;
+    }
+    GR_ASSERT( bits );
+    GDBG_INFO((128, "  --------------\n" ));
+    GDBG_INFO((128, "  Total Bits: %d\n", bits ));
+    maxWrites = bits;
+    if ( maxWrites & 1 ) maxWrites++;
+  }
+  *(FxU32*)addr = data;
+  thisMask  = data;
+  thisWrite = 0;
+}
+
+void GR_CDECL
+_GR_SET_GW_ENTRY( volatile void *addr, unsigned long data ) {
+  GR_DCL_GC;
+  /* validate pointer range */
+  {
+    FxU32 min = (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoVirt;
+    FxU32 max = min + (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoMax;
+    if ( ((FxU32)addr) < min || ((FxU32)addr) > max ) {
+      GDBG_ERROR( "SET GW CMD", 
+                 "Fifo address 0x%x out of range(0x%x, 0x%x)\n",
+                 addr, 
+                 gc->fifoData.hwDep.vg96FIFOData.fifoVirt,
+                 gc->fifoData.hwDep.vg96FIFOData.fifoMax );
+    }
+                    
+  }
+  /* validate alignment */
+  if ( ((FxU32)addr) & 0x3 ) {
+    GDBG_ERROR( "SET GW ENTRY",
+               "Fifo address 0x%x is not DWORD aligned\n",
+               addr );
+  }
+  /* validate write within packet */
+  if ( !thisMask || thisWrite > maxWrites ) {
+    GDBG_ERROR( "SET GW ENTRY",
+               "Group write entry attempted outside of a packet\n" );
+  }   
+  GDBG_INFO((128, 
+             "Writing Group Write Entry\n" ));
+  GDBG_INFO((128, 
+             "  FIFO ADDR: 0x%.08x\n", addr ));
+  /* decode write */
+  {
+    FxU32 reg, bit, write;
+    reg   = 2;
+    bit   = 1;
+    write = 0;
+        
+    while( bit ) {
+      if ( bit & thisMask ) {
+        if ( write == thisWrite ) break;
+        write++;
+      }
+      bit <<= 1;
+      reg++;
+    }
+        
+    if ( bit ) {
+      GDBG_INFO((128, 
+                 "  REG: %s DATA: 0x%x(%f)\n",
+                 regNames[reg],
+                 data,
+                 *(float*)&data ));
+    } else {
+      GDBG_INFO((128, 
+                 "  PADDING\n" ));
+    }
+  }
+  *(FxU32*)addr = data;
+  thisWrite++;
+}
+
+#endif /* defined( GLIDE_DEBUG) && ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) */
+
Index: trunk/src/opengl/glide/sst1/glide/gsplash.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gsplash.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gsplash.c	(revision 2885)
@@ -0,0 +1,899 @@
+/*
+ ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ ** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ ** 
+ ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ ** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ ** THE UNITED STATES.  
+ ** 
+ ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+ **
+ ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gsplash.c,v 1.1 2000-02-25 00:31:17 sandervl Exp $
+ ** $Log: gsplash.c,v $
+ ** Revision 1.1  2000-02-25 00:31:17  sandervl
+ ** Created new Voodoo 1 Glide dir
+ **
+ * 
+ * 14    12/19/97 8:09a Peter
+ * fog table propogation
+ * 
+ * 13    7/07/97 3:05p Dow
+ * Moved fouled clears
+ * 
+ * 12    3/18/97 9:07p Dow
+ * Got rid of #$#%#$ // comments
+ * 
+ * 11    3/16/97 12:42a Jdt
+ * Removed watcom warning
+ * 
+ * 10    3/13/97 10:53p Jdt
+ * Rewrote with simple optimizations.  Changed prototype for
+ * multi-resolution, and running as a better shameless plug.
+ * 
+ * 9     3/13/97 2:52a Jdt
+ * Added arguments to splash.
+ * 
+ * 8     3/09/97 10:31a Dow
+ * Added GR_DIENTRY for di glide functions
+ * 
+ * 7     3/01/97 6:24p Jdt
+ * Made splash force yorigin.
+ * 
+ * 6     1/02/97 1:06p Dow
+ * Fixed state bug
+ * 
+ * 3     11/17/96 11:16p Garymct
+ * Updated grSplash code to set all of the necessary state itself rather
+ * than expecting the caller to do so.
+ */
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+
+#include "fxglide.h"
+#include "fxinline.h"
+
+#include <math.h>
+
+/*-----------------------------
+  Constants
+  -----------------------------*/
+#define MAX_NUM_VERTS 2556
+
+#define FADEIN_END_PERCENT ( 0.3f )
+#define FADEOUT_BEGIN_PERCENT ( 0.8f )
+
+#define SPIN_FRAMES 25
+#define SPIN_START  26
+
+#define NO_TABLE ((GrTexTable_t)(~0))
+
+/*-----------------------------
+  Macros
+  -----------------------------*/
+#define SNAP_BIAS     ((float)(3<<18))
+#define SNAP_COORD(X) ((X)+SNAP_BIAS)
+
+/*-----------------------------
+  Types
+  -----------------------------*/
+typedef struct {
+  float x, y, z;                /* object space coordinates */
+  float nx, ny, nz;             /* object space vertex normal for lighting */
+  float s, t;                   /* pre-glide-ified texture coordinates */
+} Vert;
+
+typedef struct {
+  int v[3];                     /* vertex indices into array of vertes for face */
+  int mat_index;                /* material index */
+  int aa_edge_flags;
+} Face;
+
+typedef float Vector[3];
+typedef float Matrix[16];
+
+typedef FxU32 Palette[256];
+typedef struct {
+  FxU8  yRGB[16];
+  FxI16 iRGB[4][3];
+  FxI16 qRGB[4][3];
+  FxU32 packed_data[12];
+} NCCTable;
+typedef union {
+  Palette  palette;
+  NCCTable nccTable;
+} TextureTable;
+
+/*-----------------------------
+  Globals
+  -----------------------------*/
+/* xScale, xOffset, yScale, yOffset */
+static float viewPort[4] = { 
+  480.0f, 320.0f, 
+  480.0f, 240.0f 
+};
+
+typedef struct {
+  GrTexInfo    info;
+  FxU32        addr;
+  GrTexTable_t tableType;
+  TextureTable tableData;
+} Texture;
+
+static int do_phong = 0;
+static int pass;
+static int fog;
+static int useTextures;
+static Vector light = { -0.57735f, -0.57735f, -0.57735f };
+static Vector transformed_verts[MAX_NUM_VERTS];
+static Vector transformed_norms[MAX_NUM_VERTS];
+
+#include "splshdat.c"
+
+static Texture textImage;
+static Texture hiliteImage;
+static Texture shadowImage;
+
+static FxU32 nextFreeBase;
+
+/*-----------------------------
+  Privates
+  -----------------------------*/
+static void sourceTexture( Texture *texture ) {
+  static Texture *lastTexture;
+
+  if ( texture != lastTexture && useTextures ) {
+    grTexSource( GR_TMU0,
+                texture->addr,
+                GR_MIPMAPLEVELMASK_BOTH,
+                &texture->info );
+    if ( texture->tableType != NO_TABLE ) {
+      grTexDownloadTable( GR_TMU0,
+                         texture->tableType,
+                         &texture->tableData );
+    }
+    lastTexture = texture;
+  }
+}
+
+static GrTexTable_t texTableType( GrTextureFormat_t format ) {
+  GrTexTable_t rv = (GrTexTable_t)NO_TABLE;
+  switch( format ) {
+  case GR_TEXFMT_YIQ_422:
+  case GR_TEXFMT_AYIQ_8422:
+    rv = GR_TEXTABLE_NCC0;
+    break;
+  case GR_TEXFMT_P_8:
+  case GR_TEXFMT_AP_88:
+    rv = GR_TEXTABLE_PALETTE;
+    break;
+  }
+  return rv;
+}
+
+static void downloadTexture( Texture *texture, Gu3dfInfo *info ) {
+  texture->info.data        = info->data;
+  texture->info.smallLod    = info->header.small_lod;
+  texture->info.largeLod    = info->header.large_lod;
+  texture->info.aspectRatio = info->header.aspect_ratio;
+  texture->info.format      = info->header.format;
+
+  texture->addr = nextFreeBase;
+  nextFreeBase += grTexTextureMemRequired( GR_MIPMAPLEVELMASK_BOTH,
+                                          &texture->info );
+  grTexDownloadMipMap( GR_TMU0,
+                      texture->addr,
+                      GR_MIPMAPLEVELMASK_BOTH,
+                      &texture->info );
+
+  texture->tableType = texTableType( info->header.format );
+  switch( texture->tableType ) {
+  case GR_TEXTABLE_NCC0:
+  case GR_TEXTABLE_NCC1:
+  case GR_TEXTABLE_PALETTE:
+    texture->tableData = *(TextureTable*)(&info->table);
+    break;
+  default:
+    break;
+  }
+
+  return;
+}
+
+static void createTextures( void ) {
+  Gu3dfInfo *info;
+
+  /*
+   * Download the texture for the "3D" part of the model.
+   */
+  info       = ( Gu3dfInfo * )text_3dfinfo_raw;
+  info->data = ( void * )text_3dfinfo_image;
+
+  downloadTexture( &textImage, info );
+
+  /*
+   * Download the texture for the specular highlight.
+   */
+  info       = ( Gu3dfInfo * )hilite_3dfinfo_raw;
+  info->data = ( void * )hilite_3dfinfo_image;
+  downloadTexture( &hiliteImage, info );
+
+  /*
+   * Download the texture for the shadow.
+   */
+  info       = ( Gu3dfInfo * )shadow_3dfinfo_raw;
+  info->data = ( void * )shadow_3dfinfo_image;
+  downloadTexture( &shadowImage, info );
+  return;
+}
+
+static void vecMatMult( float *dstVec, float *srcVec, float *matrix ) {
+  dstVec[0] = 
+    srcVec[0] * matrix[0] +
+      srcVec[1] * matrix[4] +
+        srcVec[2] * matrix[8] +
+          matrix[12];
+    
+  dstVec[1] = 
+    srcVec[0] * matrix[1] +
+      srcVec[1] * matrix[5] +
+        srcVec[2] * matrix[9] +
+          matrix[13];
+    
+  dstVec[2] = 
+    srcVec[0] * matrix[2] +
+      srcVec[1] * matrix[6] +
+        srcVec[2] * matrix[10] +
+          matrix[14];
+}
+
+static void normMatMult( float *dstVec, float *srcVec, float *matrix ) {
+  dstVec[0] = 
+    srcVec[0] * matrix[0] +
+      srcVec[1] * matrix[4] +
+        srcVec[2] * matrix[8];
+    
+  dstVec[1] = 
+    srcVec[0] * matrix[1] +
+      srcVec[1] * matrix[5] +
+        srcVec[2] * matrix[9];
+    
+  dstVec[2] = 
+    srcVec[0] * matrix[2] +
+      srcVec[1] * matrix[6] +
+        srcVec[2] * matrix[10];
+}
+
+static void xfAndProj( int frame, int obj ) {
+  int    vertex;
+  float *matrix;
+
+  matrix = &mat[frame][obj][0];
+
+  for( vertex = 0; vertex < num_verts[obj]; vertex++ ) {
+    float *srcVec;
+    float *dstVec;
+    float oow;
+
+    /* transform point */
+    srcVec = (float*)&(vert[obj][vertex].x);
+    dstVec = (float*)transformed_verts[vertex];
+    vecMatMult( dstVec, srcVec, matrix );
+
+    /* project point */
+    oow = 1.0f / dstVec[2];
+    dstVec[0] = dstVec[0] * oow * viewPort[0] + viewPort[1] + SNAP_BIAS;
+    dstVec[1] = dstVec[1] * oow * viewPort[2] + viewPort[3] + SNAP_BIAS;
+
+    /* transform normal */
+    srcVec = (float*)&(vert[obj][vertex].nx);
+    dstVec = (float*)transformed_norms[vertex];
+    normMatMult( dstVec, srcVec, matrix );
+  }
+}
+
+static void setupMaterial( int material_index ) {  
+  switch( material_index ) {
+  case 0:                       /* 3d */
+    if( pass == 1 ) {
+      sourceTexture( &textImage );
+      grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,
+                     GR_COMBINE_FACTOR_LOCAL,
+                     GR_COMBINE_LOCAL_ITERATED,
+                     GR_COMBINE_OTHER_TEXTURE,
+                     FXFALSE );
+      do_phong = 1;
+    } else if ( pass == 0xbeef ) {
+      /* Pantone 320C - 3D Green */
+      grConstantColorValue( 0x00989100 );
+      grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,
+                     GR_COMBINE_FACTOR_LOCAL,
+                     GR_COMBINE_LOCAL_CONSTANT,
+                     GR_COMBINE_OTHER_ITERATED,
+                     FXFALSE );
+    } else {
+      sourceTexture( &hiliteImage );
+      grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,
+                     GR_COMBINE_FACTOR_ONE,
+                     GR_COMBINE_LOCAL_NONE,
+                     GR_COMBINE_OTHER_TEXTURE,
+                     FXFALSE );
+    } 
+    break;
+  case 1:                       /* fx */
+    if ( pass == 0xbeef ) {
+      /* Black - fx */
+      grConstantColorValue( 0x00 );
+      grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,
+                     GR_COMBINE_FACTOR_LOCAL,
+                     GR_COMBINE_LOCAL_CONSTANT,
+                     GR_COMBINE_OTHER_ITERATED,
+                     FXFALSE );
+      do_phong = 1;
+    } else {
+      sourceTexture( &hiliteImage );
+      grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,
+                     GR_COMBINE_FACTOR_ONE,
+                     GR_COMBINE_LOCAL_NONE,
+                     GR_COMBINE_OTHER_TEXTURE,
+                     FXFALSE );
+      do_phong = 1;
+    }
+    break;
+  case 2:
+  case 3:
+  case 4:
+    grColorCombine( GR_COMBINE_FUNCTION_LOCAL,
+                   GR_COMBINE_FACTOR_NONE,
+                   GR_COMBINE_LOCAL_ITERATED,
+                   GR_COMBINE_OTHER_NONE,
+                   FXFALSE );
+    do_phong = 0;
+    break;
+  }
+  return;
+}
+
+static void calculateIntensity( int material_index, 
+				Vector intensity_factor, 
+				int frame ) {
+  switch( material_index ) {
+  case 0:
+    /* 3d */
+    intensity_factor[0] = 1.0f;
+    intensity_factor[1] = 1.0f;
+    intensity_factor[2] = 1.0f;
+    break;
+  case 1:
+    /* fx */
+    intensity_factor[0] = 0.125f;
+    intensity_factor[1] = 0.125f;
+    intensity_factor[2] = 0.125f;
+    break;
+  case 2:
+    /* cyan */
+    intensity_factor[0] = ( 10.0f / 255.0f );
+    intensity_factor[1] = ( 75.0f / 255.0f );
+    intensity_factor[2] = ( 120.0f / 255.0f );
+    break;
+  case 3:
+    /* white */
+    intensity_factor[0] = 1.0f;
+    intensity_factor[1] = 1.0f;
+    intensity_factor[2] = 1.0f;
+    break;
+  case 4:
+    /* yellow */
+    intensity_factor[0] = ( 248.0f / 255.0f );
+    intensity_factor[1] = ( 204.0f / 255.0f );
+    intensity_factor[2] = 0.0f;
+    break;
+  }
+}
+
+static void drawFaces( int frame, int objnum ) {
+  int facenum;
+  int material_index;
+  float intensity_factor[3];
+  GrVertex gvert[3];
+  static int prev_mat_index = 0xffff;
+  int i;
+  FxBool aa_a, aa_b, aa_c;
+    
+  for( facenum = 0; facenum < num_faces[objnum]; facenum++ )  {
+    material_index = face[objnum][facenum].mat_index;
+    if( material_index != prev_mat_index )  {
+      setupMaterial( material_index );
+      calculateIntensity( material_index,
+                         intensity_factor, frame );
+      prev_mat_index = material_index;
+    }
+        
+    if( ( material_index != 0 ) && ( pass == 2 ) )
+      continue;
+          
+    aa_a = aa_b = aa_c = FXFALSE;
+    if( face[objnum][facenum].aa_edge_flags & 4 )
+      aa_a = FXTRUE;
+    if( face[objnum][facenum].aa_edge_flags & 2 )
+      aa_b = FXTRUE;
+    if( face[objnum][facenum].aa_edge_flags & 1 )
+      aa_c = FXTRUE;
+        
+    for( i = 0; i < 3; i++ ) {
+      float *transformed_vert, *transformed_norm;
+      Vert *v;
+      int vertnum;
+      float factor;
+            
+      vertnum = face[objnum][facenum].v[i];
+      transformed_vert = transformed_verts[vertnum];
+      transformed_norm = transformed_norms[vertnum];
+      v = &vert[objnum][vertnum];
+            
+      gvert[i].x = transformed_vert[0];
+      gvert[i].y = transformed_vert[1];
+      gvert[i].oow = 1.0f / transformed_vert[2];
+      gvert[i].tmuvtx[0].oow = gvert[i].oow;
+      gvert[i].tmuvtx[0].sow = v->s * gvert[i].oow;
+      gvert[i].tmuvtx[0].tow = v->t * gvert[i].oow;
+            
+      factor = 
+        ( ( light[0] * transformed_norm[0] + 
+           light[1] * transformed_norm[1] + 
+           light[2] * transformed_norm[2] ) + 1.0f ) * 127.5f;
+
+      gvert[i].r = factor * intensity_factor[0];
+      gvert[i].g = factor * intensity_factor[1];
+      gvert[i].b = factor * intensity_factor[2];
+      gvert[i].a = 255.0f;
+    }
+        
+    if( pass == 2 ) {
+      for( i = 0; i < 3; i++ ) {
+        float *transformed_norm;
+                
+        transformed_norm = 
+          transformed_norms[face[objnum][facenum].v[i]];
+                
+        gvert[i].tmuvtx[0].sow = gvert[i].oow * 
+          ( 128.0f + transformed_norm[0] * 128.0f );
+        gvert[i].tmuvtx[0].tow = gvert[i].oow * 
+          ( 128.0f + transformed_norm[1] * 128.0f );
+                
+        gvert[i].r = intensity_factor[0] * 255.0f;
+        gvert[i].g = intensity_factor[1] * 255.0f;
+        gvert[i].b = intensity_factor[2] * 255.0f;
+      }                 
+            
+      grDrawTriangle( &gvert[0], &gvert[1], &gvert[2] );
+            
+      continue;
+    }
+        
+    grAlphaBlendFunction( GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA, 
+                         GR_BLEND_ONE, GR_BLEND_ZERO );
+    /* Do this if 3D. */
+    if( material_index == 0 ) {
+      /*
+       * Draw the textured 3D without specular. 
+       */
+      sourceTexture( &textImage );
+#if 0
+      grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,
+                     GR_COMBINE_FACTOR_LOCAL,
+                     GR_COMBINE_LOCAL_ITERATED,
+                     GR_COMBINE_OTHER_TEXTURE,
+                     FXFALSE );
+#endif
+      grAADrawTriangle( &gvert[0], &gvert[1], &gvert[2], 
+                       aa_a, aa_b, aa_c );
+    } else if( material_index != 1 ) {
+      /*
+       * Just go ahead and draw for things that don't
+       * have specular highlights.
+       */
+      grAADrawTriangle( &gvert[0], &gvert[1], &gvert[2],
+                       aa_a, aa_b, aa_c );
+    }
+        
+    if( do_phong && ( material_index != 0 ) ) {
+      /* 
+       * figure out texture coords in [0..255.0f] based on the normal
+       * the specular highlight.
+       */
+      for( i = 0; i < 3; i++ ) {
+        float *transformed_norm;
+                
+        transformed_norm = 
+          transformed_norms[face[objnum][facenum].v[i]];
+                
+        gvert[i].tmuvtx[0].sow = gvert[i].oow * 
+          ( 128.0f + transformed_norm[0] * 128.0f );
+        gvert[i].tmuvtx[0].tow = gvert[i].oow * 
+          ( 128.0f + transformed_norm[1] * 128.0f );
+                
+        gvert[i].r = intensity_factor[0] * 255.0f;
+        gvert[i].g = intensity_factor[1] * 255.0f;
+        gvert[i].b = intensity_factor[2] * 255.0f;
+      }                 
+      grAADrawTriangle( &gvert[0], &gvert[1], &gvert[2], 
+                       aa_a, aa_b, aa_c );
+    }
+  }
+}
+
+static void intersectLineWithZPlane( Vector result, Vector p1, 
+                                    Vector p2, float z ) {
+  float t;
+  
+  t = ( z - p1[2] ) / ( p2[2] - p1[2] );
+  result[0] = p1[0] + ( p2[0] - p1[0] ) * t;
+  result[1] = p1[1] + ( p2[1] - p1[1] ) * t;
+  result[2] = z;
+}
+
+static float vectorMag( float *v ) {
+  return ( float )sqrt( v[0] * v[0] + v[1] * v[1] + v[2] * v[2] );
+}
+
+static void drawShadow( int frame, int shadow_object_index, 
+                       int receiver_object_index, Vector light_position ) {
+  float *shadow_object_matrix;
+  float *receiver_object_matrix;
+  Vector view_verts[4];
+  Vector projected_view_verts[4];
+  int i;
+  
+  Vector local_verts[4] = {
+    { -280.0f, 0.0f, -160.0f },
+    { -280.0f, 0.0f,  150.0f },
+    {  280.0f, 0.0f,  150.0f },
+    {  280.0f, 0.0f, -160.0f } 
+  };
+  
+  float texcoords[4][2] = {
+    {  10.5f, 127.5f },
+    {  10.5f,   0.5f },
+    { 255.0f,   0.5f },
+    { 255.0f, 127.5f }
+  };
+  
+  GrVertex gvert[4];
+  GrVertex projected_gvert[4];
+  GrVertex light_gvert;
+  
+  /*
+   * The point relative to the back part of the shield that 
+   * the shadow is going to be projected onto.
+   */
+  Vector shadow_light;
+  
+  shadow_light[0] = light_position[0];
+  shadow_light[1] = light_position[1];
+  shadow_light[2] = light_position[2];
+  
+  shadow_object_matrix   = &mat[frame][shadow_object_index][0];
+  receiver_object_matrix = &mat[frame][receiver_object_index][0];
+  
+  /*
+   * Offset the light by the Z position of 
+   * the backplane that we are projected
+   * onto.
+   */
+  shadow_light[2] += receiver_object_matrix[14];
+  
+  for( i = 0; i < 4; i++ ) {
+    vecMatMult( view_verts[i], local_verts[i], shadow_object_matrix );
+        
+    /*
+     * project . . . 
+     */
+    gvert[i].oow = 1.0f / view_verts[i][2];
+    gvert[i].x = 
+      view_verts[i][0] * gvert[i].oow * viewPort[0] + 
+        viewPort[1] + SNAP_BIAS;
+    gvert[i].y = 
+      view_verts[i][1] * gvert[i].oow * viewPort[2] + 
+        viewPort[3] + SNAP_BIAS;
+        
+    /*
+     * Set up texture coordinates.
+     */
+    gvert[i].tmuvtx[0].sow = texcoords[i][0] * gvert[i].oow;
+    gvert[i].tmuvtx[0].tow = texcoords[i][1] * gvert[i].oow;
+  }
+  
+  
+  /*
+   * Intersect each line formed by the light source and a
+   * particular corner of the shadow object with the 
+   * plane which the texture is to be projected onto.
+   */
+  for( i = 0; i < 4; i++ ) {
+    Vector tmpvect;
+    float q;
+        
+    intersectLineWithZPlane( projected_view_verts[i], 
+                            shadow_light, 
+                            view_verts[i], 
+                            receiver_object_matrix[14] - 26.0f );
+    projected_gvert[i].oow = 1.0f / projected_view_verts[i][2];
+    projected_gvert[i].x = 
+      projected_view_verts[i][0] * projected_gvert[i].oow * viewPort[0] +
+        viewPort[1] + SNAP_BIAS;
+    projected_gvert[i].y = 
+      projected_view_verts[i][1] * projected_gvert[i].oow * viewPort[2] +
+        viewPort[3] + SNAP_BIAS;
+        
+    tmpvect[0] = projected_view_verts[i][0] - shadow_light[0];
+    tmpvect[1] = projected_view_verts[i][1] - shadow_light[1];
+    tmpvect[2] = projected_view_verts[i][2] - shadow_light[2];
+    q = vectorMag( tmpvect );
+        
+    /*
+     * Set up texture coordinates.
+     */
+    projected_gvert[i].tmuvtx[0].oow = projected_gvert[i].oow * q;
+    projected_gvert[i].tmuvtx[0].sow = 
+      texcoords[i][0] * projected_gvert[i].oow;
+    projected_gvert[i].tmuvtx[0].tow = 
+      texcoords[i][1] * projected_gvert[i].oow;
+  }
+  
+  light_gvert.oow = 1.0f / shadow_light[2];
+  light_gvert.x = shadow_light[0] * light_gvert.oow * viewPort[0] + 
+    viewPort[1] + SNAP_BIAS;
+  light_gvert.y = shadow_light[1] * light_gvert.oow * viewPort[2] + 
+    viewPort[3] + SNAP_BIAS;
+  
+  /*
+   * Draw a segment between the light and the point which hits
+   * the surface that the light is being projected onto.
+   */
+  grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,
+                 GR_COMBINE_FACTOR_ONE,
+                 GR_COMBINE_LOCAL_NONE,
+                 GR_COMBINE_OTHER_TEXTURE,
+                 FXFALSE );
+  sourceTexture( &shadowImage );
+  
+  grAlphaBlendFunction( GR_BLEND_DST_COLOR, GR_BLEND_ZERO,
+                       GR_BLEND_ONE, GR_BLEND_ZERO );
+  
+  
+  grDrawTriangle( &projected_gvert[0], 
+                 &projected_gvert[1], 
+                 &projected_gvert[2] );
+  grDrawTriangle( &projected_gvert[0], 
+                 &projected_gvert[2], 
+                 &projected_gvert[3] );
+  grDrawTriangle( &projected_gvert[0], 
+                 &projected_gvert[2], 
+                 &projected_gvert[1] );
+  grDrawTriangle( &projected_gvert[0], 
+                 &projected_gvert[3], 
+                 &projected_gvert[2] );
+  
+  grAlphaBlendFunction( GR_BLEND_ONE, GR_BLEND_ZERO,
+                       GR_BLEND_ONE, GR_BLEND_ZERO );
+  
+}
+
+
+/*-------------------------------------------------------------------
+  Function: grSplash
+  Date: 3/13
+  Implementor(s): GaryMcT
+  Library: Glide
+  Description:
+  Render the opening splash screen animation, or render
+  a single frame of the splash screen.
+  Arguments:
+  x, y - upper left hand coord of window
+  w, h - width and height of window to render
+  _frame - frame number to render ( ~0 to render all frames )
+  Return:
+  none
+  -------------------------------------------------------------------*/
+GR_DIENTRY(grSplash,void,(float x,float y,float w,float h,FxU32 _frame))
+{
+  GrState oldState;
+  int frame;
+  Vector lights[] = {
+    { 5.0f, 300.0f, -1500.0f },
+    { 5.0f, 150.0f, -1000.0f },
+    { -30.0f, 150.0f, -1000.0f },
+    { -30.0f, 100.0f, -1000.0f },
+    { 30.0f, 70.0f, -1000.0f },
+  };
+  GrFog_t fogTable[kInternalFogTableEntryCount];
+  int fadeInFrames, fadeOutFrames;
+
+  GR_BEGIN_NOFIFOCHECK( "grSplash", 85 );
+  GDBG_INFO_MORE((gc->myLevel,"(%f,%f,%f,%f,%d)\n",
+                  x, y, w, h, _frame ));
+
+  /* Check Screen Dimensions and Check Avail of Depth Buffer */
+  if ( (x > gc->state.screen_width) || 
+      ((x+w) > gc->state.screen_width) ||
+      ( y > gc->state.screen_height ) ||
+      ((y+h) > gc->state.screen_height ) ) 
+    return;
+  if ( gc->state.screen_height == 640 ) {
+    if ( gc->fbuf_size == 1 ) {
+      return;
+    }
+  } else if ( gc->state.screen_width == 800 ) {
+    if ( ( gc->fbuf_size == 1 ) ||
+        ( gc->fbuf_size == 2 ) ) {
+      return;
+    }
+  }
+
+  if ( !(gc->state.fbi_config.fbzMode & SST_YORIGIN) ) {
+    y = (( gc->state.screen_height - 1.0f ) - (h-1.0f) ) - y;
+  }
+        
+  viewPort[0] = w *  ( 480.0f / 640.0f );
+  viewPort[1] = x + ( w / 2.0f );
+  viewPort[2] = h;
+  viewPort[3] = y + ( h / 2.0f );
+
+  grGlideGetState(&oldState);
+
+  grSstOrigin( GR_ORIGIN_LOWER_LEFT );
+
+  if ( _frame == 0 ) {
+    createTextures();
+    useTextures = 1;
+  } else {
+    useTextures = 0;
+  }
+
+  grAlphaTestFunction( GR_CMP_ALWAYS );
+  grChromakeyMode( GR_CHROMAKEY_DISABLE );
+  grConstantColorValue( 0xffffffff );
+  grDepthBufferMode( GR_DEPTHBUFFER_WBUFFER );
+  grDepthMask( FXTRUE );
+  grAlphaCombine( GR_COMBINE_FUNCTION_LOCAL,
+                 GR_COMBINE_FACTOR_NONE,
+                 GR_COMBINE_LOCAL_ITERATED,
+                 GR_COMBINE_OTHER_NONE,
+                 FXFALSE );
+  grAlphaBlendFunction( GR_BLEND_ONE, GR_BLEND_ZERO,
+                       GR_BLEND_ONE, GR_BLEND_ZERO );
+  if ( useTextures )
+    grTexCombine( GR_TMU0, 
+                 GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
+                 GR_COMBINE_FUNCTION_NONE, GR_COMBINE_FACTOR_NONE,
+                 FXFALSE, FXFALSE );
+  else
+    grTexCombine( GR_TMU0,
+                 GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE,
+                 GR_COMBINE_FUNCTION_NONE, GR_COMBINE_FACTOR_NONE,
+                 FXTRUE, FXFALSE );
+  grTexMipMapMode( GR_TMU0,
+                  GR_MIPMAP_NEAREST,
+                  FXFALSE );
+  grTexFilterMode( GR_TMU0,
+                  GR_TEXTUREFILTER_BILINEAR,
+                  GR_TEXTUREFILTER_BILINEAR );
+  grDepthBufferFunction( GR_CMP_LEQUAL );
+  grCullMode( GR_CULL_NEGATIVE );
+  //    grClipWindow( (int)x, (int)y, (int)(x+w), (int)(y+h) );
+  grFogColorValue( 0x0 );
+  
+  fadeInFrames  = (int)(((float)total_num_frames) * FADEIN_END_PERCENT);
+  fadeOutFrames = (int)(((float)total_num_frames) * 
+                        (1.0f - FADEOUT_BEGIN_PERCENT));
+
+  if ( _frame == 0 ) {          /* Render Whole Animation */
+    for( frame = 1; frame < total_num_frames; frame++ ) {
+      int i;
+            
+      /* Set Fog Value For This Frame */
+      if( frame < fadeInFrames )  {
+        unsigned char fval = 
+          ((unsigned char)255) - 
+            ((unsigned char)( 255.0f * 
+                             (float)(frame+1) / 
+                             (float)fadeInFrames ));
+        for( i = 0; i < kInternalFogTableEntryCount; i++ )
+          fogTable[i] = fval;
+        grFogMode( GR_FOG_WITH_TABLE );
+        grFogTable( fogTable );
+        fog = 1;
+      } else if( frame > total_num_frames-fadeOutFrames ) {
+        unsigned char fval = 
+          ((unsigned char)255) - 
+            (unsigned char)(255.0f*
+                            ((float)(total_num_frames-frame))/
+                            ((float)fadeOutFrames));
+        for( i = 0; i < kInternalFogTableEntryCount; i++ ) 
+          fogTable[i] = fval;
+        grFogMode( GR_FOG_WITH_TABLE );
+        grFogTable( fogTable );
+        fog = 1;
+      } else  {
+        grFogMode( GR_FOG_DISABLE );
+        fog = 0;
+      }
+      grBufferClear( 0x00000000, 0, GR_WDEPTHVALUE_FARTHEST );
+        
+      pass = 1;
+
+      /*
+       * Avoid Z-aliasing between the shield and the 3dfx by
+       * not writing Z for the shield.
+       */
+
+      grDepthMask( FXFALSE );
+      /* cyan part of shield */
+      xfAndProj( frame, 2 );
+      drawFaces( frame, 2 );
+      
+      /* yellow and white part of shield. */
+      xfAndProj( frame, 0 );
+      drawFaces( frame, 0 );
+
+      /*
+       * Reanable writes to the depth-buffer.
+       */
+      grDepthMask( FXTRUE );
+
+      /*
+       * Draw the shadow projected from the 3Dfx logo onto
+       * the rest of the powershield.
+       */
+      grDepthBufferFunction( GR_CMP_ALWAYS );
+      grFogMode( GR_FOG_DISABLE );
+      drawShadow( frame, 1, 0, lights[0] );
+      if ( fog ) grFogMode( GR_FOG_WITH_TABLE ); /* hack around mp fog */
+      grDepthBufferFunction( GR_CMP_LEQUAL );
+
+      /* 3Dfx logo */
+      xfAndProj( frame, 1 );
+      drawFaces( frame, 1 );
+      grAlphaBlendFunction( GR_BLEND_ONE, GR_BLEND_ONE,
+                           GR_BLEND_ONE, GR_BLEND_ZERO );
+
+      pass = 2;
+      drawFaces( frame, 1 );
+      pass = 1;
+      grAlphaBlendFunction( GR_BLEND_ONE, GR_BLEND_ZERO,
+                           GR_BLEND_ONE, GR_BLEND_ZERO );
+      grBufferSwap( 2 );
+    }
+  } else {                      /* Render One Frame */
+    frame = ((_frame>>1) % SPIN_FRAMES)+SPIN_START;
+        
+    grColorMask( FXFALSE, FXFALSE );
+    grBufferClear( 0x00000000, 0, GR_WDEPTHVALUE_FARTHEST );
+    grColorMask( FXTRUE, FXFALSE );
+        
+    pass = 0xbeef;
+        
+    /* 3Dfx logo */
+    xfAndProj( frame, 1 );
+    drawFaces( frame, 1 );
+  }
+    
+  /*
+   * Clean up after yourself!
+   */
+  grGlideSetState(&oldState);
+
+}
+
+
Index: trunk/src/opengl/glide/sst1/glide/gsst.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gsst.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gsst.c	(revision 2885)
@@ -0,0 +1,1426 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gsst.c,v 1.1 2000-02-25 00:31:17 sandervl Exp $
+** $Log: gsst.c,v $
+** Revision 1.1  2000-02-25 00:31:17  sandervl
+** Created new Voodoo 1 Glide dir
+**
+** 
+** 79    7/06/98 3:05p Peter
+** grSstWinOpen fails triple buffering
+** 
+** 78    6/04/98 12:13p Peter
+** splash dll rename
+** 
+** 77    3/16/98 3:20p Atai
+** fixed glide in a window bug. OEM DLL code bails out if res can not be
+** found
+** 
+** 76    3/02/98 10:42a Atai
+** remove oemvidtiming for DOS
+** 
+** 75    2/24/98 10:59a Atai
+** modify for oem dll
+** 
+** 74    2/23/98 11:03a Peter
+** 
+** 73    2/12/98 8:21p Pgj
+** 
+** 72    2/12/98 6:48p Atai
+** fix typo
+** 
+** 71    2/12/98 4:01p Atai
+** change refresh rate if oemdll updated for tv out
+ * 
+ * 70    1/12/98 10:25p Dow
+ * H3D Stereo Support
+ * 
+ * 69    1/06/98 3:44p Atai
+ * fixed tv out related stuff for dos build.
+ * 
+ * 68    12/19/97 11:04a Atai
+ * oeminit dll stuff
+ * 
+ * 67    12/19/97 10:23a Dow
+ * Splash Screen stuff
+ * 
+ * 66    12/03/97 9:36a Dow
+ * Fixed bug in grSstIsBusy()
+ * 
+ * 65    12/02/97 7:20p Dow
+ * Added code for new splash screen
+ * 
+ * 64    10/21/97 8:20p Atai
+ * added parameter for vid timing
+ * 
+ * 63    10/06/97 1:14p Atai
+ * fix bug 824. added sli resolution checking
+ * 
+ * 62    9/19/97 1:24p Peter
+ * more test27 fun
+ * 
+ * 61    9/11/97 1:33p Atai
+ * In grSstWinOpen(), checking (nColBuffers+nAuxBuffers) for
+ * GR_RESOLUTION_800x600 and GR_RESOLUTION_856x480
+ * 
+ * 60    9/10/97 10:13p Peter
+ * fifo logic from GaryT, non-normalized fp first cut
+ * 
+ * 59    9/07/97 12:25p Pgj
+ * 
+ * 58    9/07/97 12:14p Pgj
+ * fix bug 697
+ * 
+ * 57    8/19/97 8:55p Peter
+ * lots of stuff, hopefully no muckage
+ * 
+ * 56    7/09/97 10:18a Dow
+ * Further Nudge Of Love adjustments
+ * 
+ * 55    7/07/97 3:05p Dow
+ * Moved some state BEFORE splash screen
+ * 
+ * 54    6/26/97 3:09p Dow
+ * removed warning
+ * 
+ * 53    6/24/97 3:40p Dow
+ * Protected Nude of Love
+ * 
+ * 52    6/22/97 10:19a Dow
+ * Set cpuType filed inf fifoInfo before calling initEnableTransport
+ * 
+ * 51    6/21/97 1:05p Dow
+ * Made it use the NUDGE_OF_LOVE macro
+ * 
+ * 50    6/21/97 12:15p Dow
+ * Moved 128 DWORD nudge of love into grSstStatus()
+ * 
+ * 49    6/21/97 11:39a Dow
+ * Fixed debug assertion
+ * 
+ * 48    6/19/97 7:35p Dow
+ * More P6 Stuff
+ * 
+ * 47    6/11/97 5:30p Pgj
+ * fix bug 594 (grSstPerfStats() returns inaccurate data on SLI systems)
+ * 
+ * 46    6/05/97 11:15p Pgj
+ * 
+ * 45    5/30/97 8:53a Dow
+ * Protected int10Called set in grSstWinOpen
+ * 
+ * 44    5/28/97 2:11p Dow
+ * int10h handler
+ * 
+ * 43    5/27/97 2:03p Dow
+ * added check for new env variable
+ * 
+ * 42    5/22/97 11:25a Dow
+ * Fixed bogus polling for idle.
+ * 
+ * 41    5/21/97 9:52a Jdt
+ * Added grSstControl() implementation for SST-1.
+ * 
+ * 40    5/05/97 2:22p Dow
+ * Protected previous checkin with SST96 to avoid errors when compiling
+ * SST1
+ * 
+ * 39    5/05/97 1:35p Dow
+ * Changed grSstControl to modify clip1 instead of clip0
+ * 
+ * 38    5/04/97 12:48p Dow
+ * made grSstControl change clipLeftRight and clipBottomTop via direct
+ * writes.
+ * 
+ * 37    5/02/97 2:11p Pgj
+ * screen_width/height now FxU32
+ * 
+ * 36    4/15/97 12:59p Dow
+ * Fixed clipping problem
+ * 
+ * 35    4/13/97 8:11p Jdt
+ * Change in init.h
+ * 
+ * 34    4/13/97 2:06p Pgj
+ * eliminate all anonymous unions (use hwDep)
+ * 
+ * 33    3/20/97 2:18a Dow
+ * added a fixme
+ * 
+ * 32    3/19/97 10:43p Dow
+ * windowsInit stuff
+ * 
+ * 31    3/19/97 1:37a Jdt
+ * Added some stride computation
+ * 
+ * 30    3/18/97 9:55p Jdt
+ * Moved resolution guessing into init lib.
+ * 
+ * 29    3/17/97 6:28a Jdt
+ * Rewrite of grSstWinOpen with new init code in mind.
+ * 
+ * 28    3/16/97 12:39a Jdt
+ * Moved over to serialstatus stored in hwDep...
+ * 
+ * 27    3/14/97 2:36a Murali
+ * Removed printfs(), and GDBG_INFO won't work at this stage.
+ * 
+ * 26    3/13/97 11:02p Jdt
+ * Added new splash in.
+ * 
+ * 25    3/13/97 5:54a Murali
+ * Second set of changes for WinGlide.
+ * 
+ * 24    3/13/97 2:51a Jdt
+ * First step towards windowed splash
+ * 
+ * 23    3/05/97 2:18p Murali
+ * Preliminary changes for Glide in a window.
+ * 
+ * 22    3/04/97 9:08p Dow
+ * Neutered multiplatform multiheaded monster
+ * 
+ * 21    2/26/97 11:58a Jdt
+ * Fixed grsstopen and grSstorigin
+ * 
+ * 20    2/19/97 4:41p Dow
+ * Changed status read to use serial status on SST96
+ * 
+ * 19    2/14/97 12:55p Dow
+ * moved vg96 fifo wrap into init code
+ * 
+ * 18    1/14/97 10:48a Dow
+ * Modified grSstStatus to work w/ VG96
+ * Made grSstIdle work with either VG or VG96  (via Init HAL)
+ * 
+ * 17    12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+ * 
+ * 16    11/24/96 9:35a Tarolli
+ * it now calls sst1InitNumBoardsInSystem(); instead of doing the work
+ * itself
+ * 
+ * 15    11/15/96 4:05p Jdt
+ * Dllable for vg96
+**
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <3dfx.h>
+
+#include <glidesys.h>
+#include <sst1vid.h>
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) 
+#include <init.h>
+#endif
+
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
+#define WIN32_LEAN_AND_MEAN
+#include "oeminit.h"    /* NEVER used by DOS */
+#include <windows.h>
+#endif
+
+#if (GLIDE_PLATFORM & GLIDE_OS_DOS32) && (GLIDE_PLATFORM & GLIDE_HW_SST96) && defined(GLIDE_DEBUG)
+#include <dos.h>
+  /* int 10h interrupt handler */
+void __interrupt __far 
+_grInt10Handler() {
+#define FN_NAME "_grInt10Handler"
+  GR_DCL_GC;
+
+  gc->hwDep.sst96Dep.int10Called = FXTRUE;
+
+#undef FN_NAME
+} /* _grInt10Handler */
+#endif
+
+
+#ifdef H3D
+#include <windows.h>
+#define F_PATTERN 0             // flippy pattern (sst96)
+#define T_PATTERN 1             // tippy pattern (sst1)
+
+typedef struct patColor_t { unsigned char r,g,b; } patColor;
+
+#define PAT_BLACK   {0,0,0}
+#define PAT_RED     {255,0,0}
+#define PAT_GREEN   {0,255,0}
+#define PAT_YELLOW  {255,255,0}
+
+static h3dRez[]={240,300};
+#define H3DHEIGHT_FROM_REZ(r) (h3dRez[(r)-GR_RESOLUTION_AUTOFLIPPED_MIN])
+
+static GrState defstate; // default winopen state
+
+static patColor sigPattern[] = {        // signature color pattern
+  PAT_RED,PAT_RED,PAT_RED,PAT_RED,PAT_GREEN,PAT_YELLOW,PAT_YELLOW
+};
+
+static patColor disableColor[2] = {PAT_BLACK,PAT_BLACK}; // turn off adapter
+
+#if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
+static patColor enableColor[2] = {PAT_YELLOW,PAT_BLACK}; // use top and bottom mode 1
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+static patColor enableColor[2] = {PAT_GREEN,PAT_BLACK};  // use pageflip mode
+#endif
+static patColor enableColor2[2] = {PAT_YELLOW,PAT_GREEN}; // use top and bottom mode 2
+
+// TODO : get key value for tb mode 1/2
+static int getGetIntKeyValue(char * key) {
+//  RegCreateKeyEx();
+  return 1; // use mode 1
+};
+
+// TODO: should use _grSwizzleColor(...)
+static unsigned long patColorToGR(patColor clr, GrColorFormat_t fmt) {
+  switch (fmt) {
+  case GR_COLORFORMAT_ARGB:
+    return ((unsigned long)(255<<24)|(unsigned long)(clr.r<<16)|((unsigned long)clr.g<<8)|(clr.b));
+  case GR_COLORFORMAT_ABGR:
+    return ((unsigned long)(255<<24)|(unsigned long)(clr.b<<16)|((unsigned long)clr.g<<8)|(clr.r));
+  case GR_COLORFORMAT_RGBA:
+    return ((unsigned long)(clr.r<<24)|(unsigned long)(clr.g<<16)|((unsigned long)clr.b<<8)|(255));
+  case GR_COLORFORMAT_BGRA:
+    return ((unsigned long)(clr.b<<24)|(unsigned long)(clr.g<<16)|((unsigned long)clr.r<<8)|(255));
+  }
+}
+
+static void drawlinefb(GrVertex * lineLeft, GrVertex * lineRight) {
+  grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+  grDrawLine(lineLeft, lineRight);
+  grRenderBuffer(GR_BUFFER_BACKBUFFER);
+  grDrawLine(lineLeft, lineRight);
+}
+
+static void initState(void) {
+  grAlphaBlendFunction( GR_BLEND_ONE , GR_BLEND_ZERO, 
+                        GR_BLEND_ONE, GR_BLEND_ZERO );
+  grAlphaTestFunction( GR_CMP_ALWAYS );
+  grAlphaTestReferenceValue( 0 );
+  grChromakeyMode( GR_CHROMAKEY_DISABLE );
+  grConstantColorValue( ( FxU32 ) ~0 );
+  _grColorCombineDelta0Mode( FXFALSE );
+  grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
+                 GR_COMBINE_FACTOR_ONE,
+                 GR_COMBINE_LOCAL_ITERATED,
+                 GR_COMBINE_OTHER_ITERATED,
+                 FXFALSE);
+  grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
+                 GR_COMBINE_FACTOR_ONE,
+                 GR_COMBINE_LOCAL_NONE,
+                 GR_COMBINE_OTHER_CONSTANT,
+                 FXFALSE);
+  grColorMask( FXTRUE, FXFALSE );
+  grCullMode( GR_CULL_DISABLE );
+  grDepthBiasLevel( 0 );
+  grDepthMask( FXFALSE );
+  grDepthBufferMode( GR_DEPTHBUFFER_DISABLE );
+  grDepthBufferFunction( GR_CMP_ALWAYS );
+  grDepthBiasLevel( 0 );
+  grDitherMode( GR_DITHER_4x4 );
+  grFogMode( GR_FOG_DISABLE );
+  grFogColorValue( 0x00000000 );
+  grDisableAllEffects();
+}
+
+void setAutoflip(int enable) {
+  GrVertex lineLeft, lineRight;
+  GrState state;
+  int scrWidth = grSstScreenWidth();
+  int line;
+  MSG msg;
+  GrColorFormat_t format;
+  static firstupdate = 1;
+  extern void initAT3DSetTiles(FxU32 PageFlipping, FxU32 nBuffers);
+  GR_DCL_GC;
+
+  // wait for the window messages to flush
+  while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+    TranslateMessage(&msg);
+    DispatchMessage(&msg);
+  }
+
+  grGlideGetState(&state); // save the app. state
+
+  initState();
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+  if (firstupdate) {
+    initAT3DSetTiles(0,gc->state.num_buffers);
+    firstupdate = 0;
+  } /* TODO:: setup regs for non-pageflipping seems to fix fb alignment... */
+  if (enable) {
+    grSstIdle();
+    initAT3DSetTiles(1,gc->state.num_buffers);
+  } /* setup regs for pageflipping */
+#endif
+    
+  grDepthBufferFunction( GR_CMP_ALWAYS );
+  grDepthMask( FXFALSE );
+  
+  grColorCombine( GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
+                  GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_OTHER_NONE,
+                  FXFALSE );
+
+  format = state.color_format;
+  lineLeft.x = 0.f;
+  lineRight.x = (float)scrWidth-1;
+  lineLeft.z = lineRight.z = 0.f;
+  lineLeft.ooz = lineRight.ooz = 65535.f;
+#if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
+  lineLeft.y = lineRight.y = 2.f;
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+  lineLeft.y = lineRight.y = grSstScreenHeight() - H3DHEIGHT_FROM_REZ(gc->grSstRez) + 2.f;
+#endif
+  
+  grColorMask(FXTRUE,0);
+  grDepthBufferFunction( GR_CMP_ALWAYS );
+  grClipWindow(0,0,grSstScreenWidth(),grSstScreenHeight());
+  grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+  grBufferClear( 0x00, 0, GR_ZDEPTHVALUE_FARTHEST );
+
+  grRenderBuffer(GR_BUFFER_BACKBUFFER);
+  grBufferClear( 0x00, 0, GR_ZDEPTHVALUE_FARTHEST );
+
+
+  grBufferSwap(1);
+  grBufferClear( 0x00, 0, GR_ZDEPTHVALUE_FARTHEST );
+  grSstOrigin(GR_ORIGIN_UPPER_LEFT);
+
+  for (line = 0; line < 7; line++) {
+    grConstantColorValue( patColorToGR(sigPattern[line],format) );
+    drawlinefb(&lineLeft, &lineRight);
+    lineLeft.y = ++lineRight.y;
+    
+    grConstantColorValue( 0 );
+    drawlinefb(&lineLeft, &lineRight);
+    lineLeft.y = ++lineRight.y;
+  }
+  
+  for (line = 0; line < 2; line++) {
+    grConstantColorValue( patColorToGR(enable?(getGetIntKeyValue("\\SOFTWARE\\H3D\\TBMODE")==1?enableColor[line]:enableColor2[line]):disableColor[line],format) );
+    drawlinefb(&lineLeft, &lineRight);
+    lineLeft.y = ++lineRight.y;
+    
+    grConstantColorValue( 0 );
+    drawlinefb(&lineLeft, &lineRight);
+    lineLeft.y = ++lineRight.y;
+  }
+
+  // wait for adapter sync-up
+#if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
+  for(line = 40; line>0; line--) {
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+  for(line = 20; line>0; line--) {
+#endif
+    grBufferSwap(1);
+  }
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+  if (!enable) {
+    // grSstIdle();
+    initAT3DSetTiles(0,gc->state.num_buffers);
+  } // setup regs for non-pageflipping
+#endif
+
+  line = 50000;
+  while ((grBufferNumPending() > 2) && (--line));
+
+  grGlideSetState(&state);  // restore app. state
+
+  // restore 
+#if (GLIDE_PLATFORM & GLIDE_HW_SST1)
+  if (GR_RESOLUTION_IS_AUTOFLIPPED(gc->grSstRez)) {
+    if (enable==1) {
+      switch (gc->grSstRez) {
+      case GR_RESOLUTION_640x240_AUTOFLIPPED:
+        gc->state.screen_height = 502;
+        break;
+      case GR_RESOLUTION_800x300_AUTOFLIPPED:
+        gc->state.screen_height = 620;
+        break;
+      }
+    } else {
+      switch (gc->grSstRez) {
+      case GR_RESOLUTION_640x240_AUTOFLIPPED:
+        gc->state.screen_height = 480;
+      case GR_RESOLUTION_800x300_AUTOFLIPPED:
+        gc->state.screen_height = 600;
+      }
+    }
+    grClipWindow(0,0,grSstScreenWidth(),grSstScreenHeight());
+  }
+#endif
+}
+
+#endif
+
+/*-------------------------------------------------------------------
+  Function: grSstWinOpen
+  Date: 3/16
+  Implementor(s): dow, gmt, murali, jdt
+  Library: Glide
+  Description:
+
+  Initialize the selected SST
+
+  Initialization has 4 Steps 
+
+  Video Init - 
+     In the full screen case this includes setting the requested
+     resolution/refresh state and allocating any necessary OS 
+     resource for the GC.  
+
+     In the windowed case, this involves acquiring all necessary
+     surfaces for rendering, back buffer and memory fifo
+
+     Also perform any work necessary to enable access to 3D 
+     registers
+
+  Command Transport Init:
+     Assuming video registers are in a reset state, initialize
+     the appropriate command transport mechanism.  All writes
+     to hardware prior to this action are direct writes, 
+     afterwards, most commands will go throught the command
+     transport
+
+  GC Init - 
+     Initialize the current GC based on the user requested
+     open parameters and command transport data reported
+     during initialization.
+
+  3D State Init - 
+     Push an initial state onto all of the 3D state registers.   
+     
+  Arguments:
+  hwnd - pointer to a window handle or null.  If NULL, then 
+         the application window handle will be inferred though
+         the GetActiveWindow() api.
+  resolution - either one of the pre-defined glide resolutions,
+               or GR_RESOLUTION_NONE, in which case the window
+               size is inferred from the size application window
+  refresh - requested fullscreen refresh rate, ignored in a window
+  format  - requested ccolor format for glide packed color values
+  origin  - location of coordinate origin either upper left or
+                    lower right
+  nColBuffers - number of color buffers to attempt to allocate
+                0 - meaningless
+                1 - allocate a front buffer only
+                2 - allocate a front and back buffer
+                3 - allocate a front, back, aux buffer for tripple buffering
+  nAuxBuffers - number of aux buffers to attempt to allocate
+                0 - no alpha or z buffers
+                1 - allocate one aux buffer for alpha/depth buffering
+                2 - allocate on depth and one alpha buffer ( unsup )
+  Return:
+  FXTRUE - glide successfully acquired the necessary resources and a
+           is ready for rendering
+  FXFALSE - glide was unsuccessful in getting the necessary resources, 
+            or the requested configuration is unavailble on the host
+            hardware - any calls to glide rendering routines will result
+            in undefined behavior.
+  -------------------------------------------------------------------*/
+GR_ENTRY(grSstWinOpen, FxBool, ( 
+    FxU32                   hWnd,
+    GrScreenResolution_t    resolution, 
+    GrScreenRefresh_t       refresh, 
+    GrColorFormat_t         format, 
+    GrOriginLocation_t      origin, 
+    int                     nColBuffers,
+    int                     nAuxBuffers))
+{
+  FxBool rv = FXTRUE;
+  int tmu;
+  InitFIFOData fifoInfo;
+  int xres, yres, fbStride;
+#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
+  FARPROC 
+    oemInitMapBoard = NULL, 
+    oemInitSetVideo = NULL, 
+    oemInitVideoTiming = NULL;
+  OemInitInfo oemi;
+  sst1VideoTimingStruct *sstVideoRez = NULL, tvVidtiming;
+  FxBool oemvidtiming = FXFALSE;
+  FxU32 tvVidtiming_refreshRate = refresh;
+#endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */
+
+  GR_BEGIN_NOFIFOCHECK("grSstWinOpen",80);
+  GDBG_INFO_MORE((gc->myLevel,
+                  "(rez=%d,ref=%d,cformat=%d,origin=%s,#bufs=%d, #abufs=%d)\n",
+                  resolution,refresh,format,
+                  origin ? "LL" : "UL",
+                  nColBuffers, nAuxBuffers));
+  GR_CHECK_F("grSstWinOpen", !gc, "no SST selected as current (gc==NULL)");
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST1)
+  /* The current init code does not do triple buffering, and we would
+   * have the same bug as v2 for lfb reads when triple buffering if 
+   * we added this back.
+   */
+  rv = (nColBuffers < 3);
+  if (!rv) {
+    GDBG_INFO(( gc->myLevel, 
+                "grSstWinOpen failed because sst1 cannot really triple buffer\n"));
+    goto BAILOUT;  
+  }
+#endif /* (GLIDE_PLATFORM & GLIDE_HW_SST1) */
+
+  if (!_GlideRoot.environment.ignoreReopen)
+    GR_CHECK_F("grSstWinOpen", gc->open, "gc opened twice!" );
+
+  /* If we've been closed via grSstWinClose then we need to re-init
+   * the hw registers etc before init-ing video etc or bad ju-ju is
+   * in our future.
+   */
+  if (gc->closedP) {
+    gc->closedP = FXFALSE;
+    if (!(pciOpen() &&
+          (initMapBoard(_GlideRoot.current_sst) != NULL))) return FXFALSE;
+  }
+  
+#if (GLIDE_PLATFORM & GLIDE_OS_WIN32) && (!defined(GLIDE_DEBUG) || (GLIDE_DEBUG == 0))
+  /*
+  ** load fxoem2x.dll and map board
+  */
+  oemi.version = OEMINIT_VERSION;
+  oemi.vendorID = sst1BoardInfo[_GlideRoot.current_sst].vendorID;
+  oemi.deviceID = sst1BoardInfo[_GlideRoot.current_sst].deviceID;
+  oemi.boardID = OEMINIT_INVALID_BOARD_ID;
+  oemi.subvendorID = OEMINIT_INVALID_BOARD_ID;
+  oemi.linearAddress = gc->base_ptr;
+  oemi.slaveAddress = NULL;
+  if (gc->oemInit = LoadLibrary("fxoem2x.dll")) {
+    if (oemInitMapBoard  = GetProcAddress(gc->oemInit, "_fxoemInitMapBoard@4")) {
+      oemInitMapBoard(&oemi);
+    }
+  }
+#if defined(FX_OEM_BUILD) && !defined(FX_STATIC_BUILD)
+  else {
+    GrErrorCallback("Missing fxoem2x.dll", FXTRUE);
+    grSstWinClose();
+    exit(0);
+  }
+#endif /* FX_STATIC_BUILD */
+#endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) && (!defined(GLIDE_DEBUG) || (GLIDE_DEBUG == 0)) */
+
+  /*------------------------------------------------------
+    Validate and Parse Arguments
+    ------------------------------------------------------*/
+  /* 
+     FIXME!! jdt 
+      
+     There needs to be one large table of resolutions vs. 
+     nColBuffers vs. nAuxBuffers that specifies required
+     ram and vald/invalid configurations
+   */
+#define SLI_DETECT _GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].sstBoard.VoodooConfig.sliDetect
+
+  if ((!SLI_DETECT) &&
+      ((gc->fbuf_size <= 2 &&
+        resolution == GR_RESOLUTION_800x600 &&
+        (nColBuffers+nAuxBuffers) >= 3 ) ||
+       (gc->fbuf_size <= 2 &&
+        resolution == GR_RESOLUTION_856x480 &&
+        (nColBuffers+nAuxBuffers) >= 3 ) ||
+       (gc->fbuf_size <= 2 &&
+        resolution == GR_RESOLUTION_960x720 ) ))
+    {
+      GDBG_INFO(( gc->myLevel, "grSstWinOpen failed "
+                  "for illegal screen resolution or "
+                  "insufficient memory\n" ));
+      rv = FXFALSE;
+      goto BAILOUT;
+    }
+
+#ifdef H3D
+  if (!GR_RESOLUTION_IS_AUTOFLIPPED(resolution)) {
+#endif
+  if ((resolution < GR_RESOLUTION_MIN) ||
+      ((resolution > GR_RESOLUTION_MAX) &&
+       (resolution != GR_RESOLUTION_NONE )) ) {
+      GDBG_INFO(( gc->myLevel, "grSstWinOpen failed "
+                  "for illegal screen resolution\n" ));
+      rv = FXFALSE;
+      goto BAILOUT;
+    }
+#ifdef H3D
+  } else {      // is autoflipped resolution
+  if ((resolution < GR_RESOLUTION_AUTOFLIPPED_MIN) ||
+      (resolution > GR_RESOLUTION_AUTOFLIPPED_MAX) ) {
+      GDBG_INFO(( gc->myLevel, "grSstWinOpen failed "
+                  "for illegal autoflipped screen resolution\n" ));
+      rv = FXFALSE;
+      goto BAILOUT;
+    }
+  }
+#endif
+  
+#if ( 1 ) 
+  /*------------------------------------------------------
+    Video Init
+    ------------------------------------------------------*/
+#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
+  /*
+  ** initialize video timing data for oemdll
+  ** if tv out component exist, the oem dll need to modify the vidtiming
+  ** data in oemi. Glide will take the changes and pass it to 
+  ** sst1InitVideoBuffers()
+  */
+  {
+    if((sstVideoRez = sst1InitFindVideoTimingStruct(resolution,refresh))) {
+      tvVidtiming = *sstVideoRez;
+      oemi.vid.res = resolution;
+      oemi.vid.refresh = refresh;
+      oemi.vid.depth = 16;
+      oemi.vid.hSyncOn = tvVidtiming.hSyncOn;
+      oemi.vid.hSyncOff = tvVidtiming.hSyncOff;
+      oemi.vid.vSyncOn = tvVidtiming.vSyncOn;
+      oemi.vid.vSyncOff = tvVidtiming.vSyncOff;
+      oemi.vid.hBackPorch = tvVidtiming.hBackPorch;
+      oemi.vid.vBackPorch = tvVidtiming.vBackPorch;
+      oemi.vid.xDimension = tvVidtiming.xDimension;
+      oemi.vid.yDimension = tvVidtiming.yDimension;
+      oemi.vid.clkFreq16bpp = tvVidtiming.clkFreq16bpp;
+      oemi.vid.clkFreq24bpp = tvVidtiming.clkFreq24bpp;
+      
+      if (gc->oemInit) {
+        if ((oemInitVideoTiming = GetProcAddress(gc->oemInit, "_fxoemInitVideoTiming@4")) && 
+            (oemInitMapBoard))
+          oemvidtiming = oemInitVideoTiming(&oemi);
+        /*
+        ** video timing is updated by oem dll
+        */
+        if (oemvidtiming) {
+          tvVidtiming.hSyncOn = oemi.vid.hSyncOn;
+          tvVidtiming.hSyncOff = oemi.vid.hSyncOff;
+          tvVidtiming.vSyncOn = oemi.vid.vSyncOn;
+          tvVidtiming.vSyncOff = oemi.vid.vSyncOff;
+          tvVidtiming.hBackPorch = oemi.vid.hBackPorch;
+          tvVidtiming.vBackPorch = oemi.vid.vBackPorch;
+          tvVidtiming.xDimension = oemi.vid.xDimension;
+          tvVidtiming.yDimension = oemi.vid.yDimension;
+          tvVidtiming.clkFreq16bpp = oemi.vid.clkFreq16bpp;
+          tvVidtiming.clkFreq24bpp = oemi.vid.clkFreq24bpp;
+        }
+      }
+    }
+  }
+#endif
+  GDBG_INFO((gc->myLevel, "  Video Init\n" ));
+#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
+  if (oemvidtiming)
+    rv = initSetVideo( hWnd, resolution, 
+                       oemi.vid.refresh, format, origin, 
+                       nColBuffers, nAuxBuffers,
+                       &xres, &yres, &fbStride, &tvVidtiming );
+  else
+#endif
+    rv = initSetVideo( hWnd, resolution, 
+                       refresh, format, origin, 
+                       nColBuffers, nAuxBuffers,
+                       &xres, &yres, &fbStride, _GlideRoot.GCs[_GlideRoot.current_sst].vidTimings );
+  if ( !rv ) goto BAILOUT;
+  GDBG_INFO((gc->myLevel, 
+             "  Video init succeeded. xRes = %.04d, yRes = %.04d\n",
+             xres, yres ));
+
+#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
+  if (gc->oemInit) {
+    if ((oemInitSetVideo = GetProcAddress(gc->oemInit, "_fxoemInitSetVideo@4")) && 
+        (oemInitMapBoard))
+      oemInitSetVideo(&oemi);
+  }
+#endif
+
+  /*------------------------------------------------------
+    Command Transport Init
+    ------------------------------------------------------*/
+  GDBG_INFO((gc->myLevel, "  Command Transport Init\n" ));
+
+  /* Set up FifoInfo with CPU Type so that init code knows if it needs
+     to advance the write pointer beyond the read pointer for P6 */
+
+  fifoInfo.cpuType = _GlideRoot.CPUType;
+
+  rv = initEnableTransport( &fifoInfo );
+  if ( !rv ) goto BAILOUT;
+
+  gc->nopCMD = FXFALSE;
+
+#  if   ( GLIDE_PLATFORM & GLIDE_HW_SST1 ) 
+  grHints( GR_HINT_FIFOCHECKHINT, 
+           fifoInfo.hwDep.vgFIFOData.memFifoStatusLwm + 0x100 );
+  _grReCacheFifo( 0 );
+#  elif ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+  gc->hwDep.sst96Dep.writesSinceFence = 0;
+#if (GLIDE_PLATFORM & GLIDE_OS_DOS32) && ( GLIDE_PLATFORM & GLIDE_HW_SST96 ) && defined(GLIDE_DEBUG)
+  /* Set int 10h interrupt handler */
+  gc->hwDep.sst96Dep.int10Called = FXFALSE;
+  gc->hwDep.sst96Dep.prevInt10 = NULL;
+  GDBG_INFO((80, "Storing old int 10h interrupt handler (0x%x)\n", gc->hwDep.sst96Dep.prevInt10));  
+
+  GDBG_INFO((80, "Overriding int 10h interrupt handler\n"));
+  _dos_setvect(0x10, _grInt10Handler);
+#endif
+  
+  gc->fifoData = fifoInfo;
+
+  GDBG_INFO((120, "After Init:  fifoPtr  = 0x%x\n", 
+             fifoInfo.hwDep.vg96FIFOData.fifoPtr ));
+  GDBG_INFO((120, "After Init:  fifoSize = 0x%x\n",
+             fifoInfo.hwDep.vg96FIFOData.fifoSize ));
+  GDBG_INFO((120, "After Init:  fifoVirt = 0x%x\n",
+             fifoInfo.hwDep.vg96FIFOData.fifoVirt ));
+  GDBG_INFO((120, "After Init:  fifoPhys = 0x%x\n",
+             fifoInfo.hwDep.vg96FIFOData.fifoPhys ));
+  GDBG_INFO((120, "After Init:  fifoMax  = 0x%x\n",
+             fifoInfo.hwDep.vg96FIFOData.fifoMax ));
+  GDBG_INFO((120, "After Init:  fifoCur  = 0x%x\n",
+             fifoInfo.hwDep.vg96FIFOData.fifoCur ));
+  GDBG_INFO((120, "After Init:  fifoLfb  = 0x%x\n",
+             fifoInfo.hwDep.vg96FIFOData.fifoLfb ));
+#  else
+#    error "Need to write command transport init for glide for this hw"
+#  endif
+
+#endif
+
+  /*------------------------------------------------------
+    GC Init
+    ------------------------------------------------------*/
+  GDBG_INFO((gc->myLevel, "  GC Init\n" ));
+  gc->state.screen_width  = xres;
+  gc->state.screen_height = yres;
+  gc->state.num_buffers   = nColBuffers;
+  gc->state.color_format  = format;
+  gc->grSstRez            = resolution;
+  gc->grSstRefresh        = refresh;
+
+  gc->lockPtrs[GR_LFB_READ_ONLY]  = (FxU32)-1;
+  gc->lockPtrs[GR_LFB_WRITE_ONLY] = (FxU32)-1;
+  gc->lfbSliOk = 0;
+  gc->fbStride = fbStride;
+  
+  /* Initialize the read/write registers to all 0 */
+  gc->state.fbi_config.fbzColorPath  = 0;
+  gc->state.fbi_config.fogMode       = 0;
+  gc->state.fbi_config.alphaMode     = 0;
+  gc->state.fbi_config.fbzMode       = 0;
+  gc->state.fbi_config.lfbMode       = 0;
+  gc->state.fbi_config.clipLeftRight = 0;
+  gc->state.fbi_config.clipBottomTop = 0;
+  gc->state.fbi_config.fogColor      = 0;
+  gc->state.fbi_config.zaColor       = 0;
+  gc->state.fbi_config.chromaKey     = 0;
+  gc->state.fbi_config.stipple       = 0;
+  gc->state.fbi_config.color0        = 0;
+  gc->state.fbi_config.color1        = 0;
+  for (tmu = 0; tmu < gc->num_tmu; tmu += 1) 
+    {
+      FxU32 textureMode = (FxU32)SST_SEQ_8_DOWNLD;
+      if ( (_GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].type == 
+            GR_SSTTYPE_VOODOO ) && 
+           (_GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].sstBoard.VoodooConfig.tmuConfig[tmu].tmuRev ==
+            0 ) )
+        {
+          textureMode = 0;
+        }
+      gc->state.tmu_config[tmu].textureMode     = textureMode;
+      gc->state.tmu_config[tmu].tLOD            = 0x00000000;
+      gc->state.tmu_config[tmu].tDetail         = 0x00000000;
+      gc->state.tmu_config[tmu].texBaseAddr     = 0x00000000;
+      gc->state.tmu_config[tmu].texBaseAddr_1   = 0x00000000;
+      gc->state.tmu_config[tmu].texBaseAddr_2   = 0x00000000;
+      gc->state.tmu_config[tmu].texBaseAddr_3_8 = 0x00000000;
+      gc->state.tmu_config[tmu].mmMode          = GR_MIPMAP_NEAREST;
+      gc->state.tmu_config[tmu].smallLod        = GR_LOD_1;
+      gc->state.tmu_config[tmu].largeLod        = GR_LOD_1;
+      gc->state.tmu_config[tmu].evenOdd         = GR_MIPMAPLEVELMASK_BOTH;
+      gc->state.tmu_config[tmu].nccTable        = GR_NCCTABLE_NCC0;
+    } 
+
+  /*------------------------------------------------------
+    3D State Init 
+    ------------------------------------------------------*/
+  GDBG_INFO((gc->myLevel, "  3D State Init\n" ));
+  gc->state.fbi_config.fbzMode = 
+    SST_ENRECTCLIP | 
+    SST_ENZBIAS    | 
+    SST_DRAWBUFFER_BACK;
+  
+  grHints(GR_HINT_ALLOW_MIPMAP_DITHER, 0);
+  grSstOrigin( origin );
+  grAlphaBlendFunction( GR_BLEND_ONE , GR_BLEND_ZERO, 
+                        GR_BLEND_ONE, GR_BLEND_ZERO );
+  grAlphaTestFunction( GR_CMP_ALWAYS );
+  grAlphaTestReferenceValue( 0 );
+  grChromakeyMode( GR_CHROMAKEY_DISABLE );
+  grConstantColorValue( ( FxU32 ) ~0 );
+  grClipWindow( 0, 0, gc->state.screen_width, 
+                gc->state.screen_height );
+  _grColorCombineDelta0Mode( FXFALSE );
+  grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
+                 GR_COMBINE_FACTOR_ONE,
+                 GR_COMBINE_LOCAL_ITERATED,
+                 GR_COMBINE_OTHER_ITERATED,
+                 FXFALSE);
+  grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
+                 GR_COMBINE_FACTOR_ONE,
+                 GR_COMBINE_LOCAL_NONE,
+                 GR_COMBINE_OTHER_CONSTANT,
+                 FXFALSE);
+  grColorMask( FXTRUE, FXFALSE );
+  grCullMode( GR_CULL_DISABLE );
+  grDepthBiasLevel( 0 );
+  grDepthMask( FXFALSE );
+  grDepthBufferMode( GR_DEPTHBUFFER_DISABLE );
+  grDepthBufferFunction( GR_CMP_LESS );
+  grDepthBiasLevel( 0 );
+  grDitherMode( GR_DITHER_4x4 );
+  grFogMode( GR_FOG_DISABLE );
+  grFogColorValue( 0x00000000 );
+  grGammaCorrectionValue( 1.7f );
+  guTexMemReset();
+  switch (gc->num_tmu) {
+  case 3:
+    grTexClampMode( GR_TMU2, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP );
+    grTexDetailControl( GR_TMU2, 0, 1, 1.0F );
+    grTexFilterMode( GR_TMU2, GR_TEXTUREFILTER_POINT_SAMPLED, 
+                     GR_TEXTUREFILTER_POINT_SAMPLED );
+    grTexLodBiasValue( GR_TMU2, 0.0F);
+    grTexMipMapMode( GR_TMU2, GR_MIPMAP_DISABLE, FXFALSE );
+    grTexCombineFunction( GR_TMU2, GR_TEXTURECOMBINE_ZERO );
+    grTexCombine( GR_TMU2, GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE,
+                  GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE,
+                  FXFALSE, FXFALSE );
+  case 2:
+    grTexClampMode( GR_TMU1, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP );
+    grTexDetailControl( GR_TMU1, 0, 1, 1.0F );
+    grTexFilterMode( GR_TMU1, GR_TEXTUREFILTER_POINT_SAMPLED, 
+                     GR_TEXTUREFILTER_POINT_SAMPLED );
+    grTexLodBiasValue( GR_TMU1, 0.0F);
+    grTexMipMapMode( GR_TMU1, GR_MIPMAP_DISABLE, FXFALSE );
+    grTexCombine( GR_TMU1, GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE,
+                  GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE,
+                  FXFALSE, FXFALSE );
+  case 1:
+    grTexClampMode( GR_TMU0, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP );
+    grTexDetailControl( GR_TMU0, 0, 1, 1.0F );
+    grTexFilterMode( GR_TMU0, GR_TEXTUREFILTER_POINT_SAMPLED, 
+                     GR_TEXTUREFILTER_POINT_SAMPLED );
+    grTexLodBiasValue( GR_TMU0, 0.0F);
+    grTexMipMapMode( GR_TMU0, GR_MIPMAP_DISABLE, FXFALSE );
+    grTexCombine( GR_TMU0, GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE,
+                  GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE,
+                  FXFALSE, FXFALSE );
+  }
+  grLfbConstantAlpha( 0xFF );
+  grLfbConstantDepth( 0 );
+
+  gc->open = FXTRUE;
+  _GlideRoot.windowsInit = FXTRUE; /* to avoid race with grSstControl() */
+
+#ifdef H3D
+  if (GR_RESOLUTION_IS_AUTOFLIPPED(resolution)) {
+    setAutoflip(1);
+  } else
+#endif
+
+  {
+    GrState
+      state;
+
+    grGlideGetState(&state);
+
+#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
+
+    grSstOrigin( GR_ORIGIN_LOWER_LEFT );
+
+    if (!_GlideRoot.environment.noSplash) {
+      HMODULE newSplash;
+
+      if (newSplash = LoadLibrary("3dfxsplash2.dll")) {
+        FARPROC fxSplash;
+
+        if (fxSplash = GetProcAddress(newSplash, "_fxSplash@16")) {
+          fxSplash(hWnd, gc->state.screen_width,
+                   gc->state.screen_height, nAuxBuffers);  
+          _GlideRoot.environment.noSplash = 1;        
+        } 
+      }
+    }
+#endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */
+
+    /* If it's still 0, then do the old one */
+    if (!_GlideRoot.environment.noSplash) {
+      grSplash(0.0f, 0.0f, 
+               (float) gc->state.screen_width,
+               (float) gc->state.screen_height,
+               0);
+      _GlideRoot.environment.noSplash = 1;
+    }
+    grGlideSetState(&state);
+  }
+
+  BAILOUT:
+  GR_RETURN( rv );
+} /* grSstWinOpen */
+
+/*-------------------------------------------------------------------
+  Function: grSstWinClose
+  Date: 3/16
+  Implementor(s): jdt
+  Library: Glide
+  Description:
+  Shut down the selected SST
+
+  Shutdown has 4 steps
+
+  3D Idle 
+    the 3D engine must be idled to make sure that there are no
+    commands executing in the transport when the registers are
+    reset
+
+  GC Reset
+    the GC is flagged as unitialized - ( nosup )
+
+  Command Transport Disable
+    the command transport to the 3D device is put in a state
+    of reset.  No further commands may be issued throught the
+    command transport
+
+  Video Restore
+    video is restored to its pre-open state.
+
+  Arguments:
+  none
+  Return:
+  none
+  -------------------------------------------------------------------*/
+GR_ENTRY( grSstWinClose, void, ( void ) )
+{
+#define FN_NAME "grSstWinClose"
+  GR_BEGIN_NOFIFOCHECK("grSstWinClose",80);
+  GDBG_INFO_MORE((gc->myLevel,"()\n"));
+
+  if ( (gc != NULL) && gc->open ) {
+#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
+    FARPROC oemRestoreVideo = NULL;
+#endif
+    /*--------------------------
+      3D Idle
+      --------------------------*/
+    GDBG_INFO(( gc->myLevel, "  3D Idle\n" ));
+    initIdle();
+    
+    /*--------------------------
+      GC Reset
+      --------------------------*/
+    GDBG_INFO(( gc->myLevel, "  GC Reset\n" ));
+    gc->open = FXFALSE;
+    gc->closedP = FXTRUE;
+    
+    /*--------------------------
+      Command Transport Disable
+      --------------------------*/
+    GDBG_INFO(( gc->myLevel, "  Command Transport Disable\n" ));
+    initDisableTransport();
+    
+#if (GLIDE_PLATFORM & GLIDE_OS_DOS32) && (GLIDE_PLATFORM & GLIDE_HW_SST96) && defined(GLIDE_DEBUG)
+    GDBG_INFO((80, "Restoring int 10h interrupt handler (0x%x)\n", gc->hwDep.sst96Dep.prevInt10));
+    _dos_setvect(0x10, NULL);
+#endif
+
+    /*--------------------------
+      Video Restore 
+      --------------------------*/
+    GDBG_INFO(( gc->myLevel, "  Restore Video\n" ));
+    initRestoreVideo();
+#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
+    if (gc->oemInit) {
+      if (oemRestoreVideo = GetProcAddress(gc->oemInit, "_fxoemRestoreVideo@0"))
+        oemRestoreVideo();
+      FreeLibrary(gc->oemInit);
+    }
+#endif
+  }
+    
+  GR_END();
+#undef FN_NAME
+} /* grSstWinClose */
+
+GR_ENTRY(grSstControl, FxBool, ( GrControl_t code )) 
+{
+#define FN_NAME "grSstControl"  
+
+  GR_DCL_GC;
+  GDBG_INFO((41, "%s:  code = 0x%x, windowsInit = %d\n", FN_NAME,
+             code, _GlideRoot.windowsInit));
+  
+  if (_GlideRoot.windowsInit) {    
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+    /* For VG96, windows haven't been created, so there's no point
+     * trying to control it. 
+     */
+    /* Believe it or not, the following code really should be bracketed
+       like this.  The reason is that GR_BEGIN_NOFIFOCHECK seg faults
+       when grSstControl is called before the Glide window is truly
+       initialized.  This is a real concern, as grSstControl is called
+       from event loops, which are asynchronous.
+       */
+    FxU32
+      status,
+      xRes, yRes,
+      clipLeftRight, clipBottomTop;
+    FxU32 nTries;
+    
+    GR_BEGIN_NOFIFOCHECK(FN_NAME,80);
+    
+    /* We're either cleaning up or closed so forget about this one. */
+    if (gc->closedP) goto __done;
+    xRes = initControl(code);
+#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
+    {
+      FARPROC oemControl = NULL;
+      if (gc->oemInit) {
+        if ((oemControl = GetProcAddress(gc->oemInit, "_fxoemControl@4")))
+          oemControl(code);
+      }
+    }
+#endif
+    
+    GDBG_INFO((80, "%s:  initControl returned 0x%x\n", FN_NAME, xRes));
+
+    if (!xRes) return FXFALSE;
+  
+    yRes = xRes >> 16;
+    xRes = xRes & 0xffff;
+  
+    /* !! FIXME +++ this call should properly update the gc->fbStride,
+       this information is known only to the init layer and needs to be
+       exposed, it is only really necessary to lfblock right now,
+       and therefore is returned by initGetBufferPtr */
+  
+    gc->state.screen_width = xRes;
+    gc->state.screen_height = yRes;
+
+    /* Wait for Idle. */
+  
+    nTries = 0;
+    do {
+      if (nTries++ > 999) {
+        GDBG_INFO((80, "%s:  returning FALSE after %d checks for idle\n", 
+                   FN_NAME, nTries));
+        return FXFALSE;
+      }
+
+      status = GET(hw->status);
+        
+    } while (status & 0x1);
+
+    /* Set ClipRect Via direct writes */
+    _grClipNormalizeAndGenerateRegValues(0, 0, xRes, yRes,
+                                         &clipLeftRight,
+                                         &clipBottomTop);
+    SET_DIRECT(clipLeftRight1, clipLeftRight);
+    SET_DIRECT(clipBottomTop1, clipBottomTop);
+
+    __done:
+    /* Do Nothing */;
+#elif (GLIDE_PLATFORM&GLIDE_HW_SST1)
+    FxBool ctrlflag;
+    ctrlflag = initControl(code);
+#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
+    {
+      FARPROC oemControl = NULL;
+      if (gc->oemInit) {
+        if ((oemControl = GetProcAddress(gc->oemInit, "_fxoemControl@4")))
+          oemControl(code);
+      }
+    }
+#endif
+    return ctrlflag;
+#endif
+    
+  }
+  GDBG_INFO((41, "%s:  Returning TRUE\n", FN_NAME));
+  return FXTRUE;
+  
+} /* grSstControl */
+
+/*---------------------------------------------------------------------------
+**  grSstPerfStats
+*/ 
+
+GR_ENTRY(grSstPerfStats, void, (GrSstPerfStats_t *pStats))
+{
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+  FxU32 jr;
+#endif
+
+  GR_BEGIN_NOFIFOCHECK("grSstPerfStats",83);
+  GDBG_INFO_MORE((gc->myLevel,"(0x%x)\n",pStats));
+  GR_CHECK_F(myName, !pStats, "NULL pointer");
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+/*
+ * fixme! this is a fix for bug 697.  The right thing to do is
+ * define GR_GET properly in fxglide.h, but this breaks lots of other
+ * things, and this is the only place in glide where we actually read
+ * sst-1 registers, and this pools is mature, so... Also, note that
+ * these reads are not synchronized with the FIFO, so results are
+ * approximate.  I'm not going to change this behavior for fear of
+ * introducing performance degradation in existing apps that may
+ * be instrumented with this call.  The read of jr is a sanity check.
+ */
+#undef GETINDEX
+#undef GETREADADDR
+#undef GR_GET
+#define GR_GET(s) *(GETREADADDR(s))
+#define GETINDEX(a) ((((FxU32) &a) - (((FxU32) hw) + 0x400000)) >> 2)
+#define GETREADADDR(s) ((FxU32 *) (((FxU32) hw) + (GETINDEX(s) <<12)))
+  jr = GR_GET(hw->fbijrVersion);
+#endif /* SST96 */
+  pStats->pixelsIn   = GR_GET(hw->stats.fbiPixelsIn);
+  pStats->chromaFail = GR_GET(hw->stats.fbiChromaFail);
+  pStats->zFuncFail  = GR_GET(hw->stats.fbiZfuncFail);
+  pStats->aFuncFail  = GR_GET(hw->stats.fbiAfuncFail);
+  pStats->pixelsOut  = GR_GET(hw->stats.fbiPixelsOut);
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
+  if (gc->scanline_interleaved == FXTRUE) {
+    sst1InitSliPciOwner(gc->base_ptr, SST_SLI_SLAVE_OWNPCI);
+
+    pStats->pixelsIn   += GR_GET(hw->stats.fbiPixelsIn);
+    pStats->chromaFail += GR_GET(hw->stats.fbiChromaFail);
+    pStats->zFuncFail  += GR_GET(hw->stats.fbiZfuncFail);
+    pStats->aFuncFail  += GR_GET(hw->stats.fbiAfuncFail);
+    pStats->pixelsOut  += GR_GET(hw->stats.fbiPixelsOut);
+
+    sst1InitSliPciOwner(gc->base_ptr, SST_SLI_MASTER_OWNPCI);
+  }
+#endif
+    
+  GR_END();
+} /* grSstPerfStats */
+
+/*---------------------------------------------------------------------------
+**  grStatsResetPerfStats
+*/
+
+GR_ENTRY(grSstResetPerfStats, void, (void))
+{
+  GR_BEGIN("grSstResetPerfStats",83,4);
+  GDBG_INFO_MORE((gc->myLevel,"()\n"));
+  P6FENCE_CMD( GR_SET(hw->nopCMD,1) );
+  GR_END();
+} /* grSstResetPerfStats */
+
+
+/*---------------------------------------------------------------------------
+**  grSstStatus - return contents of status register
+*/
+
+GR_ENTRY(grSstStatus, FxU32, (void))
+{
+  FxU32 stat;
+
+  GR_BEGIN_NOFIFOCHECK( "grSstStatus", 85 );
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)  
+  P6_NUDGE_OF_LOVE;
+#endif
+
+  stat = initStatus();
+  GDBG_INFO((84,"grSstStatus() => 0x%x\n", stat));
+  GR_END();
+
+  return stat;
+}/* grSstStatus */
+
+/*---------------------------------------------------------------------------
+**  grSstVideoLine - return current video line number
+*/
+
+GR_ENTRY(grSstVideoLine, FxU32, (void))
+{
+  FxU32 vline = 1;
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
+  GR_DCL_GC;
+  GR_DCL_HW;
+
+  vline = GR_GET(hw->vRetrace);
+  GDBG_INFO((84,"grSstVideoLine() => 0x%x (%d)\n",vline,vline));
+#endif
+  return vline;
+
+}/* grSstVideoLine */
+
+/*---------------------------------------------------------------------------
+**  grSstVRetrace - return contents of SST_VRETRACE bit of status register;
+*/
+
+GR_ENTRY(grSstVRetraceOn, FxBool, (void))
+{
+  if (grSstStatus() & SST_VRETRACE)
+    return FXFALSE;
+  else
+    return FXTRUE;
+}/* grSstVRetrace */
+
+/*---------------------------------------------------------------------------
+**  grSstIsBusy - find out if the SST is busy or not
+*/
+
+GR_ENTRY(grSstIsBusy, FxBool, (void))
+{
+  FxBool busy;
+  GR_BEGIN_NOFIFOCHECK( "grSstIsBusy", 85 );
+
+  if (gc->nopCMD == FXFALSE) {
+    GR_SET_EXPECTED_SIZE(sizeof(FxU32));
+    P6FENCE_CMD( GR_SET(hw->nopCMD,1) );
+    gc->nopCMD = FXTRUE;
+  }
+  if ((busy = initBusy()) == FXFALSE)
+    gc->nopCMD = FXFALSE;
+  
+  GDBG_INFO((84,"grSstIsBusy() => 0x%x\n",busy));
+
+  GR_RETURN( busy );
+
+}/* grSstIsBusy */
+
+/*---------------------------------------------------------------------------
+**  grGammaCorrectionValue - set the gamma correction value
+*/
+
+GR_ENTRY(grGammaCorrectionValue, void, (float gam))
+{
+  GR_BEGIN_NOFIFOCHECK("grGammaCorrectionValue",80);
+  GDBG_INFO_MORE((gc->myLevel,"(%g)\n",gam));
+  initGamma( gam );
+  GR_END();
+} /* grGammaCorrectionValue */
+
+
+/*---------------------------------------------------------------------------
+** grSstIdle
+*/
+
+GR_ENTRY(grSstIdle, void, (void))
+{
+  GR_BEGIN_NOFIFOCHECK("grSstIdle",83);
+  GDBG_INFO_MORE((gc->myLevel,"()\n"));
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+  P6_NUDGE_OF_LOVE;
+#endif
+
+  initIdle();
+
+  GR_END_SLOPPY();
+} /* grSstIdle */
+
+
+/*---------------------------------------------------------------------------
+**  grSstOrigin - Set the orgin orientation of the screen.
+**
+**  Returns:
+**
+**  Notes:
+**
+*/
+
+GR_ENTRY(grSstOrigin, void, (GrOriginLocation_t origin ))
+{
+  FxU32 fbzMode;
+
+  GR_BEGIN_NOFIFOCHECK("grSstOrigin",83);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",origin));
+
+  /* Initialize FBZMODE register */
+  fbzMode = gc->state.fbi_config.fbzMode;
+  if (origin == GR_ORIGIN_LOWER_LEFT)
+    fbzMode |= SST_YORIGIN;
+  else
+    fbzMode &= ~(SST_YORIGIN);
+
+  initOrigin( origin );
+
+  GR_SET_EXPECTED_SIZE(sizeof(FxU32));
+  {
+    GR_SET( hw->fbzMode, fbzMode );
+  }
+  GR_CHECK_SIZE();
+
+  gc->state.fbi_config.fbzMode = fbzMode;
+  GR_END();
+} /* grSstOrigin */
+
+/* GMT: do we really have users for this???
+   CHD: No.
+   JDT: Huh?  If you're talking about grSstOrigin, you're smoking crack.
+        if you are talking about SstConfigPipeline, it is evil and must
+        be destroyed. :)
+ */
+
+#include "gsstdef.h"
+
+/*---------------------------------------------------------------------------
+** grSstConfigPipeline
+*/
+
+GR_ENTRY(grSstConfigPipeline, void, (GrChipID_t chip, GrSstRegister reg, FxU32 value))
+{
+  GR_BEGIN("grSstConfigPipeline",83,4);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x,0x%x)\n",chip,reg,value));
+  PACKER_WORKAROUND;
+
+  switch (chip) {
+  case GR_TMU0:
+  case GR_TMU1: 
+  case GR_TMU2:
+    hw = SST_TMU(hw,chip);
+    /* FALL THRU */
+  case GR_FBI:
+    GR_SET( ((FxU32 *)hw)[reg], value );
+    break;
+#ifdef GLIDE_DEBUG
+  default:
+  {
+    char outString[256];
+
+    sprintf(outString, "grSstConfigPipeline: invalid chip ID specified (%d)\n", chip);
+    GrErrorCallback(outString, FXTRUE);
+  }
+#endif
+    break;
+  }
+  PACKER_WORKAROUND;
+  GR_END();
+} /* grSstConfigPipeline */
Index: trunk/src/opengl/glide/sst1/glide/gsstdef.h
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gsstdef.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gsstdef.h	(revision 2885)
@@ -0,0 +1,234 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gsstdef.h,v 1.1 2000-02-25 00:31:18 sandervl Exp $
+** $Log: gsstdef.h,v $
+** Revision 1.1  2000-02-25 00:31:18  sandervl
+** Created new Voodoo 1 Glide dir
+**
+**
+*/
+#ifndef __GSSTDEF_H__
+#define __GSSTDEF_H__
+
+#include <sst.h>
+
+/*----------------- SST chip layout -----------------------*/
+typedef enum
+{
+   SSTR_STATUS,
+   SSTR_RESERVED0,
+   SSTR_VAX,
+   SSTR_VAY,
+   SSTR_VBX,
+   SSTR_VBY,
+   SSTR_VCX,
+   SSTR_VCY,
+#ifdef GLIDE_USE_ALT_REGMAP
+   SSTR_R,
+   SSTR_DRDX,
+   SSTR_DRDY,
+
+   SSTR_G,
+   SSTR_DGDX,
+   SSTR_DGDY,
+
+   SSTR_B,
+   SSTR_DBDX,
+   SSTR_DBDY,
+
+   SSTR_Z,
+   SSTR_DZDX,
+   SSTR_DZDY,
+
+   SSTR_A,
+   SSTR_DADX,
+   SSTR_DADY,
+
+   SSTR_S,
+   SSTR_DSDX,
+   SSTR_DSDY,
+
+   SSTR_T,
+   SSTR_DTDX,
+   SSTR_DTDY,
+
+   SSTR_W,
+   SSTR_DWDX,
+   SSTR_DWDY,
+#else
+   SSTR_R,
+   SSTR_G,
+   SSTR_B,
+   SSTR_Z,
+   SSTR_A,
+   SSTR_S,
+   SSTR_T,
+   SSTR_W,
+
+   SSTR_DRDX,
+   SSTR_DGDX,
+   SSTR_DBDX,
+   SSTR_DZDX,
+   SSTR_DADX,
+   SSTR_DSDX,
+   SSTR_DTDX,
+   SSTR_DWDX,
+
+   SSTR_DRDY,
+   SSTR_DGDY,
+   SSTR_DBDY,
+   SSTR_DZDY,
+   SSTR_DADY,
+   SSTR_DSDY,
+   SSTR_DTDY,
+   SSTR_DWDY,
+#endif
+   SSTR_TRIANGLECMD,
+   SSTR_RESERVED1,
+
+   SSTR_FVAX,
+   SSTR_FVAY,
+   SSTR_FVBX,
+   SSTR_FVBY,
+   SSTR_FVCX,
+   SSTR_FVCY,
+#ifdef GLIDE_USE_ALT_REGMAP
+   SSTR_FR,
+   SSTR_FDRDX,
+   SSTR_FDRDY,
+                
+   SSTR_FG,
+   SSTR_FDGDX,
+   SSTR_FDGDY,
+
+   SSTR_FB,
+   SSTR_FDBDX,
+   SSTR_FDBDY,
+
+   SSTR_FZ,
+   SSTR_FDZDX,
+   SSTR_FDZDY,
+
+   SSTR_FA,
+   SSTR_FDADX,
+   SSTR_FDADY,
+
+   SSTR_FS,
+   SSTR_FDSDX,
+   SSTR_FDSDY,
+
+   SSTR_FT,
+   SSTR_FDTDX,
+   SSTR_FDTDY,
+
+   SSTR_FW,
+   SSTR_FDWDX,
+   SSTR_FDWDY,
+#else 
+   SSTR_FR,
+   SSTR_FG,
+   SSTR_FB,
+   SSTR_FZ,
+   SSTR_FA,
+   SSTR_FS,
+   SSTR_FT,
+   SSTR_FW,
+
+   SSTR_FDRDX,
+   SSTR_FDGDX,
+   SSTR_FDBDX,
+   SSTR_FDZDX,
+   SSTR_FDADX,
+   SSTR_FDSDX,
+   SSTR_FDTDX,
+   SSTR_FDWDX,
+
+   SSTR_FDRDY,
+   SSTR_FDGDY,
+   SSTR_FDBDY,
+   SSTR_FDZDY,
+   SSTR_FDADY,
+   SSTR_FDSDY,
+   SSTR_FDTDY,
+   SSTR_FDWDY,
+#endif
+   SSTR_FTRIANGLECMD,
+   SSTR_FBZCOLORPATH,
+   SSTR_FOGMODE,
+   SSTR_ALPHAMODE,
+   SSTR_FBZMODE,
+   SSTR_LFBMODE,
+   SSTR_CLIPLEFTRIGHT,
+   SSTR_CLIPBOTTOMTOP,
+
+   SSTR_NOPCMD,
+   SSTR_FASTFILLCMD,
+   SSTR_SWAPBUFFERCMD,
+   SSTR_FOGCOLOR,
+   SSTR_ZACOLOR,
+   SSTR_CHROMAKEY,
+   SSTR_RESERVED2,
+   SSTR_RESERVED3,
+
+   SSTR_STIPPLE,
+   SSTR_C0,
+   SSTR_C1,
+
+   SSTR_FBIPIXELSIN,
+   SSTR_FBICHROMAFAIL,
+   SSTR_FBIZFUNCFAIL,
+   SSTR_FBIAFUNCFAIL,
+   SSTR_FBIPIXELSOUT,
+
+   SSTR_FOGTABLE,
+   SSTR_RESERVED8 = SSTR_FOGTABLE + 32,
+
+   SSTR_FBIINIT4 = SSTR_RESERVED8 + 8,
+   SSTR_VRETRACE,
+   SSTR_BACKPORCH,
+   SSTR_VIDEODIMENSIONS,
+   SSTR_FBIINIT0,
+   SSTR_FBIINIT1,
+   SSTR_FBIINIT2,
+   SSTR_FBIINIT3,
+
+   SSTR_HSYNC,
+   SSTR_VSYNC,
+   SSTR_CLUTDATA,
+   SSTR_DACDATA,
+   SSTR_MAX_RGB_DELTA,
+   SSTR_RESERVED51,
+
+   SSTR_TEXTUREMODE = SSTR_RESERVED51 + 51,
+   SSTR_TLOD,
+   SSTR_TDETAIL,
+   SSTR_TEXBASEADDR,
+   SSTR_TEXBASEADDR1,
+   SSTR_TEXBASEADDR2,
+   SSTR_TEXBASEADDR38,
+   SSTR_TEXINIT0,
+   SSTR_TEXINIT1,
+
+   SSTR_NCCTABLE0,
+   SSTR_NCCTABLE1 = SSTR_NCCTABLE0 + 12,
+   SSTR_END_OF_REGISTER_SET
+} GrSstRegister;
+
+#endif /* __GSSTDEF_H__ */
Index: trunk/src/opengl/glide/sst1/glide/gtex.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gtex.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gtex.c	(revision 2885)
@@ -0,0 +1,755 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gtex.c,v 1.1 2000-02-25 00:31:19 sandervl Exp $
+** $Log: gtex.c,v $
+** Revision 1.1  2000-02-25 00:31:19  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 12    3/04/97 9:08p Dow
+ * Neutered multiplatform multiheaded monster
+ * 
+ * 11    3/03/97 10:58a Jdt
+ * Fixe for 2-pass trilinear
+ * 
+ * 10    12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+**
+*/
+
+#include <3dfx.h>
+
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+extern const int _grMipMapHostWH[GR_ASPECT_1x8+1][GR_LOD_1+1][2];
+extern FxU32 _grMipMapHostSize[][16];
+extern FxU32 _gr_aspect_index_table[];
+extern FxU32 _gr_evenOdd_xlate_table[];
+extern FxU32 _gr_aspect_xlate_table[];
+
+/*---------------------------------------------------------------------------
+** grTexClampMode
+*/
+
+GR_ENTRY(grTexClampMode, void, ( GrChipID_t tmu, GrTextureClampMode_t s_clamp_mode, GrTextureClampMode_t t_clamp_mode ))
+{
+  FxU32 texturemode;
+  FxU32 clampMode = (
+    (s_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPS : 0) |
+    (t_clamp_mode == GR_TEXTURECLAMP_CLAMP ? SST_TCLAMPT : 0)
+  );
+
+  GR_BEGIN("grTexClampMode",88,4+2*PACKER_WORKAROUND_SIZE);
+  GDBG_INFO_MORE((gc->myLevel,"(%d, %d,%d)\n",tmu,s_clamp_mode,t_clamp_mode));
+  GR_CHECK_TMU(myName, tmu);
+  
+  texturemode  = gc->state.tmu_config[tmu].textureMode;
+  texturemode &= ~( SST_TCLAMPS | SST_TCLAMPT );
+  texturemode |=  clampMode;
+
+  PACKER_WORKAROUND;
+  GR_SET( SST_TMU(hw,tmu)->textureMode , texturemode );
+  PACKER_WORKAROUND;
+
+  gc->state.tmu_config[tmu].textureMode = texturemode;
+  GR_END();
+} /* grTexClampMode */
+
+/*---------------------------------------------------------------------------
+** grTexCombine
+*/
+
+GR_ENTRY(grTexCombine, void, ( GrChipID_t tmu, GrCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor,  GrCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, FxBool rgb_invert, FxBool alpha_invert ))
+{
+  FxU32 texturemode;
+  FxU32 tLod;
+  FxU32 tmuMask;
+
+  GR_BEGIN("grTexCombine",88,8+2*PACKER_WORKAROUND_SIZE);
+  GDBG_INFO_MORE((gc->myLevel,"(%d, %d,%d, %d,%d, %d,%d)\n",
+                 tmu, rgb_function, rgb_factor, 
+                 alpha_function, alpha_factor,
+                 rgb_invert, alpha_invert));
+  GR_CHECK_TMU( myName, tmu );
+  GR_CHECK_W( myName,
+               rgb_function < GR_COMBINE_FUNCTION_ZERO ||
+               rgb_function > GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA,
+               "unsupported texture color combine function" );
+  GR_CHECK_W( myName,
+               alpha_function < GR_COMBINE_FUNCTION_ZERO ||
+               alpha_function > GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA,
+               "unsupported texture alpha combine function" );
+  GR_CHECK_W( myName,
+               (rgb_factor & 0x7) < GR_COMBINE_FACTOR_ZERO ||
+               (rgb_factor & 0x7) > GR_COMBINE_FACTOR_LOD_FRACTION ||
+               rgb_factor > GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION,
+               "unsupported texture color combine scale factor" );
+  GR_CHECK_W( myName,
+               (alpha_factor & 0x7) < GR_COMBINE_FACTOR_ZERO ||
+               (alpha_factor & 0x7) > GR_COMBINE_FACTOR_LOD_FRACTION ||
+               alpha_factor > GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION,
+               "unsupported texture alpha combine scale factor" );
+
+  /* tmuMask tells grColorCombineFunction what to turn off an on if 
+     the ccFunc requires texture mapping */
+  texturemode = gc->state.tmu_config[tmu].textureMode;
+  texturemode &= ~(SST_TCOMBINE | SST_TACOMBINE);
+  tLod = gc->state.tmu_config[tmu].tLOD;
+  tLod &= ~(SST_LOD_ODD);
+
+  tmuMask = GR_TMUMASK_TMU0 << tmu;
+  gc->state.tmuMask &= ~tmuMask;
+
+  /* setup scale factor bits */
+  texturemode |= ( rgb_factor & 0x7 ) << SST_TC_MSELECT_SHIFT;
+
+  if ( !( rgb_factor & 0x8 ) )
+    texturemode |= SST_TC_REVERSE_BLEND;
+
+  if ( ( ( rgb_factor & 0x7 ) == GR_COMBINE_FACTOR_LOCAL ) ||
+       ( ( rgb_factor & 0x7 ) == GR_COMBINE_FACTOR_LOCAL_ALPHA ) )
+    gc->state.tmuMask |= tmuMask;
+
+  texturemode |= ( alpha_factor & 0x7 ) << SST_TCA_MSELECT_SHIFT;
+
+  if ( !( alpha_factor & 0x8 ) )
+    texturemode |= SST_TCA_REVERSE_BLEND;
+
+  if ( ( ( alpha_factor & 0x7 ) == GR_COMBINE_FACTOR_LOCAL ) ||
+       ( ( alpha_factor & 0x7 ) == GR_COMBINE_FACTOR_LOCAL_ALPHA ) )
+    gc->state.tmuMask |= tmuMask;
+
+  /* setup invert output bits */
+
+  if ( rgb_invert )
+    texturemode |= SST_TC_INVERT_OUTPUT;
+
+  if ( alpha_invert )
+    texturemode |= SST_TCA_INVERT_OUTPUT;
+
+  /* setup core color combine unit bits */
+  
+  switch ( rgb_function )
+  {
+  case GR_COMBINE_FUNCTION_ZERO:
+    texturemode |= SST_TC_ZERO_OTHER;
+    break;
+
+  case GR_COMBINE_FUNCTION_LOCAL:
+    texturemode |= SST_TC_ZERO_OTHER | SST_TC_ADD_CLOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
+    texturemode |= SST_TC_ZERO_OTHER | SST_TC_ADD_ALOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER:
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
+    texturemode |= SST_TC_ADD_CLOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
+    texturemode |= SST_TC_ADD_ALOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
+    texturemode |= SST_TC_SUB_CLOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
+    texturemode |= SST_TC_SUB_CLOCAL | SST_TC_ADD_CLOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+    texturemode |= SST_TC_SUB_CLOCAL | SST_TC_ADD_ALOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
+    texturemode |= SST_TC_ZERO_OTHER | SST_TC_SUB_CLOCAL | SST_TC_ADD_CLOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+    texturemode |= SST_TC_ZERO_OTHER | SST_TC_SUB_CLOCAL | SST_TC_ADD_ALOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+  }
+  
+  switch ( alpha_function )
+  {
+  case GR_COMBINE_FUNCTION_ZERO:
+    texturemode |= SST_TCA_ZERO_OTHER;
+    break;
+
+  case GR_COMBINE_FUNCTION_LOCAL:
+    texturemode |= SST_TCA_ZERO_OTHER | SST_TCA_ADD_CLOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
+    texturemode |= SST_TCA_ZERO_OTHER | SST_TCA_ADD_ALOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER:
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
+    texturemode |= SST_TCA_ADD_CLOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
+    texturemode |= SST_TCA_ADD_ALOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
+    texturemode |= SST_TCA_SUB_CLOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
+    texturemode |= SST_TCA_SUB_CLOCAL | SST_TCA_ADD_CLOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+    texturemode |= SST_TCA_SUB_CLOCAL | SST_TCA_ADD_ALOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
+    texturemode |= SST_TCA_ZERO_OTHER | SST_TCA_SUB_CLOCAL | SST_TCA_ADD_CLOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+
+  case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+    texturemode |= SST_TCA_ZERO_OTHER | SST_TCA_SUB_CLOCAL | SST_TCA_ADD_ALOCAL;
+    gc->state.tmuMask |= tmuMask;
+    break;
+  }
+  
+  /* Hack to enable TWO-PASS Trilinear 
+     
+   */
+  if ( texturemode & SST_TRILINEAR ) {
+    if ( ( texturemode & SST_TC_ZERO_OTHER ) &&
+         ( texturemode & SST_TC_BLEND_LODFRAC ) &&
+         !( texturemode & SST_TC_REVERSE_BLEND ) ) {
+        tLod |= SST_LOD_ODD;
+    }
+  }
+  tLod |= _gr_evenOdd_xlate_table[gc->state.tmu_config[tmu].evenOdd];
+
+  /* update register */
+  PACKER_WORKAROUND;
+  GR_SET( SST_TMU(hw,tmu)->textureMode , texturemode );
+  GR_SET( SST_TMU(hw,tmu)->tLOD, tLod );
+  PACKER_WORKAROUND;
+  gc->state.tmu_config[tmu].textureMode = texturemode;
+  gc->state.tmu_config[tmu].tLOD = tLod;
+
+  /* update paramIndex */
+  _grUpdateParamIndex();
+
+  GR_END();
+} /* grTexCombine */
+
+/*
+** _grTexDetailControl, NOTE: its up to caller to account for bytes
+*/
+GR_DDFUNC(_grTexDetailControl, void, ( GrChipID_t tmu, FxU32 detail ))
+{
+  GR_BEGIN("_grTexDetailControl",88,4+2*PACKER_WORKAROUND_SIZE);
+
+  GR_CHECK_TMU( "_grTexDetailControl", tmu );
+
+  PACKER_WORKAROUND;
+  GR_SET( SST_TMU(hw,tmu)->tDetail , detail );
+  PACKER_WORKAROUND;
+  gc->state.tmu_config[tmu].tDetail = detail;
+  GR_END();
+} /* _grTexDetailControl */
+
+/*---------------------------------------------------------------------------
+** grTexFilterMode
+*/
+
+GR_ENTRY(grTexFilterMode, void, ( GrChipID_t tmu, GrTextureFilterMode_t minfilter, GrTextureFilterMode_t magfilter ))
+{
+  FxU32 texMode;
+
+  GR_BEGIN("grTexFilterMode",99,4+2*PACKER_WORKAROUND_SIZE);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,%d)\n",tmu,minfilter,magfilter));
+  GR_CHECK_TMU( myName, tmu );
+
+  texMode  = gc->state.tmu_config[tmu].textureMode;
+  texMode &= ~( SST_TMINFILTER | SST_TMAGFILTER );
+  texMode |= (minfilter == GR_TEXTUREFILTER_BILINEAR ? SST_TMINFILTER : 0) |
+             (magfilter == GR_TEXTUREFILTER_BILINEAR ? SST_TMAGFILTER : 0);
+
+  PACKER_WORKAROUND;
+  GR_SET( SST_TMU(hw,tmu)->textureMode , texMode );
+  PACKER_WORKAROUND;
+  gc->state.tmu_config[tmu].textureMode = texMode;
+  GR_END();
+} /* grTexFilterMode */
+
+/*---------------------------------------------------------------------------
+** grTexLodBiasValue
+*/
+
+GR_ENTRY(grTexLodBiasValue, void, ( GrChipID_t tmu, float fvalue ))
+{
+  FxU32 tLod;
+  
+  GR_BEGIN("grTexLodBiasValue",88,4+2*PACKER_WORKAROUND_SIZE);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%g)\n",tmu,fvalue));
+  GR_CHECK_TMU(myName,tmu);
+  
+  tLod = gc->state.tmu_config[tmu].tLOD;
+  tLod &= ~( SST_LODBIAS );
+  tLod |= _grTexFloatLODToFixedLOD( fvalue ) << SST_LODBIAS_SHIFT;
+
+  PACKER_WORKAROUND;
+  GR_SET( SST_TMU(hw,tmu)->tLOD , tLod );
+  PACKER_WORKAROUND;
+
+  gc->state.tmu_config[tmu].tLOD = tLod;
+  GR_END();
+} /* grTexLodBiasValue */
+
+/*-------------------------------------------------------------------
+  Function: grTexMipMapMode
+  Date: 6/2
+  Implementor(s): GaryMcT, Jdt
+  Library: glide
+  Description:
+    Sets the mip map mode for the specified TMU
+    "Ex" because glide's grTexMipMapMode is inadequate for 
+    low level texture memory management
+  Arguments:
+    tmu       - tmu to update
+    mmMode   - mipmap mode 
+      One of:
+        GR_MIPMAP_DISABLE
+        GR_MIPMAP_NEAREST
+        GR_MIPMAP_NEAREST_DITHER
+    lodBlend - enable lodBlending
+      FXTRUE  - enabled
+      FXFALSE - disabled
+  Return:
+  none
+  -------------------------------------------------------------------*/
+
+GR_ENTRY(grTexMipMapMode, void, ( GrChipID_t tmu, GrMipMapMode_t mmMode, FxBool lodBlend ))
+{
+  FxU32
+    tLod,
+    texMode;
+
+  GR_BEGIN("grTexMipMapMode",88,8+2*PACKER_WORKAROUND_SIZE);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,%d)\n",tmu,mmMode,lodBlend));
+  GR_CHECK_TMU(myName,tmu);
+  
+  /*--------------------------------------------------------------
+    Get Current tLod and texMode register values
+    --------------------------------------------------------------*/
+  tLod  = gc->state.tmu_config[tmu].tLOD;
+  texMode = gc->state.tmu_config[tmu].textureMode;
+
+  /*--------------------------------------------------------------
+    Clear LODMIN, LODMAX and LODDITHER
+    --------------------------------------------------------------*/
+  tLod  &= ~(SST_LODMIN|SST_LODMAX|SST_LOD_ODD);
+  texMode &= ~(SST_TLODDITHER|SST_TRILINEAR);
+
+  /*--------------------------------------------------------------
+    Encode Mipmap Mode Bits
+    --------------------------------------------------------------*/
+  switch ( mmMode ) {
+  case GR_MIPMAP_DISABLE:
+    /*----------------------------------------------------------
+      To disable mipmapping set the min and max lods to the same
+      value
+      ----------------------------------------------------------*/
+    tLod |= SST_TLOD_MINMAX_INT(gc->state.tmu_config[tmu].largeLod,
+                                gc->state.tmu_config[tmu].largeLod);
+    break;
+  case GR_MIPMAP_NEAREST_DITHER:
+    if (gc->state.allowLODdither)
+      texMode |= SST_TLODDITHER;
+    /* intentional fall-through to set lodmin and lodmax values */
+  case GR_MIPMAP_NEAREST:
+    /*----------------------------------------------------------
+      Set LODMIN and LODMAX in the tLod register to the 
+      actual min and max LODs of the current texture.
+      ----------------------------------------------------------*/
+    tLod |= SST_TLOD_MINMAX_INT(gc->state.tmu_config[tmu].largeLod,
+                                gc->state.tmu_config[tmu].smallLod);
+    break;
+  default:
+    GrErrorCallback( "grTexMipMapMode:  invalid mode passed", FXFALSE );
+    break;
+  }
+  gc->state.tmu_config[tmu].mmMode = mmMode;
+  
+  /*--------------------------------------------------------------
+    Fix trilinear and evenOdd bits -
+
+    This is a bit of a hack to make two pass trilinear work with
+    full textures.  The assumption here is that the only reason
+    you would ever set up Multiply by LODFRAC w/o REVERSE BLEND
+    is for the ODD pass of trilinear.  
+    --------------------------------------------------------------*/
+  if ( lodBlend ) {
+    texMode |= SST_TRILINEAR;
+    if ( ( texMode & SST_TC_ZERO_OTHER ) &&
+         ( texMode & SST_TC_BLEND_LODFRAC ) &&
+         !( texMode & SST_TC_REVERSE_BLEND ) ) {
+        tLod |= SST_LOD_ODD;
+    }
+  }
+  tLod |= _gr_evenOdd_xlate_table[gc->state.tmu_config[tmu].evenOdd];
+  
+  /*--------------------------------------------------------------
+    Write State To Hardware and Update Glide Shadow State
+    --------------------------------------------------------------*/
+  PACKER_WORKAROUND;
+  hw = SST_TMU(hw,tmu);
+  GR_SET( hw->tLOD , tLod );
+  GR_SET( hw->textureMode , texMode );
+  PACKER_WORKAROUND;
+
+  gc->state.tmu_config[tmu].tLOD        = tLod;
+  gc->state.tmu_config[tmu].textureMode = texMode;
+  GR_END();
+} /* grTexMipMapMode */
+
+/*-------------------------------------------------------------------
+  Function: grTexMinAddress
+  Date: 6/2
+  Implementor(s): GaryMcT, Jdt
+  Library: glide
+  Description:
+    Returns address of start of texture ram for a TMU
+  Arguments:
+    tmu
+  Return:
+    integer texture base address, this pointer is not to be dereferenced
+    by the application, it is on to be used by grTexDownload(),
+    and grTExDownloadLevel()
+  -------------------------------------------------------------------*/
+/*-------------------------------------------------------------------
+  Function: grTexNCCTable
+  Date: 6/3
+  Implementor(s): jdt
+  Library: glide
+  Description:
+    select one of the two NCC tables
+  Arguments:
+    tmu - which tmu
+    table - which table to select
+        One of:
+            GR_TEXTABLE_NCC0
+            GR_TEXTABLE_NCC1
+            GR_TEXTABLE_PALETTE
+  Return:
+    none
+  -------------------------------------------------------------------*/
+
+GR_ENTRY(grTexNCCTable, void, ( GrChipID_t tmu, GrNCCTable_t table ))
+{
+  FxU32 texMode;
+  
+  GR_BEGIN("grTexNCCTable",88,4+2*PACKER_WORKAROUND_SIZE);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",tmu));
+  GR_CHECK_TMU(myName,tmu);
+  GR_CHECK_F(myName, table>0x1, "invalid ncc table specified");
+
+  /*------------------------------------------------------------------
+    Update local state
+    ------------------------------------------------------------------*/
+  gc->state.tmu_config[tmu].nccTable = table;
+  
+  /*------------------------------------------------------------------
+    Grab shadow texMode, update TexMode, update shadow/real register
+    ------------------------------------------------------------------*/
+  texMode  = gc->state.tmu_config[tmu].textureMode;
+  texMode &= ~( SST_TNCCSELECT );
+  if ( table )
+    texMode |= SST_TNCCSELECT;
+  else 
+    texMode &= ~(SST_TNCCSELECT);
+
+  PACKER_WORKAROUND;
+  GR_SET( SST_TMU(hw,tmu)->textureMode , texMode );
+  PACKER_WORKAROUND;
+
+  gc->state.tmu_config[tmu].textureMode = texMode;
+  GR_END();
+} /* grTexNCCTable */
+
+
+/*-------------------------------------------------------------------
+  Function: grTexSource
+  Date: 6/2
+  Implementor(s): GaryMcT, Jdt
+  Library: glide
+  Description:
+    Sets up the current texture for texture mapping on the specified
+    TMU.
+  Arguments:
+    tmu          - which tmu
+    startAddress - texture start address
+    evenOdd  - which set of mipmap levels have been downloaded for
+                the selected texture
+                One of:
+                  GR_MIPMAPLEVELMASK_EVEN 
+                  GR_MIPMAPLEVELMASK_ODD
+                  GR_MIPMAPLEVELMASK_BOTH
+    info         - pointer to GrTexInfo structure containing
+                   texture dimensions
+  Return:
+    none
+  -------------------------------------------------------------------*/
+
+GR_ENTRY(grTexSource, void, ( GrChipID_t tmu, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info ))
+{
+  FxU32 baseAddress, texMode, tLod;
+
+  GR_BEGIN("grTexSource",88,12+2*PACKER_WORKAROUND_SIZE);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x,%d,0x%x)\n",tmu,startAddress,evenOdd,info));
+  GR_CHECK_TMU( myName, tmu );
+  GR_CHECK_F( myName, startAddress >= gc->tmu_state[tmu].total_mem, "invalid startAddress" );
+  GR_CHECK_F( myName,
+               startAddress + grTexTextureMemRequired( evenOdd, info ) >= gc->tmu_state[tmu].total_mem,
+               "insufficient texture ram at startAddress" );
+  GR_CHECK_F( myName, evenOdd > 0x3 || evenOdd == 0, "evenOdd mask invalid");
+  GR_CHECK_F( myName, !info, "invalid info pointer" );
+  
+  /*-------------------------------------------------------------
+    Update Texture Unit State
+    -------------------------------------------------------------*/
+  gc->state.tmu_config[tmu].smallLod = info->smallLod; 
+  gc->state.tmu_config[tmu].largeLod = info->largeLod; 
+  gc->state.tmu_config[tmu].evenOdd  =  evenOdd; 
+  
+  /*-------------------------------------------------------------
+    Calculate Base Address
+    -------------------------------------------------------------*/
+  baseAddress = _grTexCalcBaseAddress( startAddress,
+                                       info->largeLod, 
+                                       info->aspectRatio,
+                                       info->format,
+                                       evenOdd ) >> 3;
+  /*-------------------------------------------------------------
+    Update Texture Mode
+    -------------------------------------------------------------*/
+  texMode = gc->state.tmu_config[tmu].textureMode;
+  texMode &= ~SST_TFORMAT;
+  texMode |= ( info->format << SST_TFORMAT_SHIFT ) | SST_TPERSP_ST | SST_TCLAMPW;
+  
+  /*-------------------------------------------------------------
+    Compute TLOD (keep LODBIAS in tact)
+    -------------------------------------------------------------*/
+  tLod = gc->state.tmu_config[tmu].tLOD;
+  tLod &= ~(SST_LODMIN | SST_LODMAX | SST_LOD_ASPECT |
+            SST_LOD_TSPLIT | SST_LOD_ODD | SST_LOD_S_IS_WIDER);
+  tLod |= SST_TLOD_MINMAX_INT(info->largeLod,
+                     gc->state.tmu_config[tmu].mmMode==GR_MIPMAP_DISABLE ? 
+                              info->largeLod : info->smallLod);
+  tLod |= _gr_evenOdd_xlate_table[evenOdd];
+  tLod |= _gr_aspect_xlate_table[info->aspectRatio];
+
+  /* Write relevant registers out to hardware */
+  PACKER_WORKAROUND;
+  hw = SST_TMU(hw,tmu);
+  GR_SET( hw->texBaseAddr , baseAddress );
+  GR_SET( hw->textureMode , texMode );
+  GR_SET( hw->tLOD , tLod );
+  PACKER_WORKAROUND;
+  
+  /* update shadows */
+  gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 
+  gc->state.tmu_config[tmu].textureMode = texMode; 
+  gc->state.tmu_config[tmu].tLOD        = tLod; 
+  
+  GR_END();
+} /* grTexSource */
+
+
+/*-------------------------------------------------------------------
+  Function: grTexMultibase
+  Date: 11/4/96
+  Implementor(s): gmt
+  Library: Glide
+  Description:
+    Enable multiple base addresses for texturing.
+  Arguments:
+    tmu    - which tmu
+    enable - flag which enables/disables multibase
+  Return:
+    none
+  -------------------------------------------------------------------*/
+
+GR_ENTRY(grTexMultibase, void, ( GrChipID_t tmu, FxBool enable ))
+{
+  FxU32 tLod;
+    
+  GR_BEGIN("grTexMultibase",88,4+PACKER_WORKAROUND_SIZE);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d)\n",tmu,enable));
+  GR_CHECK_TMU(myName,tmu);
+  
+  tLod  = gc->state.tmu_config[tmu].tLOD;
+  if ( enable )
+    tLod |= SST_TMULTIBASEADDR;
+  else
+    tLod &= ~SST_TMULTIBASEADDR;
+  /*--------------------------------------------------------------
+    Write State To Hardware and Update Glide Shadow State
+    --------------------------------------------------------------*/
+  PACKER_WORKAROUND;
+  GR_SET( SST_TMU(hw,tmu)->tLOD , tLod );
+  PACKER_WORKAROUND;
+
+  gc->state.tmu_config[tmu].tLOD = tLod;
+  GR_END();
+} /* grTexMultibase */
+
+/*-------------------------------------------------------------------
+  Function: grTexMultibaseAddress
+  Date: 11/4/96
+  Implementor(s): gmt
+  Library: Glide
+  Description:
+    Set the base address for a particular set of mipmaps
+  Arguments:
+    tmu    - which tmu
+    range  - range of lods that are based at this starting address
+             One of:
+             GR_TEXBASE_256
+             GR_TEXBASE_128
+             GR_TEXBASE_64
+             GR_TEXBASE_32_TO_1
+    startAddress - start address that data was downloaded to 
+                    hardware with using grTexDownload/Level
+    info         - pointer to GrTexInfo structure containing
+                   texture dimensions
+  Return:
+    none
+  -------------------------------------------------------------------*/
+
+GR_ENTRY(grTexMultibaseAddress, void, ( GrChipID_t tmu, GrTexBaseRange_t range, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info ))
+{
+  FxU32 baseAddress;
+
+  GR_BEGIN("grTexMultibaseAddress",88,4+PACKER_WORKAROUND_SIZE);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,0x%x)\n",tmu,range,startAddress));
+  GR_CHECK_TMU( myName, tmu );
+  GR_CHECK_F( myName, range > GR_TEXBASE_32_TO_1, "invalid range" );
+  GR_CHECK_F( myName, startAddress >= gc->tmu_state[tmu].total_mem, "invalid startAddress" );
+  GR_CHECK_F( myName, evenOdd > 0x3, "evenOdd mask invalid" );
+  GR_CHECK_F( myName, info, "invalid info pointer" );
+  
+
+  /* Write relevant registers out to hardware and shadows */
+  PACKER_WORKAROUND;
+  hw = SST_TMU(hw,tmu);
+  switch (range) {
+    case GR_TEXBASE_256:
+      baseAddress = _grTexCalcBaseAddress( startAddress,
+                                           GR_LOD_256,
+                                           info->aspectRatio,
+                                           info->format,
+                                           evenOdd ) >> 3;
+      GR_SET( hw->texBaseAddr , baseAddress );
+      gc->state.tmu_config[tmu].texBaseAddr = baseAddress; 
+      break;
+    case GR_TEXBASE_128:
+      baseAddress = _grTexCalcBaseAddress( startAddress,
+                                           GR_LOD_128,
+                                           info->aspectRatio,
+                                           info->format,
+                                           evenOdd ) >> 3;
+      GR_SET( hw->texBaseAddr1 , baseAddress );
+      gc->state.tmu_config[tmu].texBaseAddr_1 = baseAddress; 
+      break;
+    case GR_TEXBASE_64:
+      baseAddress = _grTexCalcBaseAddress( startAddress,
+                                           GR_LOD_64,
+                                           info->aspectRatio,
+                                           info->format,
+                                           evenOdd ) >> 3;
+      GR_SET( hw->texBaseAddr2 , baseAddress );
+      gc->state.tmu_config[tmu].texBaseAddr_2 = baseAddress; 
+      break;
+    case GR_TEXBASE_32_TO_1:
+      baseAddress = _grTexCalcBaseAddress( startAddress,
+                                           GR_LOD_32,
+                                           info->aspectRatio,
+                                           info->format,
+                                           evenOdd ) >> 3;
+      GR_SET( hw->texBaseAddr38 , baseAddress );
+      gc->state.tmu_config[tmu].texBaseAddr_3_8 = baseAddress; 
+      break;
+  }
+  PACKER_WORKAROUND;
+  GR_END();
+} /* grTexMultibaseAddress */
+
+#if 0
+/*
+** _grTexForceLod
+**
+** Forces tLOD to a specific LOD level.  This is useful only for
+** debugging purposes.  GMT: obsolete, please remove
+*/
+void 
+_grTexForceLod( GrChipID_t tmu, int value )
+{
+  GR_DCL_GC;
+  GR_DCL_HW;
+  FxU32 tLod = gc->state.tmu_config[0].tLOD;
+
+  GR_CHECK_TMU("_grTexForceLod",tmu);
+
+  tLod &= ~(SST_LODMIN | SST_LODMAX);
+  tLod |= SST_TLOD_MINMAX_INT(value,value);
+
+  PACKER_WORKAROUND;
+  GR_SET( SST_TMU(hw,tmu)->tLOD , tLod );
+  PACKER_WORKAROUND;
+  gc->state.tmu_config[tmu].tLOD = tLod;
+} /* _grTexForceLod */
+#endif
Index: trunk/src/opengl/glide/sst1/glide/gtexdl.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gtexdl.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gtexdl.c	(revision 2885)
@@ -0,0 +1,728 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gtexdl.c,v 1.1 2000-02-25 00:31:19 sandervl Exp $
+** $Log: gtexdl.c,v $
+** Revision 1.1  2000-02-25 00:31:19  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 28    6/19/97 7:35p Dow
+ * More P6 Stuff
+ * 
+ * 27    6/10/97 3:59p Garymct
+ * Fixed a bug in a sanity checking macro.
+ * 
+ * 26    6/10/97 11:09a Pgj
+ * fix 8-bit & optimize
+ * 
+ * 25    6/08/97 11:06p Pgj
+ * use Group Write for Texture Downloads
+ * 
+ * 24    5/09/97 5:12p Jdt
+ * Removed redundant download of NCC Table
+ * 
+ * 23    3/18/97 9:07p Dow
+ * Got rid of #$#%#$ // comments
+ * 
+ * 22    3/15/97 8:08p Jdt
+ * Moved grTexDownloadTable into this file as it not precisely DI.
+ * 
+ * 21    3/04/97 9:08p Dow
+ * Neutered multiplatform multiheaded monster
+ * 
+ * 20    2/26/97 11:58a Jdt
+ * fixed a warning
+ * 
+ * 19    2/19/97 4:25p Hanson
+ * Added Gary T's changes to the expected size value for texture downloads
+ * 
+ * 18    2/18/97 9:52a Jdt
+ * Fixed some warnings.
+ * 
+ * 17    2/12/97 2:09p Hanson
+ * Hopefully removed the rest of my muckage. 
+ * 
+ * 16    2/12/97 12:34p Dow
+ * Fixed Hanson muckage
+ * 
+ * 15    2/12/97 12:03p Hanson
+ * Adjusted Convert and download code for Descent
+ * 
+ * 14    2/12/97 11:30a Hanson
+ * Added ConvertRle function
+ * 
+ * 13    1/27/97 2:29p Murali
+ * Changed texture download code to help compiler use registers optimally.
+ * 
+ * 12    12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+ * 
+ * 11    11/18/96 9:13a Sellers
+ * fixed bug in checking for crossing of 2 MByte texture boundry
+**
+*/
+
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+/* externals from gtex.c */
+extern FxU32 _gr_aspect_xlate_table[];
+extern FxU32 _gr_evenOdd_xlate_table[];
+extern const int _grMipMapHostWH[GR_ASPECT_1x8+1][GR_LOD_1+1][2];
+
+/*---------------------------------------------------------------------------
+** _grTexDownloadNccTable
+**
+** Downloads an ncctable to the specified _physical_ TMU(s).  This
+** function is called internally by Glide and should not be executed
+** by an application.
+*/
+GR_DDFUNC(_grTexDownloadNccTable, void, ( GrChipID_t tmu, FxU32 which, const GuNccTable *table, int start, int end ))
+{
+  int i;
+  FxU32 *hwNCC;
+  
+  GR_BEGIN_NOFIFOCHECK("_grTexDownloadNccTable",89);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d, 0x%x, %d,%d)\n",tmu,which,table,start,end));
+  GR_ASSERT( start==0 );
+  GR_ASSERT( end==11 );
+
+  /* check for null pointer */
+  if ( table == 0 )
+    return;
+  _GlideRoot.stats.palDownloads++;
+  _GlideRoot.stats.palBytes += (end-start+1)<<2;
+
+  if (gc->tmu_state[tmu].ncc_table[which] != table ) {
+    GR_SET_EXPECTED_SIZE(48+2*PACKER_WORKAROUND_SIZE);
+    PACKER_WORKAROUND;
+    hw = SST_TMU(hw,tmu);
+    hwNCC = which == 0 ? hw->nccTable0 : hw->nccTable1;
+
+    for ( i = 0; i < 12; i++ )
+      GR_SET(hwNCC[i], table->packed_data[i] );
+
+    gc->tmu_state[tmu].ncc_table[which] = table;
+    PACKER_WORKAROUND;
+    P6FENCE;
+    GR_CHECK_SIZE();
+  }
+  GR_END();
+} /* _grTexDownloadNccTable */
+
+/*-------------------------------------------------------------------
+  Function: grTexDownloadTable
+  Date: 6/3
+  Implementor(s): jdt, GaryMcT
+  Library: glide
+  Description:
+    download look up table data to a tmu
+  Arguments:
+    tmu - which tmu
+    type - what type of table to download
+        One of:
+            GR_TEXTABLE_NCC0
+            GR_TEXTABLE_NCC1
+            GR_TEXTABLE_PALETTE
+    void *data - pointer to table data
+  Return:
+    none
+  -------------------------------------------------------------------*/
+GR_ENTRY(grTexDownloadTable, void,
+         ( GrChipID_t tmu, GrTexTable_t type,  void *data ))
+{
+  GR_BEGIN_NOFIFOCHECK("grTexDownloadTable",89);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,%d,0x%x)\n",tmu,type,data));
+  GR_CHECK_TMU(myName,tmu);
+  GR_CHECK_F(myName, type > 0x2, "invalid table specified");
+  GR_CHECK_F(myName, !data, "invalid data pointer");
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
+  GR_CHECK_F(myName, _GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].sstBoard.VoodooConfig.tmuConfig[0].tmuRev < 1,
+               "Texelfx rev 0 does not support paletted textures");
+#endif
+
+  if ( type == GR_TEXTABLE_PALETTE )     /* Need Palette Download Code */
+    _grTexDownloadPalette( tmu, (GuTexPalette *)data, 0, 255 );
+  else {                                 /* Type is an ncc table */
+    _grTexDownloadNccTable( tmu, type, (GuNccTable*)data, 0, 11 );
+    /*    _grTexDownloadNccTable( tmu, type, (GuNccTable*)data, 0, 11 ); */
+  }
+  GR_END();
+} /* grTexDownloadTable */
+
+
+/*-------------------------------------------------------------------
+  Function: grTexDownloadMipMapLevelPartial
+  Date: 6/2
+  Implementor(s): GaryMcT, Jdt
+  Library: glide
+  Description:
+    Downloads a mipmap level to the specified tmu at the given
+    texture start address
+  Arguments:
+    tmu           - which tmu
+    startAddress - starting address for texture download,
+                     this should be some value between grTexMinAddress()
+                     and grTexMaxAddress()
+    thisLod      - lod constant that describes the mipmap level
+                    to be downloaded
+    largeLod     - largest level of detail in complete mipmap to 
+                   be downloaded at startAddress of which level to
+                   be downloaded is a part
+    aspectRatio  - aspect ratio of this mipmap
+    format        - format of mipmap image data
+    evenOdd      - which set of mipmap levels have been downloaded for
+                    the selected texture
+                    One of:
+                      GR_MIPMAPLEVELMASK_EVEN 
+                      GR_MIPMAPLEVELMASK_ODD
+                      GR_MIPMAPLEVELMASK_BOTH
+    data          - pointer to mipmap data
+  Return:
+    none
+  -------------------------------------------------------------------*/
+
+GR_ENTRY(grTexDownloadMipMapLevelPartial, void, ( GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod, GrLOD_t largeLod, GrAspectRatio_t   aspectRatio, GrTextureFormat_t format, FxU32 evenOdd, void *data, int t, int max_t ))
+{
+  const FxU8  *src8  = ( const FxU8  * ) data; 
+  const FxU16 *src16 = ( const FxU16 * ) data;
+  FxI32   sh, bytesPerTexel;
+  FxU32 max_s, s, width, tex_address, tmu_baseaddress;
+  FxU32 tLod, texMode, baseAddress,size;
+
+  GR_BEGIN_NOFIFOCHECK("grTexDownloadMipMapLevelPartial",89);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x, %d,%d,%d, %d,%d 0x%x, %d,%d)\n",
+                  tmu,startAddress,thisLod,largeLod,aspectRatio,
+                  format,evenOdd,data,t,max_t));
+  size = _grTexTextureMemRequired(thisLod, thisLod, aspectRatio, format, evenOdd);
+  GR_CHECK_TMU(myName, tmu);
+  GR_CHECK_F(myName, startAddress + size > gc->tmu_state[tmu].total_mem,
+               "insufficient texture ram at startAddress" );
+  GR_CHECK_F(myName, startAddress & 0x7, "unaligned startAddress");
+  GR_CHECK_F(myName, thisLod > GR_LOD_1, "thisLod invalid");
+  GR_CHECK_F(myName, largeLod > GR_LOD_1, "largeLod invalid");
+  GR_CHECK_F(myName, thisLod < largeLod, "thisLod may not be larger than largeLod");
+  GR_CHECK_F(myName, aspectRatio > GR_ASPECT_1x8 || aspectRatio < GR_ASPECT_8x1, "aspectRatio invalid");
+  GR_CHECK_F(myName, evenOdd > 0x3 || evenOdd == 0, "evenOdd mask invalid");
+  GR_CHECK_F(myName, !data, "invalid data pointer");
+  GR_CHECK_F(myName, max_t >= _grMipMapHostWH[aspectRatio][thisLod][1], "invalid end row");
+
+  if ((startAddress < 0x200000) && (startAddress + size > 0x200000))
+    GrErrorCallback("grTexDownloadMipMapLevelPartial: mipmap level cannot span 2 Mbyte boundary",FXTRUE);
+
+  /*------------------------------------------------------------
+    Skip this level entirely if not in odd/even mask
+    ------------------------------------------------------------*/
+  if ( !(evenOdd & (thisLod & 0x1 ? GR_MIPMAPLEVELMASK_ODD:GR_MIPMAPLEVELMASK_EVEN)))
+      goto all_done;
+
+  /*------------------------------------------------------------
+    Determine max_s
+    ------------------------------------------------------------*/
+  width = _grMipMapHostWH[aspectRatio][thisLod][0];
+  if ( format < GR_TEXFMT_16BIT ) { /* 8-bit texture */
+    bytesPerTexel = 1;
+    max_s = width >> 2;
+    if ( max_s <= 0 )
+      max_s = 1;
+  } else { /* 16-bit texture */
+    bytesPerTexel = 2;
+    max_s = width >> 1;
+    if ( max_s <= 0 )
+      max_s = 1;
+  }
+  /* assume max_s is a power of two */
+  GR_ASSERT(( (max_s) & (max_s -1) ) == 0);
+
+  
+  /*------------------------------------------------------------
+    Compute Base Address Given Start Address Offset
+    ------------------------------------------------------------*/
+  baseAddress = _grTexCalcBaseAddress( startAddress,
+                                       largeLod, 
+                                       aspectRatio,
+                                       format,
+                                       evenOdd );
+  baseAddress >>= 3;
+
+  /*------------------------------------------------------------
+    Compute Physical Write Pointer
+    ------------------------------------------------------------*/
+  tmu_baseaddress = (FxU32)gc->tex_ptr;
+  tmu_baseaddress += (((FxU32)tmu)<<21) + (((FxU32)thisLod)<<17);
+  
+  /*------------------------------------------------------------
+    Compute pertinant contents of tLOD and texMode registers 
+    ------------------------------------------------------------*/
+  tLod = SST_TLOD_MINMAX_INT(largeLod,GR_LOD_1);
+  tLod |= _gr_evenOdd_xlate_table[evenOdd];
+  tLod |= _gr_aspect_xlate_table[aspectRatio];
+  texMode = format << SST_TFORMAT_SHIFT;
+  if (gc->state.tmu_config[tmu].textureMode & SST_SEQ_8_DOWNLD) {
+    sh = 2;
+    texMode |= SST_SEQ_8_DOWNLD;
+  }
+  else sh = 3;
+
+  /* account for 3 register writes and for smallest 1xN and 2xN levels */
+  /* and also 4xN level for 8-bit textures (or 4x32x8bpp) */
+  /* Also note that each texture write requires 10 actual fifo entry bytes */
+  /* but since we are counting bytes/2 we multiply by 5 */
+  GR_SET_EXPECTED_SIZE(3*4 + 2*PACKER_WORKAROUND_SIZE + 32*5);
+
+  /*------------------------------------------------------------
+    Update TLOD, texMode, baseAddress
+    ------------------------------------------------------------*/
+  PACKER_WORKAROUND;
+  hw = SST_TMU(hw,tmu);
+  GR_SET( hw->texBaseAddr , baseAddress );
+  GR_SET( hw->textureMode , texMode );
+  GR_SET( hw->tLOD , tLod );
+  PACKER_WORKAROUND;
+
+  /* Flush the write buffers before the texture downloads */
+  P6FENCE;
+  _GlideRoot.stats.texBytes += max_s * (max_t-t+1) * 4;
+
+# define SET_TRAM(a,b) GR_SET( *((FxU32 *)(a)) , (b) )
+  /*------------------------------------------------------------
+    Handle 8-bit Textures
+    ------------------------------------------------------------*/
+  if ( format < GR_TEXFMT_16BIT ) { /* 8 bit textures */
+    switch( width ) {
+    /* Cases 1, 2 and 4 don't need inner loops for s */
+    case 1:                         /* 1xN texture */
+      tex_address = tmu_baseaddress + ( t << 9 );
+      for ( ; t <= max_t; t++) {
+        SET_TRAM( tex_address, *(const FxU8*) src8);
+        src8 += 1;
+        tex_address += (1 << 9); 
+      }
+      break;
+
+    case 2:                         /* 2xN texture */
+      tex_address = tmu_baseaddress + ( t << 9 );
+      for ( ; t <= max_t; t++) {
+        SET_TRAM( tex_address, *(const FxU16*) src8);
+        src8 += 2;
+        tex_address += (1 << 9); 
+      }
+      break;
+
+    case 4:                         /* 4xN texture */
+      tex_address = tmu_baseaddress + ( t << 9 );
+      for ( ; t <= max_t; t++) {
+        SET_TRAM( tex_address, *(const FxU32*) src8);
+        src8 += 4;
+        tex_address += (1 << 9); 
+      }
+      break;
+
+    default:                        /* >4xN texture */
+      if (sh == 3) {                /* Old TMUs */
+        /* Inner loop unrolled to process 2 dwords per iteration */
+        for ( ; t <= max_t; t++) {
+          GR_CHECK_SIZE_SLOPPY();
+          GR_SET_EXPECTED_SIZE(max_s*5);
+          tex_address = tmu_baseaddress + ( t << 9 );
+          for ( s = 0; s < max_s; s+=2) {
+            FxU32  t0, t1;
+
+            t0 = * (const FxU32 *) (src8    );
+            t1 = * (const FxU32 *) (src8 + 4);
+            SET_TRAM( tex_address    , t0);
+            SET_TRAM( tex_address + 8, t1);
+            tex_address += 16;
+            src8 += 8;
+          }
+        } 
+      } else {                      /* New TMUs    */
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+
+#define DW_PER_GWP 32
+#define W_PER_GWP (DW_PER_GWP << 1)
+#define BYTES_PER_GWP (DW_PER_GWP << 2)
+#define MASK(n) ((1 << (n)) - 1)
+
+      for ( ; t <= max_t; t++ ) {
+        FxU32 t0, t1;
+        FxU32 j;
+
+        GR_CHECK_SIZE_SLOPPY();
+        GR_SET_EXPECTED_SIZE((max_s + (max_s >> 4) + 2) << 2);
+        tex_address = tmu_baseaddress + ( t << 9 );
+        if (max_s >= DW_PER_GWP) {              /* can use maximum GWP(s) */
+          for (s=0; s<max_s; s+=DW_PER_GWP ) {
+
+            GWH_BEGIN_TEXDL_PACKET(0xffffffff, tex_address);
+            /* Loop unrolled to keep GWP happy */
+            for (j=0; j<16; j++) {
+              t0 = * (const FxU32 *) (src8 + (j << 3) );
+              t1 = * (const FxU32 *) (src8 + (j << 3) + 4);
+              GR_SET_GW(t0);
+              GR_SET_GW(t1);
+            }
+            tex_address += BYTES_PER_GWP;
+            src8 += BYTES_PER_GWP;
+          } /* end for s */
+        } else {                        /* partial GWP */
+          FxU32 mask = MASK(max_s);     /* we can assume s is even */
+          GWH_BEGIN_TEXDL_PACKET(mask, tex_address);
+          /* Loop unrolled to keep GWP happy */
+          for (j=0; j<(max_s>>1); j++) {
+            t0 = * (const FxU32 *) (src8 + (j << 3) );
+            t1 = * (const FxU32 *) (src8 + (j << 3) + 4);
+            GR_SET_GW(t0);
+            GR_SET_GW(t1);
+          }
+          tex_address += (max_s << 2);
+          src8 += (max_s << 2);
+        }
+      } /* end for t */
+
+#else   /* SST-1 */
+        for ( ; t <= max_t; t++) {
+          GR_CHECK_SIZE_SLOPPY();
+          GR_SET_EXPECTED_SIZE(max_s*5);
+          tex_address = tmu_baseaddress + ( t << 9 );
+          for ( s = 0; s < max_s; s+=2) {
+            FxU32  t0, t1;
+
+            t0 = * (const FxU32 *) (src8    );
+            t1 = * (const FxU32 *) (src8 + 4);
+            SET_TRAM( tex_address    , t0);
+            SET_TRAM( tex_address + 4, t1);
+            tex_address += 8;
+            src8 += 8;
+          }
+        } 
+#endif
+      }
+      break;
+    }
+  } else { 
+
+    /*------------------------------------------------------------
+      Handle 16-bit Textures
+      ------------------------------------------------------------*/
+
+    switch( width ) {
+    /* Cases 1, 2 don't need inner loops for s */
+    case 1:                         /* 1xN texture */
+      tex_address = tmu_baseaddress + ( t << 9 );
+      for ( ; t <= max_t; t++) {
+        SET_TRAM( tex_address, *src16 );
+        src16 += 1;
+        tex_address += (1 << 9); 
+      }
+      break;
+
+    case 2:                         /* 2xN texture */
+      tex_address = tmu_baseaddress + ( t << 9 );
+      for ( ; t <= max_t; t++) {
+        SET_TRAM( tex_address, *(const FxU32 *)src16 );
+        src16 += 2;
+        tex_address += (1 << 9); 
+      }
+      break;
+
+    default:                        /* All other textures */
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+      for ( ; t <= max_t; t++ ) {
+        FxU32 t0, t1;
+        FxU32 j;
+
+        GR_CHECK_SIZE_SLOPPY();
+        GR_SET_EXPECTED_SIZE((max_s + (max_s >> 4) + 2) << 2);
+        tex_address = tmu_baseaddress + ( t << 9 );
+        if (max_s >= DW_PER_GWP) {              /* can use maximum GWP(s) */
+          for (s=0; s<max_s; s+=DW_PER_GWP ) {
+
+            GWH_BEGIN_TEXDL_PACKET(0xffffffff, tex_address);
+            /* Loop unrolled to keep GWP happy */
+            for (j=0; j<16; j++) {
+              t0 = * (const FxU32 *) (src16 + (j << 2) );
+              t1 = * (const FxU32 *) (src16 + (j << 2) + 2);
+              GR_SET_GW(t0);
+              GR_SET_GW(t1);
+            }
+            tex_address += BYTES_PER_GWP;
+            src16 += W_PER_GWP;
+          } /* end for s */
+        } else {                        /* partial GWP */
+          FxU32 mask = MASK(max_s);     /* we can assume s is even */
+          GWH_BEGIN_TEXDL_PACKET(mask, tex_address);
+          /* Loop unrolled to keep GWP happy */
+          for (j=0; j<(max_s>>1); j++) {
+            t0 = * (const FxU32 *) (src16 + (j << 2) );
+            t1 = * (const FxU32 *) (src16 + (j << 2) + 2);
+            GR_SET_GW(t0);
+            GR_SET_GW(t1);
+          }
+          tex_address += (max_s << 2);
+          src16 += (max_s << 1);
+        }
+      } /* end for t */
+#else   /* SST-1 */
+      for ( ; t <= max_t; t++ ) {
+        GR_CHECK_SIZE_SLOPPY();
+        GR_SET_EXPECTED_SIZE(max_s*5);
+        tex_address = tmu_baseaddress + ( t << 9 );
+        /* Loop unrolled to process 2 dwords per iteration */
+        for ( s = 0; s < max_s; s += 2 ) {
+          FxU32  t0, t1;
+
+          t0 = * (const FxU32 *) (src16    );
+          t1 = * (const FxU32 *) (src16 + 2);
+          SET_TRAM( tex_address    , t0);
+          SET_TRAM( tex_address + 4, t1);
+          tex_address += 8;
+          src16 += 4;
+        }
+      }
+#endif
+      break;
+    }
+  } /* end switch( width ) */
+  
+  /* Flush the write buffers after the texture downloads */
+  P6FENCE;
+
+  /*------------------------------------------------------------
+    Restore TLOD, texMode, baseAddress
+    ------------------------------------------------------------*/
+  GR_CHECK_SIZE_SLOPPY();
+  GR_SET_EXPECTED_SIZE(3*4 + 2*PACKER_WORKAROUND_SIZE);
+  PACKER_WORKAROUND;
+  GR_SET( hw->texBaseAddr , gc->state.tmu_config[tmu].texBaseAddr );
+  GR_SET( hw->textureMode , gc->state.tmu_config[tmu].textureMode );
+  GR_SET( hw->tLOD        , gc->state.tmu_config[tmu].tLOD );
+  PACKER_WORKAROUND;
+
+all_done:
+  _GlideRoot.stats.texDownloads++;
+  GR_END_SLOPPY();
+} /* grTexDownloadMipmapLevelPartial */
+
+
+/*-------------------------------------------------------------------
+  Function: _grTexDownloadPalette
+  Date: 6/9
+  Implementor(s): jdt
+  Library: Glide
+  Description:
+    Private function to download a palette to the specified tmu
+  Arguments:
+    tmu - which tmu to download the palette to
+    pal - the pallete data
+    start - beginning index to download
+    end   - ending index to download
+  Return:
+    none
+  -------------------------------------------------------------------*/
+GR_DDFUNC(_grTexDownloadPalette, void, ( GrChipID_t tmu, GuTexPalette *pal, int start, int end ))
+{
+  GR_BEGIN("_grTexDownloadPalette",89, 4*(end-start+1) + 2*PACKER_WORKAROUND_SIZE);
+  GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x, %d,%d)\n",tmu,pal,start,end));
+  GR_CHECK_F( myName, !pal, "pal invalid" );
+  GR_CHECK_F( myName, start<0, "invalid start index" );
+  GR_CHECK_F( myName, end>255, "invalid end index" );
+
+  PACKER_WORKAROUND;
+  hw = SST_TMU(hw,tmu);
+  _GlideRoot.stats.palDownloads++;
+  _GlideRoot.stats.palBytes += (end-start+1)<<2;
+
+  while (start <= end) {
+      GR_SET( hw->nccTable0[4+(start&0x7)],
+              0x80000000 |  ((start & 0xFE) << 23) | (pal->data[start] & 0xffffff) );
+      start++;
+      if ((start&0x7)==0) P6FENCE;
+  }
+
+  PACKER_WORKAROUND;
+  P6FENCE;
+  GR_END();
+} /* _grTexDownloadPalette */ 
+
+
+#ifndef __linux__
+/* 
+   Let me take this opportunity to register my formal opposition to
+   this function.  Either we do this or we don't.  Let's not hack like
+   this.
+
+   CHD
+*/
+
+GR_ENTRY(ConvertAndDownloadRle, void, ( GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod, GrLOD_t largeLod, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 evenOdd, FxU8 *bm_data, long bm_h, FxU32 u0, FxU32 v0, FxU32 width, FxU32 height, FxU32 dest_width, FxU32 dest_height, FxU16 *tlut))
+{
+  FxI32 sh;
+  FxU32 max_s,s,t,max_t,tex_address, tmu_baseaddress;
+  FxU32 tLod, texMode, baseAddress,size;
+  FxU32 offset,expected_size;
+  unsigned long  i;
+  FxU16 *src;
+  extern FxU16 rle_line[256];
+  extern FxU16 *rle_line_end;
+
+
+  GR_BEGIN_NOFIFOCHECK("grTexDownloadMipMapLevelPartial",89);
+
+/* make sure even number */
+  width&=0xFFFFFFFE;
+  
+  max_s=width>>1;
+  max_t=height;
+  
+  GDBG_INFO_MORE((gc->myLevel,"(%d,0x%x, %d,%d,%d, %d,%d 0x%x, %d)\n",
+                  tmu,startAddress,thisLod,largeLod,aspectRatio,
+                  format,evenOdd,bm_data,max_t));
+
+  size = _grTexTextureMemRequired(thisLod, thisLod, aspectRatio, format, evenOdd);
+  GR_CHECK_TMU(myName, tmu);
+  GR_CHECK_F(myName, startAddress + size > gc->tmu_state[tmu].total_mem,
+               "insufficient texture ram at startAddress" );
+  GR_CHECK_F(myName, startAddress & 0x7, "unaligned startAddress");
+  GR_CHECK_F(myName, thisLod > GR_LOD_1, "thisLod invalid");
+  GR_CHECK_F(myName, largeLod > GR_LOD_1, "largeLod invalid");
+  GR_CHECK_F(myName, thisLod < largeLod, "thisLod may not be larger than largeLod");
+  GR_CHECK_F(myName, aspectRatio > GR_ASPECT_1x8 || aspectRatio < GR_ASPECT_8x1, "aspectRatio invalid");
+  GR_CHECK_F(myName, evenOdd > 0x3 || evenOdd == 0, "evenOdd mask invalid");
+  GR_CHECK_F(myName, !bm_data, "invalid data pointer");
+
+  GR_CHECK_F(myName, (dest_height-1) >= (FxU32)_grMipMapHostWH[aspectRatio][thisLod][1], "invalid end row");
+
+  if ((startAddress < 0x200000) && (startAddress + size > 0x200000))
+    GrErrorCallback("grTexDownloadMipMapLevelPartial: mipmap level cannot span 2 Mbyte boundary",FXTRUE);
+
+  /*------------------------------------------------------------
+    Skip this level entirely if not in odd/even mask
+    ------------------------------------------------------------*/
+  if ( !(evenOdd & (thisLod & 0x1 ? GR_MIPMAPLEVELMASK_ODD:GR_MIPMAPLEVELMASK_EVEN)))
+      goto all_done;
+  
+  /*------------------------------------------------------------
+    Compute Base Address Given Start Address Offset
+    ------------------------------------------------------------*/
+  baseAddress = _grTexCalcBaseAddress( startAddress,
+                                       largeLod, 
+                                       aspectRatio,
+                                       format,
+                                       evenOdd );
+  baseAddress >>= 3;
+
+  /*------------------------------------------------------------
+    Compute Physical Write Pointer
+    ------------------------------------------------------------*/
+  tmu_baseaddress = (FxU32)gc->tex_ptr;
+  tmu_baseaddress += (((FxU32)tmu)<<21) + (((FxU32)thisLod)<<17);
+  
+  /*------------------------------------------------------------
+    Compute pertinant contents of tLOD and texMode registers 
+    ------------------------------------------------------------*/
+  tLod = SST_TLOD_MINMAX_INT(largeLod,GR_LOD_1);
+  tLod |= _gr_evenOdd_xlate_table[evenOdd];
+  tLod |= _gr_aspect_xlate_table[aspectRatio];
+  texMode = format << SST_TFORMAT_SHIFT;
+  if (gc->state.tmu_config[tmu].textureMode & SST_SEQ_8_DOWNLD) {
+    sh = 2;
+    texMode |= SST_SEQ_8_DOWNLD;
+  }
+  else sh = 3;
+
+  /* account for 6 register writes and for smallest 1xN and 2xN levels*/
+  GR_SET_EXPECTED_SIZE(3*4 + 2*PACKER_WORKAROUND_SIZE);
+
+  /*------------------------------------------------------------
+    Update TLOD, texMode, baseAddress
+    ------------------------------------------------------------*/
+  PACKER_WORKAROUND;
+  hw = SST_TMU(hw,tmu);
+  GR_SET( hw->texBaseAddr , baseAddress );
+  GR_SET( hw->textureMode , texMode );
+  GR_SET( hw->tLOD , tLod );
+  PACKER_WORKAROUND;
+
+  /* Flush the write buffers before the texture downloads */
+  P6FENCE;
+  _GlideRoot.stats.texBytes += dest_width * (dest_height) * 2;
+
+  /* here I can do my writes and conversion and I will be so happy */
+
+        offset=4+bm_h;
+   for (i=0; i<v0; i++ )
+                offset += bm_data[4+i];
+
+   max_s=dest_width>>1;
+   expected_size=max_s*5;
+
+   rle_line_end=rle_line+width+u0;
+
+   for(t=0;t<max_t;t++)
+   {
+      GR_CHECK_SIZE_SLOPPY();
+      GR_SET_EXPECTED_SIZE(expected_size);
+      tex_address = tmu_baseaddress + ( t << 9 );
+/*      decode_rle_line(&bm_data[offset]); */
+      rle_decode_line_asm(tlut,&bm_data[offset],rle_line);
+      src=rle_line+u0;
+      for(s=0;s<max_s;s++)
+      {
+         SET_TRAM( tex_address + ( s << 2 ), *( FxU32 * ) src );
+         src+=2;
+      }
+      offset+=bm_data[4+i++];
+   }
+   if (dest_height>height)
+   {
+      GR_CHECK_SIZE_SLOPPY();
+      GR_SET_EXPECTED_SIZE(expected_size);
+      tex_address = tmu_baseaddress + ( t << 9 );
+      src=rle_line+u0;
+      for(s=0;s<max_s;s++)
+      {
+         SET_TRAM( tex_address + ( s << 2 ), *( FxU32 * ) src );
+         src+=2;
+      }
+   }
+
+  /* Flush the write buffers after the texture downloads */
+  P6FENCE;
+
+  /*------------------------------------------------------------
+    Restore TLOD, texMode, baseAddress
+    ------------------------------------------------------------*/
+  GR_CHECK_SIZE_SLOPPY();
+  GR_SET_EXPECTED_SIZE(3*4 + 2*PACKER_WORKAROUND_SIZE);
+  PACKER_WORKAROUND;
+  GR_SET( hw->texBaseAddr , gc->state.tmu_config[tmu].texBaseAddr );
+  GR_SET( hw->textureMode , gc->state.tmu_config[tmu].textureMode );
+  GR_SET( hw->tLOD        , gc->state.tmu_config[tmu].tLOD );
+  PACKER_WORKAROUND;
+
+all_done:
+  _GlideRoot.stats.texDownloads++;
+  GR_END_SLOPPY();
+}
+#endif
Index: trunk/src/opengl/glide/sst1/glide/gu.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gu.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gu.c	(revision 2885)
@@ -0,0 +1,435 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gu.c,v 1.1 2000-02-25 00:31:19 sandervl Exp $
+** $Log: gu.c,v $
+** Revision 1.1  2000-02-25 00:31:19  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 12    12/19/97 8:09a Peter
+ * fog table propogation
+ * 
+ * 11    3/09/97 10:31a Dow
+ * Added GR_DIENTRY for di glide functions
+ * 
+ * 10    3/05/97 9:36p Jdt
+ * Added guEncodeRLE16
+ * 
+ * 9     12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+**
+*/
+
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+
+#include "fxglide.h"
+#include "fxinline.h"
+
+#if ( (GLIDE_PLATFORM & GLIDE_SST_HW) && (GLIDE_PLATFORM & GLIDE_HW_SST1) )
+#include <sst1init.h>
+#endif
+
+/*---------------------------------------------------------------------------
+**  guAlphaSource
+*/
+GR_DIENTRY(guAlphaSource, void, ( GrAlphaSource_t mode ))
+{
+  GDBG_INFO((99,"guAlphaSource(%d)\n",mode));
+  switch ( mode )
+  {
+  case GR_ALPHASOURCE_CC_ALPHA:
+    grAlphaCombine( GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_OTHER_NONE, FXFALSE );
+    break;
+
+  case GR_ALPHASOURCE_ITERATED_ALPHA:
+    grAlphaCombine( GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_NONE, FXFALSE );
+    break;
+
+  case GR_ALPHASOURCE_TEXTURE_ALPHA:
+    grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_ONE, GR_COMBINE_LOCAL_NONE, GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+    break;
+
+  case GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA:
+    grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+    break;
+
+  default:
+    GR_CHECK_F("grAlphaSource", 1, "unknown alpha source mode");
+    break;
+  }
+
+  /* xxx not needed at the moment, should update grFogxxx
+  _grVerifyNeedForITAlpha();
+  */
+} /* guAlphaSource */
+
+/*---------------------------------------------------------------------------
+**  guColorCombineFunction
+*/
+GR_DIENTRY(guColorCombineFunction, void, ( GrColorCombineFnc_t fnc ))
+{
+  GDBG_INFO((99,"guColorCombineFunction(%d)\n",fnc));
+
+  /* gross hack to get ITRGB_DELTA0 modes working */
+  _grColorCombineDelta0Mode( FXFALSE );
+
+  switch ( fnc )
+  {
+  case GR_COLORCOMBINE_ZERO:
+    grColorCombine( GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_NONE, GR_COMBINE_OTHER_NONE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_CCRGB:
+    grColorCombine( GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_OTHER_NONE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_ITRGB_DELTA0:
+    _grColorCombineDelta0Mode( FXTRUE );
+    /* FALL THRU */
+  case GR_COLORCOMBINE_ITRGB:
+    grColorCombine( GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_NONE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_DECAL_TEXTURE:
+    grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_ONE, GR_COMBINE_LOCAL_NONE, GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_TEXTURE_TIMES_CCRGB:
+    grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_DELTA0:
+    _grColorCombineDelta0Mode( FXTRUE );
+    /* FALL THRU */
+  case GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB:
+    grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_ADD_ALPHA:
+    grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA, GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA:
+    grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_LOCAL_ALPHA, GR_COMBINE_LOCAL_NONE, GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA_ADD_ITRGB:
+    grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, GR_COMBINE_FACTOR_LOCAL_ALPHA, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_TEXTURE_ADD_ITRGB:
+    grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, GR_COMBINE_FACTOR_ONE, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_TEXTURE_SUB_ITRGB:
+    grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL, GR_COMBINE_FACTOR_ONE, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA:
+    grColorCombine( GR_COMBINE_FUNCTION_BLEND, GR_COMBINE_FACTOR_TEXTURE_ALPHA, GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_OTHER_ITERATED, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_DIFF_SPEC_A:
+    grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, GR_COMBINE_FACTOR_LOCAL_ALPHA, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_DIFF_SPEC_B:
+    grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA, GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_TEXTURE, FXFALSE );
+    break;
+
+  case GR_COLORCOMBINE_ONE:
+    grColorCombine( GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_NONE, GR_COMBINE_OTHER_NONE, FXTRUE );
+    break;
+    
+  default:
+    GR_CHECK_F("grColorCombineFunction", 1, "unsupported color combine function");
+    break;
+  }
+} /* guColorCombineFunction */
+
+/*---------------------------------------------------------------------------
+** guEndianSwapWords
+*/
+GR_DIENTRY(guEndianSwapWords, FxU32, ( FxU32 value ))
+{
+   return ( ( value & 0xFFFF0000 ) >> 16 ) | ( value << 16 );
+}
+
+/*---------------------------------------------------------------------------
+** guEndianSwapBytes
+*/
+GR_DIENTRY(guEndianSwapBytes, FxU16, ( FxU16 value ))
+{
+   return ( ( value & 0xFF00 ) >> 8 ) | ( value << 8 );
+}
+
+/*---------------------------------------------------------------------------
+** guFogTableIndexToW
+*/
+GR_DIENTRY(guFogTableIndexToW, float, ( int i ))
+{
+  return (float)pow(2.0,3.0+(double)(i>>2)) / (8-(i&3));
+}
+
+/*---------------------------------------------------------------------------
+** guFogGenerateExp
+*/
+GR_DIENTRY(guFogGenerateExp, void,
+           ( GrFog_t fogtable[kInternalFogTableEntryCount], float density )) 
+{
+  int   i;
+  float f;
+  float scale;
+  float dp;
+
+  GDBG_INFO((99,"guFogGenerateExp(0x%x,%g)\n",fogtable,density));
+  dp = density * guFogTableIndexToW( kInternalFogTableEntryCount - 1 );
+  scale = 1.0F / ( 1.0F - ( float ) exp( -dp ) );
+
+  for ( i = 0; i < kInternalFogTableEntryCount; i++ )
+  {
+     dp = density * guFogTableIndexToW( i );
+     f = ( 1.0F - ( float ) exp( -dp ) ) * scale;
+
+     if ( f > 1.0F )
+        f = 1.0F;
+     else if ( f < 0.0F )
+        f = 0.0F;
+
+     f *= 255.0F;
+     fogtable[i] = ( GrFog_t ) f;
+  }
+} /* guFogGenerateExp */
+
+/*---------------------------------------------------------------------------
+** guFogGenerateExp2
+*/
+GR_DIENTRY(guFogGenerateExp2, void,
+           ( GrFog_t fogtable[kInternalFogTableEntryCount], float density ))
+{
+  int   i;
+  float f;
+  float scale;
+  float dp;
+
+  GDBG_INFO((99,"guFogGenerateExp2(0x%x,%g)\n",fogtable,density));
+  dp = density * guFogTableIndexToW( kInternalFogTableEntryCount - 1 );
+  scale = 1.0F / ( 1.0F - ( float ) exp( -( dp * dp ) ) );
+
+  for ( i = 0; i < kInternalFogTableEntryCount; i++ )
+  {
+     dp = density * guFogTableIndexToW( i );
+     f = ( 1.0F - ( float ) exp( -( dp * dp ) ) ) * scale;
+
+     if ( f > 1.0F )
+        f = 1.0F;
+     else if ( f < 0.0F )
+        f = 0.0F;
+
+     f *= 255.0F;
+     fogtable[i] = ( GrFog_t ) f;
+  }
+} /* guFogGenerateExp2 */
+
+/*---------------------------------------------------------------------------
+** guFogGenerateLinear
+*/
+GR_DIENTRY(guFogGenerateLinear, void, 
+           ( GrFog_t fogtable[kInternalFogTableEntryCount],
+            float nearZ, float farZ ))
+{
+   int i;
+   float world_w;
+   float f;
+
+  GDBG_INFO((99,"guFogGenerateLinear(0x%x,%g,%g)\n",fogtable,nearZ,farZ));
+   for ( i = 0; i < kInternalFogTableEntryCount; i++ )
+   {
+      world_w = guFogTableIndexToW( i );
+      if ( world_w > 65535.0F )
+         world_w = 65535.0F;
+
+      f = ( world_w - nearZ ) / ( farZ - nearZ );
+      if ( f > 1.0F )
+         f = 1.0F;
+      else if ( f < 0.0F )
+         f = 0.0F;
+      f *= 255.0F;
+      fogtable[i] = ( GrFog_t ) f;
+   }
+} /* guFogGenerateLinear */
+
+/*
+** setlevel
+*/
+static void
+setlevel( FxU16 *data, FxU16 color, int width, int height )
+{
+   int s, t;
+
+   for ( t = 0; t < height; t++ )
+   {
+      for ( s = 0; s < width; s++ )
+      {
+         *data = color;
+          data++;
+      }
+   }
+} /* setlevel */
+
+/*---------------------------------------------------------------------------
+**  guTexCreateColorMipMap
+*/
+GR_DIENTRY(guTexCreateColorMipMap, FxU16 *, ( void ))
+{
+   FxU32 memrequired;
+   FxU16 *data;
+   FxU16 *start;
+
+   GDBG_INFO((99,"guTexCreateColorMipMap()\n"));
+   memrequired = 2 * ( 256 * 256 + 128 * 128 + 64 * 64 + 32 * 32 + 16 * 16 + 8 * 8 + 4 * 4 + 2 * 2 + 1 * 1 );
+   start = data = (FxU16 *)malloc( memrequired );
+   if ( !data )
+      return 0;
+
+   setlevel( data,            0xF800, 256, 256 );
+   setlevel( data += 256*256, 0x07e0, 128, 128 );
+   setlevel( data += 128*128, 0x001F, 64, 64 );
+   setlevel( data += 64*64,   0xFFFF, 32, 32);
+   setlevel( data += 32*32,   0x0000, 16, 16 );
+   setlevel( data += 16*16,   0xF800, 8, 8);
+   setlevel( data += 8*8,     0x07e0, 4, 4 );
+   setlevel( data += 4*4,     0x001f, 2, 2 );
+   setlevel( data += 2*2,     0xFFFF, 1, 1 );
+
+   return start;
+} /* guTexCreateColoMipMap */
+
+/* GMT: this code used to be in the code above but I removed it for
+        readability, the first section was case(1) the second section
+        was a replacement for the simple 32-bit copy loop
+*/
+#if 0
+
+      /* GMT: from what I can tell its not bad to perform unaligned DWORD
+         loads on a P5, so we use the case 2) all the time
+         in fact, its twice as fast as doing aligned short copies
+         */
+if ((dstX ^ (((FxU32)src)>>1)) & 1) {
+    /* case 1) a simple 16-bit copy loop */
+    for (x=0; x < w; x++) {
+        GR_SET16(lfbPtr[x], ((FxU16 *)src)[x]);
+    }
+}
+#endif
+
+#if 0
+/* GMT: I tried to unroll the loop but for some reason the
+   code scheduling was such that it was slower
+   I think it had to do with the way the 2 mov instructions paired
+   Perhaps they were unaligned in the cache?
+   */
+FxU32 a,b;
+FxU32 *s = (FxU32 *)src;
+FxU32 *d = lfbPtr;
+
+while (d < &lfbPtr[w-1]) {
+    a = s[0];
+    b = s[1];
+    GR_SET(d[0], a);
+    GR_SET(d[1], b);
+    s += 2;
+    d += 2;
+}
+if (w & 1) {
+    GR_SET(d[0], s[0]);
+}
+#endif
+
+/*-------------------------------------------------------------------
+  Function: guEncodeRle
+  Date: 3/5/96
+  Implementor(s): jdt
+  Library: Glide Utilities
+  Description:
+  Encode an RGB565 image into RLE16 format
+  Arguments:
+  dst - destination rle image data ( NULL for bytecount only )
+  src - source rgb565 image data
+  width - width of source data
+  height - height of source data
+  Return:
+  number of bytes in encoded rle image
+  -------------------------------------------------------------------*/
+GR_ENTRY( guEncodeRLE16, int, ( void *dst, void *src, FxU32 width, FxU32 height ))
+{
+    int byteCount = 0;
+    int sourceImageSizeInWords;
+    FxU16 *srcPixels;
+    FxU32 *dstPixels;
+
+    sourceImageSizeInWords = width * height;
+
+    srcPixels = (FxU16 *)src;
+
+    if ( dst ) {
+        dstPixels = (FxU32 *)dst;
+        while( sourceImageSizeInWords-- ) {
+            short length    = 1;
+            short color     = *srcPixels;
+            int   lookAhead = 1;
+
+            while( (sourceImageSizeInWords-length)&&
+                   (color == srcPixels[lookAhead]) ) {
+                length++;
+                lookAhead++;
+            }
+
+            *dstPixels = ((((FxU32)length)<<16) | ((FxU32)color));
+            dstPixels++;
+
+            byteCount+=4;
+
+            srcPixels+=length;
+            sourceImageSizeInWords-=length;            
+        }
+    } else {
+        while( sourceImageSizeInWords-- ) {
+            short length    = 1;
+            short color     = *srcPixels;
+            int   lookAhead = 1;
+
+            while( (sourceImageSizeInWords-length)&&
+                   (color == srcPixels[lookAhead]) ) {
+                length++;
+                lookAhead++;
+            }
+
+            byteCount+=4;
+            srcPixels+=length;
+            sourceImageSizeInWords-=length;            
+        }
+    }
+    return byteCount;
+}
+
Index: trunk/src/opengl/glide/sst1/glide/guclip.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/guclip.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/guclip.c	(revision 2885)
@@ -0,0 +1,426 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/guclip.c,v 1.1 2000-02-25 00:31:19 sandervl Exp $
+** $Log: guclip.c,v $
+** Revision 1.1  2000-02-25 00:31:19  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 6     8/14/97 5:32p Pgj
+ * remove dead code per GMT
+ * 
+ * 5     6/27/97 4:16p Atai
+ * fixed guDrawTriangleWithClip bug (#484) by removing +1.0F and -1.0F in
+ * intersectTop(), intersectBottom(), intersectLeft(), and
+ * intersectRight() routine
+ * 
+ * 4     3/09/97 10:31a Dow
+ * Added GR_DIENTRY for di glide functions
+**
+*/
+
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+#define GU_PRIM_MAX_VERTICES 100
+
+static void
+calcParams(const GrVertex *a, const GrVertex *b, GrVertex *isect, float d)
+{
+  GR_DCL_GC;
+  if (gc->state.paramIndex & STATE_REQUIRES_IT_DRGB) {
+    isect->r = a->r + d * ( b->r - a->r );
+    isect->g = a->g + d * ( b->g - a->g );
+    isect->b = a->b + d * ( b->b - a->b );
+  }
+    
+  if (gc->state.paramIndex & STATE_REQUIRES_IT_ALPHA) {
+    isect->a        = a->a        + d * ( b->a - a->a );
+  }
+
+  if (gc->state.paramIndex & STATE_REQUIRES_OOZ) {
+    isect->ooz = a->ooz + d * ( b->ooz - a->ooz );
+  }
+
+  if (gc->state.paramIndex & STATE_REQUIRES_OOW_FBI) {
+    isect->oow = a->oow + d * ( b->oow - a->oow);
+  }
+
+  if (gc->state.paramIndex & STATE_REQUIRES_ST_TMU0) {
+    isect->tmuvtx[0].oow =
+      a->tmuvtx[0].oow + d * ( b->tmuvtx[0].oow - a->tmuvtx[0].oow );
+    isect->tmuvtx[0].sow =
+      a->tmuvtx[0].sow + d * ( b->tmuvtx[0].sow - a->tmuvtx[0].sow );
+    isect->tmuvtx[0].tow =
+      a->tmuvtx[0].tow + d * ( b->tmuvtx[0].tow - a->tmuvtx[0].tow );
+  }
+
+  if (gc->state.paramIndex & STATE_REQUIRES_ST_TMU1) {
+    isect->tmuvtx[1].oow =
+      a->tmuvtx[1].oow + d * ( b->tmuvtx[1].oow - a->tmuvtx[1].oow );
+    isect->tmuvtx[1].sow =
+      a->tmuvtx[1].sow + d * ( b->tmuvtx[1].sow - a->tmuvtx[1].sow );
+    isect->tmuvtx[1].tow =
+      a->tmuvtx[1].tow + d * ( b->tmuvtx[1].tow - a->tmuvtx[1].tow );
+  }
+
+#if (GLIDE_NUM_TMU > 2)
+  if (gc->state.paramIndex & STATE_REQUIRES_ST_TMU2) {
+    isect->tmuvtx[2].oow =
+      a->tmuvtx[2].oow + d * ( b->tmuvtx[2].oow - a->tmuvtx[2].oow );
+    isect->tmuvtx[2].sow =
+      a->tmuvtx[2].sow + d * ( b->tmuvtx[2].sow - a->tmuvtx[2].sow );
+    isect->tmuvtx[2].tow =
+      a->tmuvtx[2].tow + d * ( b->tmuvtx[2].tow - a->tmuvtx[2].tow );
+  }
+#endif
+
+} /* calcParams */
+
+static void 
+intersectTop( const GrVertex *a, const GrVertex *b, GrVertex *intersect )
+{
+  GR_DCL_GC;
+  float
+    d = ( gc->state.clipwindowf_ymin - a->y ) / ( b->y - a->y );
+  
+  intersect->x        = a->x        + d * ( b->x - a->x );
+  intersect->y        = gc->state.clipwindowf_ymin; 
+  
+  calcParams(a, b, intersect, d);
+
+} /* intersectTop */
+
+static void
+intersectBottom( const GrVertex *a, const GrVertex *b, GrVertex *intersect )
+{
+  GR_DCL_GC;
+  float
+    d = ( gc->state.clipwindowf_ymax - a->y ) / ( b->y - a->y );
+  
+  intersect->x        = a->x        + d * ( b->x - a->x );
+  intersect->y        = gc->state.clipwindowf_ymax; 
+
+  calcParams(a, b, intersect, d);
+
+} /* intersectBottom */
+
+static void
+intersectRight( const GrVertex *a, const GrVertex *b, GrVertex *intersect )
+{
+  GR_DCL_GC;
+  float
+    d = ( gc->state.clipwindowf_xmax - a->x ) / ( b->x - a->x );
+  
+  intersect->x        = gc->state.clipwindowf_xmax; 
+  intersect->y        = a->y        + d * ( b->y - a->y );
+
+  calcParams(a, b, intersect, d);
+
+} /* intersectRight */
+
+static void
+intersectLeft( const GrVertex *a, const GrVertex *b, GrVertex *intersect )
+{
+  GR_DCL_GC;
+  float
+    d = ( gc->state.clipwindowf_xmin - a->x ) / ( b->x - a->x );
+  
+  intersect->x        = gc->state.clipwindowf_xmin;
+  intersect->y        = a->y        + d * ( b->y - a->y );
+
+  calcParams(a, b, intersect, d);
+
+} /* intersectLeft */
+
+static FxBool
+aboveYMin(const GrVertex *p)
+{
+  GR_DCL_GC;
+  return (( p->y > gc->state.clipwindowf_ymin ) ? FXTRUE : FXFALSE);
+} /* aboveYMin */
+     
+
+static FxBool
+belowYMax(const GrVertex *p)
+{
+  GR_DCL_GC;
+  return (( p->y < gc->state.clipwindowf_ymax ) ? FXTRUE : FXFALSE);
+} /* belowYMax */
+
+static FxBool
+aboveXMin(const GrVertex *p)
+{
+  GR_DCL_GC;
+  return (( p->x > gc->state.clipwindowf_xmin ) ? FXTRUE : FXFALSE );
+} /* aboveXMin */
+
+static FxBool
+belowXMax(const GrVertex *p)
+{
+  GR_DCL_GC;
+  return (( p->x < gc->state.clipwindowf_xmax ) ? FXTRUE : FXFALSE );
+} /* belowXMax */
+
+/*
+** shClipPolygon
+*/
+static void
+shClipPolygon(
+              const GrVertex invertexarray[],
+              GrVertex outvertexarray[],
+              int inlength, int *outlength,
+              FxBool (*inside)(const GrVertex *p),
+              void (*intersect)(
+                                const GrVertex *a,
+                                const GrVertex *b,
+                                GrVertex *intersect )
+              )
+{
+  GrVertex
+    s, p /*, intersection */;
+  int
+    j;
+  
+  *outlength = 0;
+  
+  s = invertexarray[inlength-1];
+  for ( j = 0; j < inlength; j++ ) {
+    p = invertexarray[j];
+    if ( inside( &p ) ) {
+      if ( inside( &s ) ) {
+        outvertexarray[*outlength] = p;
+        (*outlength)++;
+      }else {
+#if 0
+        intersect( &s, &p, &intersection );
+        outvertexarray[*outlength] = intersection;
+#else
+        intersect( &s, &p, &outvertexarray[*outlength] );
+#endif
+        (*outlength)++;
+        outvertexarray[*outlength] = p;
+        (*outlength)++;
+      }
+    } else {
+      if ( inside( &s ) ) {
+#if 0
+        intersect( &s, &p, &intersection );
+        outvertexarray[*outlength] = intersection;
+#else
+        intersect( &s, &p, &outvertexarray[*outlength] );
+#endif
+        (*outlength)++;
+      }
+    }
+    s = p;
+  }
+} /* shClipPolygon */
+
+/*---------------------------------------------------------------------------
+** guDrawTriangleWithClip
+**
+** NOTE:  This routine snaps vertices by adding a large number then
+** subtracting that same number again.  In order for this to work
+** you MUST set up the FPU to work in single precision mode.  Code
+** to perform this is listed in the Appendix to the Glide Programmer's
+** Guide.
+*/
+static const float vertex_snap_constant = ( float ) ( 1L << 19 );
+
+GR_DIENTRY(guDrawTriangleWithClip, void,
+           (const GrVertex *a, const GrVertex *b, const GrVertex *c ))
+{
+  GR_DCL_GC;
+  GrVertex
+    output_array[8],
+    output_array2[8],
+    input_array[3];
+  int
+    i,
+    outlength;
+
+  GDBG_INFO_MORE((99,"guDrawTriangleWithClip(0x%x,0x%x,0x%x)\n",a,b,c));
+
+  /*
+   ** perform trivial accept
+   */
+  if (
+      ( a->x >= gc->state.clipwindowf_xmin) &&
+      ( a->x < gc->state.clipwindowf_xmax ) &&
+      ( a->y >= gc->state.clipwindowf_ymin ) &&
+      ( a->y < gc->state.clipwindowf_ymax ) &&
+      ( b->x >= gc->state.clipwindowf_xmin ) &&
+      ( b->x < gc->state.clipwindowf_xmax ) &&
+      ( b->y >= gc->state.clipwindowf_ymin ) &&
+      ( b->y < gc->state.clipwindowf_ymax ) &&
+      ( c->x >= gc->state.clipwindowf_xmin ) &&
+      ( c->x < gc->state.clipwindowf_xmax ) &&
+      ( c->y >= gc->state.clipwindowf_ymin ) &&
+      ( c->y < gc->state.clipwindowf_ymax )
+      )
+  {
+    grDrawTriangle( a, b, c );
+    return;
+  }
+
+  /*
+   ** go ahead and clip and render
+   */
+  input_array[0] = *a;
+  input_array[1] = *b;
+  input_array[2] = *c;
+  
+  shClipPolygon( input_array,   output_array,  3,         &outlength, belowXMax, intersectRight );
+  shClipPolygon( output_array,  output_array2, outlength, &outlength, belowYMax, intersectBottom );
+  shClipPolygon( output_array2, output_array,  outlength, &outlength, aboveXMin, intersectLeft );
+  shClipPolygon( output_array,  output_array2, outlength, &outlength, aboveYMin, intersectTop );
+  
+  /*
+   ** snap vertices then decompose the n-gon into triangles
+   */
+#if defined ( __WATCOMC__ ) || defined ( __MSC__ ) || \
+  defined ( __DJGPP__ ) || defined (__GNUC__) || defined(__OS2__)
+  for ( i = 0; i < outlength; i++ ) {
+    output_array2[i].x += vertex_snap_constant;
+    output_array2[i].x -= vertex_snap_constant;
+    output_array2[i].y += vertex_snap_constant;
+    output_array2[i].y -= vertex_snap_constant;
+  }
+#else
+#  error VERTEX SNAPPING MUST BE IMPLEMENTED FOR THIS COMPILER
+#endif
+  grDrawPolygonVertexList( outlength, output_array2 );
+} /* guDrawTriangleWithClip */
+
+/*---------------------------------------------------------------------------
+**  guAADrawTriangleWithClip
+*/
+GR_DIENTRY(guAADrawTriangleWithClip, void,
+           (const GrVertex *a, const GrVertex *b, const GrVertex *c ))
+{
+  GR_DCL_GC;
+  GrVertex
+    output_array[8],
+    output_array2[8],
+    input_array[3];
+  int
+    i,
+    ilist[10],
+    outlength;
+
+  GDBG_INFO_MORE((99,"guAADrawTriangleWithClip(0x%x,0x%x,0x%x)\n",a,b,c));
+
+   /*
+    ** perform trivial accept
+    */
+  if (
+      ( a->x >= gc->state.clipwindowf_xmin) &&
+      ( a->x < gc->state.clipwindowf_xmax ) &&
+      ( a->y >= gc->state.clipwindowf_ymin ) &&
+      ( a->y < gc->state.clipwindowf_ymax ) &&
+      ( b->x >= gc->state.clipwindowf_xmin ) &&
+      ( b->x < gc->state.clipwindowf_xmax ) &&
+      ( b->y >= gc->state.clipwindowf_ymin ) &&
+      ( b->y < gc->state.clipwindowf_ymax ) &&
+      ( c->x >= gc->state.clipwindowf_xmin ) &&
+      ( c->x < gc->state.clipwindowf_xmax ) &&
+      ( c->y >= gc->state.clipwindowf_ymin ) &&
+      ( c->y < gc->state.clipwindowf_ymax )
+      )
+  {
+    grAADrawTriangle( a, b, c, FXTRUE, FXTRUE, FXTRUE );
+    return;
+  }
+
+  /*
+   ** go ahead and clip and render
+   */
+  input_array[0] = *a;
+  input_array[1] = *b;
+  input_array[2] = *c;
+  
+  shClipPolygon( input_array,   output_array,  3,         &outlength, belowXMax, intersectRight );
+  shClipPolygon( output_array,  output_array2, outlength, &outlength, belowYMax, intersectBottom );
+  shClipPolygon( output_array2, output_array,  outlength, &outlength, aboveXMin, intersectLeft );
+  shClipPolygon( output_array,  output_array2, outlength, &outlength, aboveYMin, intersectTop );
+  
+  /*
+   ** snap vertices then decompose the n-gon into triangles
+   */
+#if defined ( __WATCOMC__ ) || defined ( __MSC__ ) || \
+  defined ( __DJGPP__ ) || defined ( __GNUC__ ) || defined(__OS2__)
+  for ( i = 0; i < outlength; i++ ) {
+    output_array2[i].x += vertex_snap_constant;
+    output_array2[i].x -= vertex_snap_constant;
+    output_array2[i].y += vertex_snap_constant;
+    output_array2[i].y -= vertex_snap_constant;
+    ilist[i] = i;
+  }
+
+  ilist[outlength] = 0;
+#else
+#  error VERTEX SNAPPING MUST BE IMPLEMENTED FOR THIS COMPILER
+#endif
+  grAADrawPolygon( outlength, ilist, output_array2 );
+} /* guAADrawTriangleWithClip */
+
+
+/*---------------------------------------------------------------------------
+**  guDrawPolygonVertexListWithClip
+*/
+GR_DIENTRY(guDrawPolygonVertexListWithClip, void,
+           ( int nverts, const GrVertex vlist[] ))
+{
+  GrVertex
+    output_array[GU_PRIM_MAX_VERTICES+8],
+    output_array2[GU_PRIM_MAX_VERTICES+8];
+   int
+     i,
+     outlength;
+
+  GDBG_INFO_MORE((99,"guDrawPolygonVertexListWithClip(%d,0x%x)\n",nverts,vlist));
+  /*
+   ** go ahead and clip and render
+   */
+  shClipPolygon( vlist, output_array,  nverts, &outlength, belowXMax, intersectRight );
+  shClipPolygon( output_array,  output_array2, outlength, &outlength, belowYMax, intersectBottom );
+  shClipPolygon( output_array2, output_array,  outlength, &outlength, aboveXMin, intersectLeft );
+  shClipPolygon( output_array,  output_array2, outlength, &outlength, aboveYMin, intersectTop );
+
+  /*
+   ** snap vertices then decompose the n-gon into triangles
+   */
+#if defined ( __WATCOMC__ ) || defined ( __MSC__ ) || \
+  defined ( __DJGPP__ ) || defined ( __GNUC__ ) || defined(__OS2__)
+  for ( i = 0; i < outlength; i++ ) {
+    output_array2[i].x += vertex_snap_constant;
+    output_array2[i].x -= vertex_snap_constant;
+    output_array2[i].y += vertex_snap_constant;
+    output_array2[i].y -= vertex_snap_constant;
+  }
+#else
+#  error VERTEX SNAPPING MUST BE IMPLEMENTED FOR THIS COMPILER
+#endif
+  grDrawPolygonVertexList( outlength, output_array2 );
+} /* guDrawPolygonVertexListWithClip */
Index: trunk/src/opengl/glide/sst1/glide/gump.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gump.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gump.c	(revision 2885)
@@ -0,0 +1,93 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gump.c,v 1.1 2000-02-25 00:31:19 sandervl Exp $
+** $Log: gump.c,v $
+** Revision 1.1  2000-02-25 00:31:19  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 7     11/12/97 5:11p Pgj
+ * stubs for evil guFb{Read|Write}Region()
+ * 
+ * 6     3/09/97 10:31a Dow
+ * Added GR_DIENTRY for di glide functions
+ * 
+ * 5     12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+**
+*/
+
+/* Implements multipass drawing */
+
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+#include "gump.h"
+
+/* CHD BUG this belongs in fxglide.h */
+void FX_CSTYLE
+_gumpTexCombineFunction( int virtual_tmu );
+
+GrMPState _gumpState;
+
+GR_DIENTRY(guMPInit, void, ( void ))
+{
+  int i;
+
+  GDBG_INFO((98,"guMPInit()\n"));
+  for (i = 0; i < GLIDE_NUM_VIRTUAL_TMU; i += 1)
+  {
+    _gumpState.mmid[i] = (GrMipMapId_t) GR_NULL_MIPMAP_HANDLE;
+  }
+  _gumpState.tc_fnc = GR_MPTEXTURECOMBINE_ADD;
+}
+
+GR_DIENTRY(guMPTexCombineFunction, void, 
+           ( GrMPTextureCombineFnc_t tc_fnc ))
+{
+  GDBG_INFO((98,"guMPTexCombineFunction(%d)\n",tc_fnc));
+  _gumpState.tc_fnc = tc_fnc;
+}
+
+GR_DIENTRY(guMPTexSource, void, 
+           ( GrChipID_t virtual_tmu, GrMipMapId_t mmid ))
+{
+  GR_DCL_GC;
+  FXUNUSED( gc );
+  GDBG_INFO((98,"guMPTexSource(%d,%d)\n",virtual_tmu,mmid));
+  GR_CHECK_TMU("guMPTexSource",virtual_tmu);
+  _gumpState.mmid[virtual_tmu] = mmid;
+}
+
+/*---------------------------------------------------------------------------
+**  guFbReadRegion XXX obsolete
+*/
+GR_ENTRY(guFbReadRegion, void, ( const int srcX, const int srcY, const int w, const int h, const void *dst, const int strideInBytes ) )
+{
+}
+
+/*---------------------------------------------------------------------------
+**  guFbWriteRegion XXX obsolete
+*/
+GR_ENTRY(guFbWriteRegion, void, ( const int dstX, const int dstY, const int w, const int h, const void *src, const int strideInBytes))
+{
+}
Index: trunk/src/opengl/glide/sst1/glide/gump.h
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gump.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gump.h	(revision 2885)
@@ -0,0 +1,62 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gump.h,v 1.1 2000-02-25 00:31:20 sandervl Exp $
+** $Log: gump.h,v $
+** Revision 1.1  2000-02-25 00:31:20  sandervl
+** Created new Voodoo 1 Glide dir
+**
+**
+*/
+
+/* Multipass drawing */
+
+#ifndef __GUMP_H__
+#define __GUMP_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GLIDE_NUM_VIRTUAL_TMU   2   /* Number of virtual TMUs */
+
+typedef FxU32 GrMPTextureCombineFnc_t;
+#define GR_MPTEXTURECOMBINE_ADD           0x0 /*  */
+#define GR_MPTEXTURECOMBINE_MULTIPLY      0x1 /*  */
+#define GR_MPTEXTURECOMBINE_DETAIL0       0x2 /*  */
+#define GR_MPTEXTURECOMBINE_DETAIL1       0x3 /*  */
+#define GR_MPTEXTURECOMBINE_TRILINEAR0    0x4 /*  */
+#define GR_MPTEXTURECOMBINE_TRILINEAR1    0x5 /*  */
+#define GR_MPTEXTURECOMBINE_SUBTRACT      0x6 /*  */
+
+typedef struct {
+  GrMipMapId_t              mmid[GLIDE_NUM_VIRTUAL_TMU];
+  GrMPTextureCombineFnc_t   tc_fnc;
+} GrMPState;
+
+FX_ENTRY void FX_CALL guMPInit( void );
+FX_ENTRY void FX_CALL guMPTexCombineFunction( GrMPTextureCombineFnc_t tc );
+FX_ENTRY void FX_CALL guMPTexSource( GrChipID_t virtual_tmu, GrMipMapId_t mmid );
+FX_ENTRY void FX_CALL guMPDrawTriangle( const GrVertex *a, const GrVertex *b, const GrVertex *c );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __GUMP_H__ */
Index: trunk/src/opengl/glide/sst1/glide/gutex.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gutex.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gutex.c	(revision 2885)
@@ -0,0 +1,170 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gutex.c,v 1.1 2000-02-25 00:31:20 sandervl Exp $
+** $Log: gutex.c,v $
+** Revision 1.1  2000-02-25 00:31:20  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 7     3/04/97 9:08p Dow
+ * Neutered multiplatform multiheaded monster
+ * 
+ * 6     12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+ * 
+ * 5     11/18/96 9:14a Sellers
+ * added checking for crossing of 2 MByte texture boundry
+**
+*/
+
+#include <string.h>
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+/* externals from gtex.c and gtexdl.c */
+extern FxU32 _grMipMapHostSize[][16];
+extern FxU32 _gr_aspect_index_table[];
+extern FxU32 _gr_aspect_xlate_table[];
+extern FxU32 _gr_evenOdd_xlate_table[];
+
+/*---------------------------------------------------------------------------
+** guTexSource
+*/
+
+GR_ENTRY(guTexSource, void, ( GrMipMapId_t mmid ))
+{
+  FxU32               texMode, tLod;
+  FxU32               oldtexMode;
+  FxU32               baseAddress;
+  int                 tmu;
+  const GrMipMapInfo *mminfo;
+
+  GR_BEGIN_NOFIFOCHECK("guTexSource",99);
+  GDBG_INFO_MORE((gc->myLevel,"(%d)\n",mmid));
+
+  /*
+  ** Make sure that mmid is not NULL
+  */
+  if ( mmid == GR_NULL_MIPMAP_HANDLE )
+  {
+    return;
+  }
+
+  /*
+  ** get a pointer to the relevant GrMipMapInfo struct
+  */
+  mminfo = &gc->mm_table.data[mmid];
+  tmu = mminfo->tmu;
+
+  GR_CHECK_TMU( myName, tmu );
+  GR_CHECK_W( myName, mmid == gc->state.current_mm[tmu], "setting same state twice" );
+
+  gc->state.current_mm[tmu] = mmid;
+
+  /*
+  ** Set up new glide state for this mmid
+  */
+  gc->state.tmu_config[tmu].mmMode =  mminfo->mipmap_mode;
+  gc->state.tmu_config[tmu].smallLod = mminfo->lod_min;
+  gc->state.tmu_config[tmu].largeLod = mminfo->lod_max;
+  gc->state.tmu_config[tmu].evenOdd =  mminfo->odd_even_mask;
+  gc->state.tmu_config[tmu].nccTable = 0;
+
+  /*
+  ** Set up base address, texMode, and tLod registers
+  */
+  baseAddress = mminfo->tmu_base_address >> 3;
+  texMode     = mminfo->tTextureMode;
+  tLod        = mminfo->tLOD;
+
+  oldtexMode = gc->state.tmu_config[tmu].textureMode;
+  oldtexMode &= ~( SST_TFORMAT | SST_TCLAMPT | 
+                   SST_TCLAMPS | SST_TNCCSELECT | 
+                   SST_TLODDITHER | SST_TCLAMPW | 
+                   SST_TMAGFILTER | SST_TMINFILTER | 
+                   SST_TRILINEAR );
+  texMode |= oldtexMode;
+  if (!gc->state.allowLODdither)
+    texMode &= ~SST_TLODDITHER;
+
+ /* 
+  **  Download the NCC table, if needed.  
+  */
+  if (
+      (mminfo->format==GR_TEXFMT_YIQ_422) ||
+      (mminfo->format==GR_TEXFMT_AYIQ_8422)
+      )
+  {
+    int
+      table;                    /* ncc table we'll use */
+    /* See if it's already down there */
+    if (gc->tmu_state[tmu].ncc_mmids[0] == mmid) {
+      /* Table 0 has what we need, so make it current */
+      table = 0;
+    } else if (gc->tmu_state[tmu].ncc_mmids[1] == mmid) {
+      /* Table 1 has what we need, so make it current */
+      table = 1;
+    } else {
+      /*
+      **  it's not down there, so we need to pick the table and
+      **  download it
+      */
+      /* Which table should we use? */
+      table = gc->tmu_state[tmu].next_ncc_table;
+      /* Download NCC table */
+      _grTexDownloadNccTable( tmu, table, &mminfo->ncc_table, 0, 11 );
+      /* Set the mmid so we known it's down there */
+      gc->tmu_state[tmu].ncc_mmids[table] = mmid;
+      /* Set the state to know which table was the LRA */
+      gc->tmu_state[tmu].next_ncc_table =
+        (table == 0 ? 1 : 0);
+    } /* we had to download it */
+    /*
+    **  Setting the TNCCSelect bit to 0 selects table 0, setting it to 1
+    **  selects table 1
+    */
+    if (table == 0)
+      texMode &= ~(SST_TNCCSELECT);
+    else
+      texMode |= SST_TNCCSELECT;
+  } /* if it's an NCC texture */
+
+  GR_SET_EXPECTED_SIZE(12+2*PACKER_WORKAROUND_SIZE);
+
+  /* Write relevant registers out to hardware */
+
+  PACKER_WORKAROUND;
+  hw = SST_TMU(hw,tmu);
+  GR_SET( hw->texBaseAddr , baseAddress );
+  GR_SET( hw->textureMode , texMode );
+  GR_SET( hw->tLOD , tLod );
+  PACKER_WORKAROUND;
+
+  /* update shadows */
+  gc->state.tmu_config[tmu].texBaseAddr = baseAddress;
+  gc->state.tmu_config[tmu].textureMode = texMode;
+  gc->state.tmu_config[tmu].tLOD = tLod;
+ 
+  GR_END();
+} /* guTexSource */
+
Index: trunk/src/opengl/glide/sst1/glide/gxdraw.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/gxdraw.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/gxdraw.c	(revision 2885)
@@ -0,0 +1,862 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/gxdraw.c,v 1.1 2000-02-25 00:31:20 sandervl Exp $
+** $Log: gxdraw.c,v $
+** Revision 1.1  2000-02-25 00:31:20  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 36    9/19/97 12:38p Peter
+ * asm rush trisetup vs alt fifo
+ * 
+ * 35    9/10/97 10:13p Peter
+ * fifo logic from GaryT, non-normalized fp first cut
+ * 
+ * 34    8/19/97 8:55p Peter
+ * lots of stuff, hopefully no muckage
+ * 
+ * 33    8/01/97 11:49a Dow
+ * Added conventional FIFO accounting
+ * 
+ * 32    7/07/97 3:43p Jdt
+ * Fixes to trisetup_nogradients
+ * 
+ * 31    7/07/97 2:14p Jdt
+ * Mods to drawtriangle for parity with asm
+ * 
+ * 30    7/07/97 8:33a Jdt
+ * New tracing macros.
+ * 
+ * 29    7/04/97 12:08p Dow
+ * Fixed chip field muckage
+ * 
+ * 28    7/01/97 7:44a Jdt
+ * Separated SST-1 and SST-96 trisetup implementations.
+ * 
+ * 27    6/30/97 3:30p Jdt
+ * Fixed Watcom Wart.
+ * 
+ * 26    6/30/97 3:23p Jdt
+ * rollback
+ * 
+ * 24    6/29/97 11:49p Jdt
+ * First pass at triangle setup optimization for SST96
+ * 
+ * 23    6/20/97 5:53p Dow
+ * Change for subtle chip field bug
+ * 
+ * 22    6/18/97 5:54p Dow
+ * P6 adjustments
+ * 
+ * 21    5/27/97 11:37p Pgj
+ * Fix for Bug report 545
+ * 
+ * 20    4/13/97 2:06p Pgj
+ * eliminate all anonymous unions (use hwDep)
+ * 
+ * 19    3/21/97 12:42p Dow
+ * Made STWHints not send the Bend Over Baby Packet to FBI Jr.
+ * 
+ * 18    3/04/97 9:45p Dow
+ * More neutering of the multiheaded...
+ * 
+ * 17    3/04/97 9:08p Dow
+ * Neutered multiplatform multiheaded monster
+ * 
+ * 16    2/14/97 12:55p Dow
+ * moved vg96 fifo wrap into init code
+ * 
+ * 15    12/23/96 1:37p Dow
+ * chagnes for multiplatform glide
+**
+*/
+
+#include <3dfx.h>
+#include <glidesys.h>
+
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+#ifdef GDBG_INFO_ON
+  /* Some debugging information */
+static char *indexNames[] = {  
+  "GR_VERTEX_X_OFFSET",         /* 0 */
+  "GR_VERTEX_Y_OFFSET",         /* 1 */
+  "GR_VERTEX_Z_OFFSET",         /* 2 */
+  "GR_VERTEX_R_OFFSET",         /* 3 */
+  "GR_VERTEX_G_OFFSET",         /* 4 */
+  "GR_VERTEX_B_OFFSET",         /* 5 */
+  "GR_VERTEX_OOZ_OFFSET",       /* 6 */
+  "GR_VERTEX_A_OFFSET",         /* 7 */
+  "GR_VERTEX_OOW_OFFSET",       /* 8 */
+  "GR_VERTEX_SOW_TMU0_OFFSET",  /* 9 */
+  "GR_VERTEX_TOW_TMU0_OFFSET",  /* 10 */
+  "GR_VERTEX_OOW_TMU0_OFFSET",  /* 11 */
+  "GR_VERTEX_SOW_TMU1_OFFSET",  /* 12 */
+  "GR_VERTEX_TOW_TMU1_OFFSET",  /* 13 */
+  "GR_VERTEX_OOW_TMU1_OFFSET"  /* 14 */
+};  
+#endif
+
+/*
+ **  _trisetup
+ **
+ **  This routine does all the setup needed for drawing a triangle.  It
+ **  is intended to be an exact specification for the mechanisim used
+ **  to pass vertices to the assembly language triangle setup code, and
+ **  as such has no optimizations at all.  Whenever a 'shortcut'
+ **  routine to draw triangles (such as for antialiasing, fast lines,
+ **  fast spans, polygons, etc) is needed, this code should be used as
+ **  the starting point.
+**
+*/  
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+GR_DDFUNC(_trisetup, FxI32, ( const GrVertex *va, const GrVertex *vb, const GrVertex *vc ))
+{
+  GR_DCL_GC;
+  GR_DCL_HW;
+  const float *fa = &va->x;
+  const float *fb = &vb->x;
+  const float *fc = &vc->x;
+  float ooa, dxAB, dxBC, dyAB, dyBC;
+  int i,j,culltest;
+  int ay, by, cy;
+  float *fp;
+  struct dataList_s *dlp;
+  volatile FxU32 *fifoPtr;
+  
+  culltest = gc->state.cull_mode; /* 1 if negative, 0 if positive */
+  _GlideRoot.stats.trisProcessed++;
+  
+  /*
+   **  Sort the vertices.
+   **  Whenever the radial order is reversed (from counter-clockwise to
+   **  clockwise), we need to change the area of the triangle.  Note
+   **  that we know the first two elements are X & Y by looking at the
+   **  grVertex structure.  
+   */
+  ay = *(int *)&va->y;
+  by = *(int *)&vb->y;
+  if (ay < 0) ay ^= 0x7FFFFFFF;
+  cy = *(int *)&vc->y;
+  if (by < 0) by ^= 0x7FFFFFFF;
+  if (cy < 0) cy ^= 0x7FFFFFFF;
+  if (ay < by) {
+    if (by > cy) {              /* acb */
+      if (ay < cy) {
+        fa = &va->x;
+        fb = &vc->x;
+        fc = &vb->x;
+        culltest ^= 1;
+      } else {                  /* cab */
+        fa = &vc->x;
+        fb = &va->x;
+        fc = &vb->x;
+      }
+      /* else it's already sorted */
+    }
+  } else {
+    if (by < cy) {              /* bac */
+      if (ay < cy) {
+        fa = &vb->x;
+        fb = &va->x;
+        fc = &vc->x;
+        culltest ^= 1;
+      } else {                  /* bca */
+        fa = &vb->x;
+        fb = &vc->x;
+        fc = &va->x;
+      }
+    } else {                    /* cba */
+      fa = &vc->x;
+      fb = &vb->x;
+      fc = &va->x;
+      culltest ^= 1;
+    }
+  }
+
+  /* Compute Area */
+  dxAB = fa[GR_VERTEX_X_OFFSET] - fb[GR_VERTEX_X_OFFSET];
+  dxBC = fb[GR_VERTEX_X_OFFSET] - fc[GR_VERTEX_X_OFFSET];
+  
+  dyAB = fa[GR_VERTEX_Y_OFFSET] - fb[GR_VERTEX_Y_OFFSET];
+  dyBC = fb[GR_VERTEX_Y_OFFSET] - fc[GR_VERTEX_Y_OFFSET];
+  
+  /* this is where we store the area */
+  _GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
+  
+  /* Zero-area triangles are BAD!! */
+  j = *(long *)&_GlideRoot.pool.ftemp1;
+  if ((j & 0x7FFFFFFF) == 0)
+    return 0;
+  
+  /* Backface culling, use sign bit as test */
+  if (gc->state.cull_mode != GR_CULL_DISABLE) {
+    if ((j ^ (culltest<<31)) >= 0) {
+      return -1;
+    }
+  }
+  
+  /* Fence On P6 If Necessary */
+  if ( _GlideRoot.CPUType == 6 ) {
+      /* In the macro there is a slop of 4 DWORDS that I have removed */
+      if ( (gc->hwDep.sst96Dep.writesSinceFence + ( _GlideRoot.curTriSize >> 2 )) > 128 ) {
+          P6FENCE;
+          gc->hwDep.sst96Dep.writesSinceFence = 0;
+      }
+      gc->hwDep.sst96Dep.writesSinceFence      += 
+          _GlideRoot.curTriSize>>2;
+  }
+
+  /* Wrap Fifo now if triangle is going to incur a wrap */
+  if (gc->fifoData.hwDep.vg96FIFOData.fifoSize < (FxU32) _GlideRoot.curTriSize ) {
+#if SST96_ALT_FIFO_WRAP
+    gc->fifoData.hwDep.vg96FIFOData.blockSize = _GlideRoot.curTriSize;
+    initWrapFIFO(&gc->fifoData);
+#else
+    _grSst96FifoMakeRoom();
+#endif
+  }
+  
+  GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSize);
+
+  /* Grab fifo pointer into a local */
+  fifoPtr = gc->fifoData.hwDep.vg96FIFOData.fifoPtr;
+  
+  /* Settle Bookeeping */
+  gc->fifoData.hwDep.vg96FIFOData.fifoSize -= _GlideRoot.curTriSize;
+  gc->fifoData.hwDep.vg96FIFOData.fifoPtr  += _GlideRoot.curTriSize>>2;
+  
+  /* Start first group write packet */
+  SET_GW_CMD(    fifoPtr, 0, gc->hwDep.sst96Dep.gwCommand );
+  SET_GW_HEADER( fifoPtr, 1, gc->hwDep.sst96Dep.gwHeaders[0] );
+
+  ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1;
+  /* GMT: note that we spread out our PCI writes */
+  /* write out X & Y for vertex A */
+  FSET_GW_ENTRY( fifoPtr, 2, fa[0] );
+  FSET_GW_ENTRY( fifoPtr, 3, fa[1] );
+
+  dlp = gc->dataList;
+  i = dlp->i;
+  
+  /* write out X & Y for vertex B */
+  FSET_GW_ENTRY( fifoPtr, 4, fb[0] );
+  FSET_GW_ENTRY( fifoPtr, 5, fb[1] );
+
+  /* write out X & Y for vertex C */
+  FSET_GW_ENTRY( fifoPtr, 6, fc[0] );
+  FSET_GW_ENTRY( fifoPtr, 7, fc[1] );
+  fifoPtr += 8;
+
+  /*
+  ** Divide the deltas by the area for gradient calculation.
+  */
+  dxBC *= ooa;
+  dyAB *= ooa;
+  dxAB *= ooa;
+  dyBC *= ooa;
+
+/* access a floating point array with a byte index */
+#define FARRAY(p,i) (*(float *)((i)+(int)(p)))
+
+  while (i) {
+    fp = dlp->addr;
+    /* chip field change */
+    if (i & 1) 
+        goto secondary_packet;
+    else {
+      float dpAB, dpBC,dpdx, dpdy;
+      
+      dpBC = FARRAY(fb,i);
+      dpdx = FARRAY(fa,i);
+      FSET_GW_ENTRY( fifoPtr, 0, dpdx );
+      dpAB = dpdx - dpBC;
+      dpBC = dpBC - FARRAY(fc,i);
+      dpdx = dpAB * dyBC - dpBC * dyAB;
+      FSET_GW_ENTRY( fifoPtr, 1, dpdx );
+      dpdy = dpBC * dxAB - dpAB * dxBC;
+      dlp++;
+      i = dlp->i;
+      FSET_GW_ENTRY( fifoPtr, 2, dpdy );
+      fifoPtr += 3;
+    }
+  }
+
+  /* write triangle command */
+triangle_command:
+  FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.ftemp1 );
+  fifoPtr+=1;
+  
+  if (((FxU32)fifoPtr) & 0x7) {
+    FSET_GW_ENTRY( fifoPtr, 0, 0.0f );
+    fifoPtr += 1;
+  }
+
+  GR_ASSERT(fifoPtr == gc->fifoData.hwDep.vg96FIFOData.fifoPtr);
+
+  GR_CHECK_SIZE();
+  
+  _GlideRoot.stats.trisDrawn++;
+
+  return 1;
+
+secondary_packet:
+  /* Round out last header */
+  if (((FxU32) fifoPtr) & 0x7) {
+    FSET_GW_ENTRY( fifoPtr, 0, 0.0f );
+    fifoPtr  += 1;
+  }
+  /* Start new packet
+     note, there can only ever be two different packets 
+     using gwHeaderNum++ would be more general, but this
+     reflects the actual implementation */
+  SET_GW_CMD(    fifoPtr, 0, (FxU32)fp );
+  SET_GW_HEADER( fifoPtr, 1, gc->hwDep.sst96Dep.gwHeaders[1] );
+  fifoPtr+=2;
+  dlp++;
+  i = dlp->i;
+  while( i ) {
+    float dpAB, dpBC,dpdx, dpdy;
+
+    fp = dlp->addr;
+    dpBC = FARRAY(fb,i);
+    dpdx = FARRAY(fa,i);
+    FSET_GW_ENTRY( fifoPtr, 0, dpdx );
+    dpAB = dpdx - dpBC;
+    dpBC = dpBC - FARRAY(fc,i);
+    dpdx = dpAB * dyBC - dpBC * dyAB;
+    FSET_GW_ENTRY( fifoPtr, 1, dpdx );
+    dpdy = dpBC * dxAB - dpAB * dxBC;
+    dlp++;
+    i = dlp->i;
+    FSET_GW_ENTRY( fifoPtr, 2, dpdy );
+    fifoPtr += 3;
+  }
+  if (((FxU32)fifoPtr) & 0x7) {
+    FSET_GW_ENTRY( fifoPtr, 0, 0.0f );
+    fifoPtr += 1;
+  }
+  SET_GW_CMD(    fifoPtr, 0, gc->hwDep.sst96Dep.gwCommand );
+  SET_GW_HEADER( fifoPtr, 1, GW_TRICMD_MASK );
+  fifoPtr += 2;
+  goto triangle_command;
+} /* _trisetup */
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
+GR_DDFUNC(_trisetup, FxI32, ( const GrVertex *va, const GrVertex *vb, const GrVertex *vc ))
+{
+  GR_DCL_GC;
+  GR_DCL_HW;
+  const float *fa = &va->x;
+  const float *fb = &vb->x;
+  const float *fc = &vc->x;
+  float ooa, dxAB, dxBC, dyAB, dyBC;
+  int i,j,culltest;
+  int ay, by, cy;
+  float *fp;
+  struct dataList_s *dlp;
+  
+  culltest = gc->state.cull_mode; /* 1 if negative, 0 if positive */
+  _GlideRoot.stats.trisProcessed++;
+  
+  /*
+   **  Sort the vertices.
+   **  Whenever the radial order is reversed (from counter-clockwise to
+   **  clockwise), we need to change the area of the triangle.  Note
+   **  that we know the first two elements are X & Y by looking at the
+   **  grVertex structure.  
+   */
+  ay = *(int *)&va->y;
+  by = *(int *)&vb->y;
+  if (ay < 0) ay ^= 0x7FFFFFFF;
+  cy = *(int *)&vc->y;
+  if (by < 0) by ^= 0x7FFFFFFF;
+  if (cy < 0) cy ^= 0x7FFFFFFF;
+  if (ay < by) {
+    if (by > cy) {              /* acb */
+      if (ay < cy) {
+        fa = &va->x;
+        fb = &vc->x;
+        fc = &vb->x;
+        culltest ^= 1;
+      } else {                  /* cab */
+        fa = &vc->x;
+        fb = &va->x;
+        fc = &vb->x;
+      }
+      /* else it's already sorted */
+    }
+  } else {
+    if (by < cy) {              /* bac */
+      if (ay < cy) {
+        fa = &vb->x;
+        fb = &va->x;
+        fc = &vc->x;
+        culltest ^= 1;
+      } else {                  /* bca */
+        fa = &vb->x;
+        fb = &vc->x;
+        fc = &va->x;
+      }
+    } else {                    /* cba */
+      fa = &vc->x;
+      fb = &vb->x;
+      fc = &va->x;
+      culltest ^= 1;
+    }
+  }
+#if (GLIDE_PLATFORM & GLIDE_HW_SST1) && defined(GLIDE_USE_ALT_REGMAP)
+  hw = SST_WRAP(hw,128);                /* use alternate register mapping */
+#endif
+  /* Compute Area */
+  dxAB = fa[GR_VERTEX_X_OFFSET] - fb[GR_VERTEX_X_OFFSET];
+  dxBC = fb[GR_VERTEX_X_OFFSET] - fc[GR_VERTEX_X_OFFSET];
+  
+  dyAB = fa[GR_VERTEX_Y_OFFSET] - fb[GR_VERTEX_Y_OFFSET];
+  dyBC = fb[GR_VERTEX_Y_OFFSET] - fc[GR_VERTEX_Y_OFFSET];
+  
+  /* this is where we store the area */
+  _GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
+  
+  /* Zero-area triangles are BAD!! */
+  j = *(long *)&_GlideRoot.pool.ftemp1;
+  if ((j & 0x7FFFFFFF) == 0)
+    return 0;
+  
+  /* Backface culling, use sign bit as test */
+  if (gc->state.cull_mode != GR_CULL_DISABLE) {
+    if ((j ^ (culltest<<31)) >= 0) {
+      return -1;
+    }
+  }
+  
+  GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSize);
+  
+  ooa = _GlideRoot.pool.f1 / _GlideRoot.pool.ftemp1;
+  /* GMT: note that we spread out our PCI writes */
+  /* write out X & Y for vertex A */
+  GR_SETF( hw->FvA.x, fa[GR_VERTEX_X_OFFSET] );
+  GR_SETF( hw->FvA.y, fa[GR_VERTEX_Y_OFFSET] );
+
+  dlp = gc->dataList;
+  i = dlp->i;
+  
+  /* write out X & Y for vertex B */
+  GR_SETF( hw->FvB.x, fb[GR_VERTEX_X_OFFSET] );
+  GR_SETF( hw->FvB.y, fb[GR_VERTEX_Y_OFFSET] );
+  
+  /* write out X & Y for vertex C */
+  GR_SETF( hw->FvC.x, fc[GR_VERTEX_X_OFFSET] );
+  GR_SETF( hw->FvC.y, fc[GR_VERTEX_Y_OFFSET] );
+
+  /*
+  ** Divide the deltas by the area for gradient calculation.
+  */
+  dxBC *= ooa;
+  dyAB *= ooa;
+  dxAB *= ooa;
+  dyBC *= ooa;
+
+/* access a floating point array with a byte index */
+#define FARRAY(p,i) (*(float *)((i)+(int)(p)))
+
+  /* 
+  ** The src vector contains offsets from fa, fb, and fc to for which
+  **  gradients need to be calculated, and is null-terminated.
+  */
+  while (i) {
+    fp = dlp->addr;
+    if (i & 1) {                   /* packer bug check */
+      if (i & 2) P6FENCE;
+      GR_SETF( fp[0], 0.0F );
+      if (i & 2) P6FENCE;
+      dlp++;
+      i = dlp->i;
+    }
+    else {
+      float dpAB, dpBC,dpdx, dpdy;
+
+      dpBC = FARRAY(fb,i);
+      dpdx = FARRAY(fa,i);
+      GR_SETF( fp[0], dpdx );
+
+      dpAB = dpdx - dpBC;
+      dpBC = dpBC - FARRAY(fc,i);
+      dpdx = dpAB * dyBC - dpBC * dyAB;
+
+GDBG_INFO((285,"p0,1x: %g %g dpdx: %g\n",dpAB * dyBC,dpBC * dyAB,dpdx));
+      GR_SETF( fp[DPDX_OFFSET>>2] , dpdx );
+      dpdy = dpBC * dxAB - dpAB * dxBC;
+
+GDBG_INFO((285,"p0,1y: %g %g dpdy: %g\n",dpBC * dxAB,dpAB * dxBC,dpdy));
+      dlp++;
+      i = dlp->i;
+      GR_SETF( fp[DPDY_OFFSET>>2] , dpdy );
+    }
+  }
+
+  /* Draw the triangle by writing the area to the triangleCMD register */
+  P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, _GlideRoot.pool.ftemp1 ) );
+  _GlideRoot.stats.trisDrawn++;
+
+  GR_CHECK_SIZE();
+  _GlideRoot.stats.trisDrawn++;
+  return 1;
+} /* _trisetup */
+#else
+#error "Need to implement trisetup for this platform"
+#endif
+
+/*
+**  _trisetup_nogradients
+**
+**  This routine does all the setup needed for drawing a triangle except
+**  that it assumes that the gradients are already in the chip.
+**
+**  Also we assume we don't have to test for backface triangles - this is
+**  typically done outside this routine, as in grDrawPlanarPolygon
+*/  
+
+#if ( GLIDE_PLATFORM & GLIDE_HW_SST96 )
+GR_DDFUNC(_trisetup_nogradients, FxI32, ( const GrVertex *va, const GrVertex *vb, const GrVertex *vc ))
+{
+  GR_DCL_GC;
+  GR_DCL_HW;
+  const float *fa = &va->x;
+  const float *fb = &vb->x;
+  const float *fc = &vc->x;
+  float dxAB, dxBC, dyAB, dyBC;
+  int i,j;
+  int ay, by, cy;
+  float *fp;
+  struct dataList_s *dlp;
+  volatile FxU32 *fifoPtr;
+
+  /*
+  **  Sort the vertices.
+  **  Whenever the radial order is reversed (from counter-clockwise to
+  **  clockwise), we need to change the area of the triangle.  Note
+  **  that we know the first two elements are X & Y by looking at the
+  **  grVertex structure.  
+  */
+  ay = *(int *)&va->y;
+  by = *(int *)&vb->y;
+  if (ay < 0) ay ^= 0x7FFFFFFF;
+  cy = *(int *)&vc->y;
+  if (by < 0) by ^= 0x7FFFFFFF;
+  if (cy < 0) cy ^= 0x7FFFFFFF;
+  if (ay < by) {
+    if (by > cy) {              /* acb */
+      if (ay < cy) {
+        fa = &va->x;
+        fb = &vc->x;
+        fc = &vb->x;
+      } else {                  /* cab */
+        fa = &vc->x;
+        fb = &va->x;
+        fc = &vb->x;
+      }
+      /* else it's already sorted */
+    }
+  } else {
+    if (by < cy) {              /* bac */
+      if (ay < cy) {
+        fa = &vb->x;
+        fb = &va->x;
+        fc = &vc->x;
+      } else {                  /* bca */
+        fa = &vb->x;
+        fb = &vc->x;
+        fc = &va->x;
+      }
+    } else {                    /* cba */
+      fa = &vc->x;
+      fb = &vb->x;
+      fc = &va->x;
+    }
+  }
+
+  /* Compute Area */
+  dxAB = fa[GR_VERTEX_X_OFFSET] - fb[GR_VERTEX_X_OFFSET];
+  dxBC = fb[GR_VERTEX_X_OFFSET] - fc[GR_VERTEX_X_OFFSET];
+
+  dyAB = fa[GR_VERTEX_Y_OFFSET] - fb[GR_VERTEX_Y_OFFSET];
+  dyBC = fb[GR_VERTEX_Y_OFFSET] - fc[GR_VERTEX_Y_OFFSET];
+
+  /* this is where we store the area */
+  _GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
+  _GlideRoot.stats.trisProcessed++;
+
+  /* Zero-area triangles are BAD!! */
+  j = *(long *)&_GlideRoot.pool.ftemp1;
+  if ((j & 0x7FFFFFFF) == 0) {
+    return 0;
+  }
+
+  /* Fence On P6 If Necessary */
+  if ( _GlideRoot.CPUType == 6 ) {
+      /* In the macro there is a slop of 4 DWORDS that I have removed */
+      if ( (gc->hwDep.sst96Dep.writesSinceFence + 
+            ( _GlideRoot.curTriSizeNoGradient >> 2 )) > 128 ) {
+          P6FENCE;
+          gc->hwDep.sst96Dep.writesSinceFence = 0;
+      }
+      gc->hwDep.sst96Dep.writesSinceFence      += 
+          _GlideRoot.curTriSizeNoGradient>>2;
+  }
+
+  /* Wrap Fifo now if triangle is going to incur a wrap */
+  if (gc->fifoData.hwDep.vg96FIFOData.fifoSize < (FxU32) _GlideRoot.curTriSizeNoGradient ) {
+#if SST96_ALT_FIFO_WRAP
+    gc->fifoData.hwDep.vg96FIFOData.blockSize = _GlideRoot.curTriSizeNoGradient;
+    initWrapFIFO(&gc->fifoData);
+#else
+    _grSst96FifoMakeRoom();
+#endif
+  }
+
+  /* bookeeping */
+  fifoPtr = gc->fifoData.hwDep.vg96FIFOData.fifoPtr;
+  gc->fifoData.hwDep.vg96FIFOData.fifoSize -= _GlideRoot.curTriSizeNoGradient;
+  gc->fifoData.hwDep.vg96FIFOData.fifoPtr  += _GlideRoot.curTriSizeNoGradient>>2;
+
+  /* packet header */
+  SET_GW_CMD(    fifoPtr, 0, gc->hwDep.sst96Dep.gwCommand );
+  SET_GW_HEADER( fifoPtr, 1, (gc->hwDep.sst96Dep.gwHeaders[0] & ~GWH_DXY_BITS) );
+
+  FSET_GW_ENTRY( fifoPtr, 2, fa[0] );
+  FSET_GW_ENTRY( fifoPtr, 3, fa[1] );
+
+  dlp = gc->dataList;
+  i = dlp->i;
+  
+  /* write out X & Y for vertex B */
+  FSET_GW_ENTRY( fifoPtr, 4, fb[0] );
+  FSET_GW_ENTRY( fifoPtr, 5, fb[1] );
+
+  /* write out X & Y for vertex C */
+  FSET_GW_ENTRY( fifoPtr, 6, fc[0] );
+  FSET_GW_ENTRY( fifoPtr, 7, fc[1] );
+  fifoPtr += 8;
+
+  dlp = gc->dataList;
+  i = dlp->i;
+
+/* access a floating point array with a byte index */
+#define FARRAY(p,i) (*(float *)((i)+(int)(p)))
+
+  while (i) {
+    fp = dlp->addr;
+    if (i & 1) 
+        goto secondary_packet;
+    else {
+      float dpdx;
+      dpdx = FARRAY(fa,i);
+      FSET_GW_ENTRY( fifoPtr, 0, dpdx );
+      fifoPtr += 1;
+      dlp++;
+      i = dlp->i;
+    }
+  }
+
+triangle_command:
+  FSET_GW_ENTRY( fifoPtr, 0, _GlideRoot.pool.ftemp1 );
+  fifoPtr += 1;
+
+  if (((FxU32)fifoPtr) & 0x7) {
+    FSET_GW_ENTRY( fifoPtr, 0, 0.0f );
+    fifoPtr += 1;
+  }
+
+  GR_ASSERT(fifoPtr == gc->fifoData.hwDep.vg96FIFOData.fifoPtr);
+
+  _GlideRoot.stats.trisDrawn++;
+
+  return 1;
+
+secondary_packet:
+  /* Round out last packet */
+  if (((FxU32) fifoPtr) & 0x7) {
+    FSET_GW_ENTRY( fifoPtr, 0, 0.0f );
+    fifoPtr  += 1;
+  }
+
+  /* Start new packet
+     note, there can only ever be two different packets 
+     using gwHeaderNum++ would be more general, but this
+     reflects the actual implementation */
+  SET_GW_CMD(    fifoPtr, 0, (FxU32)fp );
+  SET_GW_HEADER( fifoPtr, 1, gc->hwDep.sst96Dep.gwHeaders[1] );
+  fifoPtr+=2;
+  dlp++;
+  i = dlp->i;
+  while( i ) {
+    float dpdx;
+    dpdx = FARRAY(fa,i);
+    FSET_GW_ENTRY( fifoPtr, 0, dpdx );
+    dlp++;
+    i = dlp->i;
+    fifoPtr += 1;
+  }
+  if (((FxU32)fifoPtr) & 0x7) {
+    FSET_GW_ENTRY( fifoPtr, 0, 0.0f );
+    fifoPtr += 1;
+  }
+  SET_GW_CMD(    fifoPtr, 0, gc->hwDep.sst96Dep.gwCommand );
+  SET_GW_HEADER( fifoPtr, 1, GW_TRICMD_MASK );
+  fifoPtr += 2;
+  goto triangle_command;
+} /* _trisetup_nogradients */
+
+#elif ( GLIDE_PLATFORM & GLIDE_HW_SST1 )
+
+GR_DDFUNC(_trisetup_nogradients, FxI32, ( const GrVertex *va, const GrVertex *vb, const GrVertex *vc ))
+{
+  GR_DCL_GC;
+  GR_DCL_HW;
+  const float *fa = &va->x;
+  const float *fb = &vb->x;
+  const float *fc = &vc->x;
+  float dxAB, dxBC, dyAB, dyBC;
+  int i,j;
+  int ay, by, cy;
+  float *fp;
+  struct dataList_s *dlp;
+
+  /*
+  **  Sort the vertices.
+  **  Whenever the radial order is reversed (from counter-clockwise to
+  **  clockwise), we need to change the area of the triangle.  Note
+  **  that we know the first two elements are X & Y by looking at the
+  **  grVertex structure.  
+  */
+  ay = *(int *)&va->y;
+  by = *(int *)&vb->y;
+  if (ay < 0) ay ^= 0x7FFFFFFF;
+  cy = *(int *)&vc->y;
+  if (by < 0) by ^= 0x7FFFFFFF;
+  if (cy < 0) cy ^= 0x7FFFFFFF;
+  if (ay < by) {
+    if (by > cy) {              /* acb */
+      if (ay < cy) {
+        fa = &va->x;
+        fb = &vc->x;
+        fc = &vb->x;
+      } else {                  /* cab */
+        fa = &vc->x;
+        fb = &va->x;
+        fc = &vb->x;
+      }
+      /* else it's already sorted */
+    }
+  } else {
+    if (by < cy) {              /* bac */
+      if (ay < cy) {
+        fa = &vb->x;
+        fb = &va->x;
+        fc = &vc->x;
+      } else {                  /* bca */
+        fa = &vb->x;
+        fb = &vc->x;
+        fc = &va->x;
+      }
+    } else {                    /* cba */
+      fa = &vc->x;
+      fb = &vb->x;
+      fc = &va->x;
+    }
+  }
+#if (GLIDE_PLATFORM & GLIDE_HW_SST1) && defined(GLIDE_USE_ALT_REGMAP)
+  hw = SST_WRAP(hw,128);                /* use alternate register mapping */
+#endif
+
+  GR_SET_EXPECTED_SIZE(_GlideRoot.curTriSizeNoGradient);
+
+   /* GMT: note that we spread out our PCI writes */
+   /* write out X & Y for vertex A */
+   GR_SETF( hw->FvA.x, fa[GR_VERTEX_X_OFFSET] );
+   GR_SETF( hw->FvA.y, fa[GR_VERTEX_Y_OFFSET] );
+
+  /* Compute Area */
+  dxAB = fa[GR_VERTEX_X_OFFSET] - fb[GR_VERTEX_X_OFFSET];
+  dxBC = fb[GR_VERTEX_X_OFFSET] - fc[GR_VERTEX_X_OFFSET];
+
+  dyAB = fa[GR_VERTEX_Y_OFFSET] - fb[GR_VERTEX_Y_OFFSET];
+  dyBC = fb[GR_VERTEX_Y_OFFSET] - fc[GR_VERTEX_Y_OFFSET];
+
+   /* write out X & Y for vertex B */
+   GR_SETF( hw->FvB.x, fb[GR_VERTEX_X_OFFSET] );
+   GR_SETF( hw->FvB.y, fb[GR_VERTEX_Y_OFFSET] );
+
+  /* this is where we store the area */
+  _GlideRoot.pool.ftemp1 = dxAB * dyBC - dxBC * dyAB;
+  _GlideRoot.stats.trisProcessed++;
+
+  /* Zero-area triangles are BAD!! */
+  j = *(long *)&_GlideRoot.pool.ftemp1;
+  if ((j & 0x7FFFFFFF) == 0) {
+    GR_CHECK_SIZE_SLOPPY();
+    return 0;
+  }
+  
+  /* write out X & Y for vertex C */
+  GR_SETF( hw->FvC.x, fc[GR_VERTEX_X_OFFSET] );
+  GR_SETF( hw->FvC.y, fc[GR_VERTEX_Y_OFFSET] );
+
+   dlp = gc->dataList;
+   i = dlp->i;
+
+/* access a floating point array with a byte index */
+#define FARRAY(p,i) (*(float *)((i)+(int)(p)))
+
+  /* 
+  ** The src vector contains offsets from fa, fb, and fc to for which
+  ** gradients need to be calculated, and is null-terminated.
+  */
+  while (i) {
+    fp = dlp->addr;
+    if (i & 1) {                   /* packer bug check */
+      if (i & 2) P6FENCE;
+      GR_SETF( fp[0], 0.0F );
+      if (i & 2) P6FENCE;
+      dlp++;
+      i = dlp->i;
+    }
+    else {
+      GR_SETF( fp[0], FARRAY(fa,i) );
+      dlp++;
+      i = dlp->i;
+    }
+  }
+
+  /* Draw the triangle by writing the area to the triangleCMD register */
+  P6FENCE_CMD( GR_SETF( hw->FtriangleCMD, _GlideRoot.pool.ftemp1 ) );
+  _GlideRoot.stats.trisDrawn++;
+
+  GR_CHECK_SIZE();
+  return 1;
+} /* _trisetup_nogradients */
+#else
+#error  "Need Triangle Setup code for this hardware"
+#endif
+
Index: trunk/src/opengl/glide/sst1/glide/makefile
===================================================================
--- trunk/src/opengl/glide/sst1/glide/makefile	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/makefile	(revision 2885)
@@ -0,0 +1,49 @@
+# $Id: makefile,v 1.1 2000-02-25 00:31:20 sandervl Exp $
+#
+# PD-Win32 API
+#
+#       Glide makefile
+#
+
+PDWIN32_INCLUDE = ..\..\..\..\..\include
+PDWIN32_LIB = ..\..\..\..\..\lib
+PDWIN32_BIN = ..\..\..\..\..\bin
+PDWIN32_TOOLS = ..\..\..\..\..\tools\bin
+
+TARGET=glide
+
+!include $(PDWIN32_INCLUDE)/pdwin32.mk
+!include ..\3dfx.mak
+
+CINCLUDE=-I..\incsrc;..\..\swlibs\fxmisc;..\init\initvg;..\init;..\texus;..\..\swlibs\pcilib;$(PDWIN32_INCLUDE)
+
+CFLAGS = $(CFLAGS) $(CINCLUDE)
+CXXFLAGS = $(CXXFLAGS) $(CINCLUDE)
+
+OBJS =	CPUDTECT.OBJ    DDGUMP.OBJ      DIGLIDE.OBJ     DIGUTEX.OBJ     DISST.OBJ \
+	DITEX.OBJ       G3DF.OBJ        GAA.OBJ         GBANNER.OBJ \
+	GDRAW.OBJ       GERROR.OBJ      GGLIDE.OBJ      GLFB.OBJ        GMOVIE.OBJ \
+	GPCI.OBJ        GSPLASH.OBJ     GSST.OBJ        GTEX.OBJ        GTEXDL.OBJ \
+	GU.OBJ          GUCLIP.OBJ      GUMP.OBJ        GUTEX.OBJ       GXDRAW.OBJ \
+	P6FENCE.OBJ     SST96.OBJ
+
+
+all: $(TARGET).lib
+
+$(TARGET).lib: $(OBJS)
+	$(RM) $(TARGET).lib
+	$(ILIB) $(ILIBFLAGS) $(TARGET).lib $(OBJS) ,,
+
+dep:
+    $(DEPEND) -I$(PDWIN32_INCLUDE);$(PDWIN32_INCLUDE)\win $(CINCLUDE) \
+        *.c *.cpp *.h *.asm *.inc $(PDWIN32_INCLUDE)\*.h \
+        ..\incsrc\*.h ..\..\swlibs\fxmisc\*.h ..\init\initvg\*.h ..\init\*.h ..\texus\*.h ..\..\swlibs\pcilib\*.h 
+
+!ifndef NODEP
+!include .depend
+!endif
+
+clean:
+    $(RM) *.obj *.pch
+    $(RM) *.lib
+
Index: trunk/src/opengl/glide/sst1/glide/old/cpudtect.asm
===================================================================
--- trunk/src/opengl/glide/sst1/glide/old/cpudtect.asm	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/old/cpudtect.asm	(revision 2885)
@@ -0,0 +1,163 @@
+;;
+;; THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+;; PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+;; TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+;; INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+;; DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+;; THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+;; EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+;; FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+;; 
+;; USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+;; RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+;; TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+;; AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+;; SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+;; THE UNITED STATES.  
+;; 
+;; COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+;;
+;; $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/old/cpudtect.asm,v 1.1 2000-02-25 00:31:23 sandervl Exp $
+;; $Log: cpudtect.asm,v $
+;; Revision 1.1  2000-02-25 00:31:23  sandervl
+;; Created new Voodoo 1 Glide dir
+;;
+; 
+; 2     3/04/97 9:10p Dow
+; Neutered mutiplatform multiheaded monster.
+;;
+;;
+
+TITLE  cpudtect.asm
+
+.586P
+.model FLAT,C                   ; Flat memory, mangle publics with leading '_'
+
+;;      Data for data segment goes here
+;_DATA   SEGMENT DWORD USE32 PUBLIC 'DATA'; 
+;_DATA   ENDS
+    
+;;; Some useful constants
+; CPU Type
+CPUTypeUnknown  = 0ffffffffh
+CPUTypePrePent  = 4h
+CPUTypeP5       = 5h    
+CPUTypeP6       = 6h    
+        
+;;; References to external data:
+    
+_TEXT   SEGMENT
+;;
+;;  _cpu_detect_asm - detect the type of CPU 
+;; 
+;;  USAGE:
+;;
+;;  int __cdecl _cpu_detect_asm(void);
+;;
+;;  returns 4 for non-pen
+
+PUBLIC  _cpu_detect_asm
+_cpu_detect_asm PROC NEAR
+P6Stuff:
+    .586
+    pushad                              ; save all regs.
+
+    ; First, determine whether CPUID instruction is available.
+    ; If it's not, then it's a 386 or 486.
+    pushfd                              ; push original EFLAGS.
+    pop eax                             ; pop into eax
+    mov ecx, eax                        ; save original EFLAGS in ecx
+    xor eax, 0200000h                   ; flip ID bit in EFLAGS
+    push    eax                         ; put it back on stack
+    popfd                               ; pop into EFLAGS
+    pushfd                              ; get EFLAGS back
+    pop eax                             ; into eax
+    xor eax, ecx                        ; check to see if we could toggle ID
+    jz  NotPentium                      ; Sorry, not P5 or P6.
+    
+    ;
+    ; Now determine whether it's an intel P6 CPU.
+    ;
+    ;;  Is it an Intel CPU?
+    xor eax, eax                        ; eax = 0.
+    cpuid                               ; get cpuid
+    xor ebx, 0756e6547h                 ; "Genu"
+    jnz NotIntel
+    xor edx, 049656e69h                 ; "ineI"
+    jnz NotIntel
+    xor ecx, 06c65746eh                 ; "ntel"
+    jnz NotIntel                        ;
+    ;;  Verifying architecture family
+    mov eax, 1
+    cpuid                               ; get family/model/stepping
+    shr eax, 8                          ; rid of model & stepping number
+    and eax, 0fh                        ; use only family
+    cmp eax, 6
+    jl     IsP5                         ; It's a P5
+    ;; Else it's a P6
+    ;
+    ; Intel P6 processor. 
+    ; Make sure it supports Memory Type Range Request registers
+    ;
+IsP6:   
+    popad
+    mov eax, 6                          ; 
+    ret                                 ; return 
+
+IsP5:   
+    popad
+    mov eax, 5                          ; 
+    ret
+
+NotPentium:
+    popad
+    mov eax, 4
+    ret
+
+NotIntel:
+    popad
+    mov eax, 0ffffffffh
+    ret
+        
+_cpu_detect_asm ENDP
+
+
+;------------------------------------------------------------------------------   
+; this routine sets the precision to single
+; which effects all adds, mults, and divs
+    align 4                 ; 
+    PUBLIC  single_precision_asm
+single_precision_asm PROC NEAR
+.586
+    push  eax       ; make room
+    fnclex          ; clear pending exceptions    
+    fstcw WORD PTR [esp]
+    mov   eax, DWORD PTR [esp]
+    and   eax, 0000fcffh  ; clear bits 9:8
+    mov   DWORD PTR [esp], eax
+    fldcw WORD PTR [esp]
+    pop   eax
+    ret   0
+single_precision_asm ENDP
+
+;------------------------------------------------------------------------------   
+; this routine sets the precision to double
+; which effects all adds, mults, and divs
+    align 4                 ; 
+    PUBLIC  double_precision_asm
+double_precision_asm PROC NEAR
+.586
+    push  eax       ; make room
+    fnclex          ; clear pending exceptions    
+    fstcw WORD PTR [esp]
+    mov   eax, DWORD PTR [esp]
+    and   eax, 0000fcffh  ; clear bits 9:8
+    or    eax, 000002ffh  ; set 9:8 to 10
+    mov   DWORD PTR [esp], eax
+    fldcw WORD PTR [esp]
+    pop   eax
+    ret   0
+double_precision_asm ENDP
+    
+_TEXT ENDS
+END
Index: trunk/src/opengl/glide/sst1/glide/old/cpudtect.s
===================================================================
--- trunk/src/opengl/glide/sst1/glide/old/cpudtect.s	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/old/cpudtect.s	(revision 2885)
@@ -0,0 +1,127 @@
+#
+# THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+# PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+# TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+# INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+# DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+# THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+# EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+# FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+# 
+# USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+# RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+# TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+# AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+# SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+# THE UNITED STATES.  
+# 
+# COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+#
+# $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/old/cpudtect.s,v 1.1 2000-02-25 00:31:23 sandervl Exp $
+# $Log: cpudtect.s,v $
+# Revision 1.1  2000-02-25 00:31:23  sandervl
+# Created new Voodoo 1 Glide dir
+#
+# 
+# 2     3/04/97 9:10p Dow
+# Neutered mutiplatform multiheaded monster.
+#
+#
+
+.file  "cpudtect.s"
+
+# 586P
+# model FLAT,C
+
+#      Data for data segment goes here
+# DATA   SEGMENT DWORD USE32 PUBLIC DATA; 
+# DATA   ENDS
+    
+# Some useful constants
+# CPU Type
+CPUTypeUnknown  .ASSIGNA 0xffffffff
+CPUTypePrePent  .ASSIGNA 4
+CPUTypeP5       .ASSIGNA 5
+CPUTypeP6       .ASSIGNA 6
+        
+# References to external data:
+    
+#_TEXT   SEGMENT
+#
+#  _cpu_detect_asm - detect the type of CPU 
+# 
+#  USAGE:
+#
+#  int __cdecl _cpu_detect_asm(void);
+#
+#  returns 4 for non-pen
+
+.text
+.align 4
+.globl _cpu_detect_asm
+_cpu_detect_asm:		
+P6Stuff:
+    pusha                              # save all regs.
+
+    # First, determine whether CPUID instruction is available.
+    # If it's not, then it's a 386 or 486.
+    pushf                               # push original EFLAGS.
+    pop %eax                            # pop into eax
+    mov %eax, %ecx                      # save original EFLAGS in ecx
+    xor $0x200000, %eax                 # flip ID bit in EFLAGS
+    push %eax                           # put it back on stack
+    popf                                # pop into EFLAGS
+    pushf                               # get EFLAGS back
+    pop %eax                            # into eax
+    xor %ecx, %eax                      # check to see if we could toggle ID
+    jz  NotPentium                      # Sorry, not P5 or P6.
+    
+    #
+    # Now determine whether it's an intel P6 CPU.
+    #
+    ##  Is it an Intel CPU?
+    xor %eax, %eax                      # eax = 0.
+    cpuid                               # get cpuid
+    xor $0x756e6547, %ebx               # "Genu"
+    jnz NotIntel
+    xor $0x49656e69, %edx               # "ineI"
+    jnz NotIntel
+    xor $0x6c65746e, %ecx               # "ntel"
+    jnz NotIntel                        #
+    ##  Verifying architecture family
+    mov $1, %eax
+    cpuid                               # get family/model/stepping
+    shr $8, %eax                        # rid of model & stepping number
+    and $0xf, %eax                      # use only family
+    cmp $6, %eax
+    jl     IsP5                         # It's a P5
+    ## Else it's a P6
+    #
+    # Intel P6 processor. 
+    # Make sure it supports Memory Type Range Request registers
+    #
+IsP6:   
+    popa
+    mov $6, %eax                        # 
+    ret                                 # return 
+
+IsP5:   
+    popa
+    mov $5, %eax                        # 
+    ret
+
+NotPentium:
+    popa
+    mov $4, %eax
+    ret
+
+NotIntel:
+    popa
+    mov $0xffffffff, %eax
+    ret
+
+.L_end__cpu_detect_asm:
+.size _cpu_detect_asm,.L_end__cpu_detect_asm-_cpu_detect_asm	
+.END
+
+
Index: trunk/src/opengl/glide/sst1/glide/old/xdraw.asm
===================================================================
--- trunk/src/opengl/glide/sst1/glide/old/xdraw.asm	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/old/xdraw.asm	(revision 2885)
@@ -0,0 +1,659 @@
+;; THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+;; PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+;; TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+;; INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+;; DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+;; THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+;; EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+;; FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+;; 
+;; USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+;; RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+;; TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+;; AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+;; SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+;; THE UNITED STATES.  
+;; 
+;; COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+;;
+;; $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/old/xdraw.asm,v 1.1 2000-02-25 00:31:23 sandervl Exp $
+;; $Log: xdraw.asm,v $
+;; Revision 1.1  2000-02-25 00:31:23  sandervl
+;; Created new Voodoo 1 Glide dir
+;;
+; 
+; 15    3/04/97 9:10p Dow
+; Neutered mutiplatform multiheaded monster.
+; 
+; 14    2/26/97 11:58a Jdt
+; Fixed stack bug
+; 
+; 13    2/19/97 4:42p Dow
+; Fixed debug build for Watcom
+; 
+; 12    1/18/97 11:50p Dow
+; Added support for GMT's register debugging
+; 
+; 11    12/23/96 1:37p Dow
+; chagnes for multiplatform glide
+; 
+; 10    11/15/96 5:11p Jdt
+; SST-96 exclusion
+;;
+;;
+
+TITLE   xdraw.asm
+OPTION OLDSTRUCTS       
+.586P
+
+.model FLAT,C                   ; Flat memory, mangle publics with leading '_'
+        
+EXTRN   _GlideRoot:DWORD
+EXTRN   _grSpinFifo:NEAR
+        
+; some useful floating load and store macros <ala gmt>
+flds    TEXTEQU <fld  DWORD PTR>
+fsubs   TEXTEQU <fsub DWORD PTR>
+fmuls   TEXTEQU <fmul DWORD PTR>
+
+_DATA   SEGMENT
+    One         DD  03f800000r
+    Area        DD  0
+    dxAB        DD  0
+    dxBC        DD  0
+    dyAB        DD  0
+    dyBC        DD  0
+    culltest    DD  0
+    P6FenceVar  DD  0  
+_DATA   ENDS
+
+; Ugly, but seems to workaround the problem with locally defined
+; data segment globals not getting relocated properly when using
+; djgpp.
+
+zArea   TEXTEQU <One+04h>
+zdxAB   TEXTEQU <One+08h>
+zdxBC   TEXTEQU <One+0ch>
+zdyAB   TEXTEQU <One+10h>
+zdyBC   TEXTEQU <One+14h>
+zculltest TEXTEQU <One+18h>
+
+;;; Some useful SST-1 offsets
+INCLUDE fxgasm.h
+
+;; enables/disables trisProcessed and trisDrawn counters
+STATS = 1
+
+;--------------------------------------------------------------------------        
+;;; Macro for P6 Fencing operation
+;;; Note that this destroys eax, but if you do 2 fences eax will be restored
+IFDEF GLIDE_DEBUG
+EXTRN   _grFence:NEAR
+
+P6Fence     MACRO
+    pushd   eax
+    push    ecx
+    push    edx
+    call    _grFence
+    pop     edx
+    pop     ecx
+    pop     eax
+    xchg    eax, P6FenceVar
+ENDM            
+ELSE
+P6Fence     MACRO
+    xchg    eax, P6FenceVar
+ENDM            
+ENDIF
+
+IFDEF GLIDE_HARDWARE
+IFDEF GLIDE_DEBUG
+
+EXTRN   _GR_SET:NEAR
+EXTRN   _GR_SETF:NEAR
+
+ENDIF   
+
+GR_SET      MACRO hw,offset,value
+IFDEF GLIDE_DEBUG
+    push    eax
+    push    ecx
+    push    edx
+
+    push    value
+    lea     eax,[hw + offset]
+    push    eax
+    call    _GR_SET
+    add     esp,8
+
+    pop     edx
+    pop     ecx
+    pop     eax
+ENDIF   
+    mov     DWORD PTR [hw + offset], value
+ENDM
+
+GR_SETF_P   MACRO hw,foffset
+IFDEF GLIDE_DEBUG
+    push    eax
+    push    ecx
+    push    edx
+
+    fst    DWORD PTR [esp-4]
+    sub     esp,4
+    lea     eax,[hw + foffset]
+    push    eax
+    call    _GR_SETF
+    add     esp,8
+
+    pop     edx
+    pop     ecx
+    pop     eax
+ENDIF                   
+    fstp    DWORD PTR [hw  + foffset]
+ENDM
+
+ENDIF
+
+;--------------------------------------------------------------------------        
+; Arguments (STKOFF = 16 from 4 pushes)
+STKOFF  = 16
+_va$    =  4 + STKOFF
+_vb$    =  8 + STKOFF
+_vc$    = 12 + STKOFF
+
+X       = 0
+Y       = 4
+
+fa      TEXTEQU     <eax>       ; vtx a from caller
+fb      TEXTEQU     <ebx>       ; vtx b from caller
+fc      TEXTEQU     <ecx>       ; vtx c from caller
+                                ; edx is used as index, loading from *src
+gc      TEXTEQU     <esi>       ; points to graphics context
+dlp     TEXTEQU     <esi>       ; points to dataList structure
+hw      TEXTEQU     <edi>       ; points to the hardware
+
+tmpx    TEXTEQU     <edx>       ; temp X storage
+i       TEXTEQU     <edx>       ; i = dlp->i
+tmpy    TEXTEQU     <ebp>       ; temp Y storage
+
+_TEXT       SEGMENT
+
+;--------------------------------------------------------------------------        
+            align 4
+            PUBLIC  grDrawTriangle_asm
+grDrawTriangle_asm  PROC    NEAR
+            .code
+
+grDrawTriangle_asm ENDP
+
+; FALL THRU to _trisetup
+
+;--------------------------------------------------------------------------        
+;;
+;;  _trisetup_asm - do triangle setup & send down draw command
+;;
+;;  USAGE:
+;;
+;;  
+            align 4
+            PUBLIC  _trisetup_asm@12
+_trisetup_asm@12  PROC    NEAR
+            .code
+; 28
+    ; save ebx, esi, edi, ebp
+    push    ebx
+     push    esi
+
+    push    edi
+     push    ebp
+
+;vertex sorting is done as follows:
+;   1. First, load the y values of vtx a, b, c into integer registers 
+;
+;       This is done in the segment vertex_load below.
+;
+;       Note that this trashes the pointers, we will reload them later
+;
+;       If any of the y values is negative, convert to a pseudo-2's complement
+;       form by xor'ing with 7fffffff. This lets us use 2's complement integer
+;       comparisons for floating point comparisons.
+;
+;   2. Compare a.y, b.y, c.y, and setup pointers fa, fb, fc so that
+;       a.y <= b.y <= c.y.
+;
+;       Note that fa, fb, fc registers point once more to vertex structs,
+;       though not necessarily in the order that the application passes it to
+;       this routine.
+;
+;       This is done in the segment vertex_y_sort below, with many many 
+;       compare/branches.
+;
+;       All the compare/branches converge to sst_load_xy_regs.
+;
+;   3. Load the (x,y) values into the floating point SST registers for Fa, Fb,
+;       and Fc. Done in the segment sst_load_xy_regs.
+;
+;   4. Restore fa, fb, fc to the user's order. Also save the vertex
+;       with lowest y value on the stack, this will be used later for 
+;       loading parameter values into the SST regs.
+;
+;;;;;;;;;;;;;;
+
+
+;--------------------------------------------------------------------------        
+    mov     fa, [esp + _va$]    ; 1
+     mov     fb, [esp + _vb$]
+    mov     fc, [esp + _vc$]
+     mov     tmpy, [_GlideRoot + trisProcessed]    ; _GlideRoot.stats.trisProcessed++;
+; 36-3
+vertex_y_load:
+    mov     fa, [fa + Y]        ; 2
+     mov     fb, [fb + Y]
+    cmp     fa, 0               ; 3
+     jge     a_positive
+    xor     fa, 7fffffffh 
+            align 4
+a_positive:
+    cmp     fb, 0               ; 4
+     jge     b_positive
+    xor     fb, 7fffffffh 
+            align 4
+b_positive:
+    mov     fc, [fc + Y]        ; 5
+     mov     gc, [_GlideRoot + curGC]
+    cmp     fc, 0               ; 6
+     jge     c_positive
+    xor     fc, 7fffffffh
+c_positive:
+; 42-3
+; 24-30 with direct fall-thru
+; jmp ret_pop0f
+;--------------------------------------------------------------------------        
+vertex_y_sort:
+
+    cmp     fa, fb              ; if (ay < by) {
+     jge      AgtB
+    cmp     fb, fc              ; if (by > cy) {
+     jle     abc
+    cmp     fa, fc              ; if (ay < cy) {
+     jge     cab
+
+  acb:                          ; acb
+        mov     fa, [esp + _va$]
+         mov     tmpx, [gc + cull_mode] ; culltest = gc->state.cull_mode
+        mov     fb, [esp + _vc$]
+         mov     fc, [esp + _vb$]
+        xor     tmpx, 1                 ; culltest ^= 1
+         jmp      Area_Computation
+
+            align 4
+  cab:                          ; cab
+        mov fa, [esp + _vc$]            ; fa = &vc->x
+         mov tmpx, [gc + cull_mode]     ; culltest = gc->state.cull_mode
+        mov fb, [esp + _va$]            ; fb = &va->x
+         mov fc, [esp + _vb$]           ; fc = &vb->x
+                                                ; HOLE
+         jmp Area_Computation
+
+            align 4
+  abc:                          ; abc
+        mov fa, [esp + _va$]            ; fa = &va->x
+         mov fb, [esp + _vb$]           ; fb = &vb->x
+        mov fc, [esp + _vc$]            ; fc = &vc->x
+         mov tmpx, [gc + cull_mode]     ; culltest = gc->state.cull_mode
+                                                ; HOLE
+        jmp Area_Computation
+
+            align 4
+ AgtB:                          ; } else {
+        cmp     fb, fc          ;   if (by < cy) 
+         jge     cba
+        cmp     fa, fc          ;   if (ay < cy)
+         jge      bca
+  bac:                          ; bac
+        mov     fa, [esp + _vb$]
+         mov     tmpx, [gc + cull_mode] ; culltest = gc->state.cull_mode
+        mov     fb, [esp + _va$]
+         mov     fc, [esp + _vc$]
+        xor     tmpx, 1                 ; culltest ^= 1
+         jmp     Area_Computation
+
+            align 4
+  cba:                          ; cba
+        mov     fa, [esp + _vc$]
+         mov     tmpx, [gc + cull_mode] ; culltest = gc->state.cull_mode
+        mov     fb, [esp + _vb$]
+         mov     fc, [esp + _va$]
+        xor     tmpx, 1                 ; culltest ^= 1
+         jmp     Area_Computation
+
+            align 4
+  bca:                          ; bca
+        mov     fa, [esp + _vb$]
+         mov     fb, [esp + _vc$]
+        mov     fc, [esp + _va$]
+         mov     tmpx, [gc + cull_mode] ; culltest = gc->state.cull_mode
+;--------------------------------------------------------------------------        
+            align 4
+Area_Computation:
+; 47-3
+; jmp ret_pop0f
+    flds    [fa + X]            ;  xa
+    fsubs   [fb + X]            ;  dxAB
+    flds    [fb + X]            ;  |    xb
+    fsubs   [fc + X]            ;  |    dxBC
+    flds    [fb + Y]            ;  |    |    yb
+    fsubs   [fc + Y]            ;  |    |    dyBC
+    flds    [fa + Y]            ;  |    |    |    ya
+    fsubs   [fb + Y]            ;  |    |    |    dyAB
+    fld     st(3)               ;  |    |    |    |    dxAB
+    fmul    st, st(2)           ;  |    |    |    |    t0         t0=dxAB*dyBC
+    fld     st(3)               ;  |    |    |    |    |    dxBC
+    fmul    st, st(2)           ;  |    |    |    |    |    t1    t1=dxBC*dyAB
+    mov     hw, [gc + fifoFree] ; load gc->state.fifoFree
+IFDEF STATS
+     inc     tmpy               ; _GlideRoot.stats.trisProcessed++;
+    mov [_GlideRoot + trisProcessed], tmpy
+ENDIF
+     mov     tmpy, [_GlideRoot + curTriSize] ; load _GlideRoot.curTriSize
+; 69-12
+                                ;  dxAB dxBC dyBC dyAB t0   t1
+    fsubp   st(1),st            ;  |    |    |    |    area
+    sub    hw,tmpy              ; fifoFree = gc->fifoFree - gc->curTriSize;
+    jge    nostall              ; if (fifoFree < 0)
+    push   eax
+    push   ecx
+    push   edx
+    push   tmpy
+    call   _grSpinFifo          ; fifoFree = grSpinFifo(gc->curTriSize);
+    add    esp,4
+    mov    hw, eax              ; fifoFree = ...
+    pop    edx
+    pop    ecx
+    pop    eax
+nostall:
+; 52 with direct fall thru
+; jmp ret_pop5f      ;==============<<<<<<<==================
+    mov    [gc + fifoFree],hw   ;  gc->fifoFree = fifoFree;
+    fst     zArea               ;   2 clocks for fst
+    mov     hw, [gc + reg_ptr ] ; hw = gc->reg_ptr
+     mov     tmpy, zArea        ; j = *(long *)&area
+    add     hw, 00200000H       ; hw = SST_WRAP(hw,128)
+     and    tmpy, 7fffffffh     ; if ((j & 0x7FFFFFFF) == 0)
+    jz     zero_area
+; 76-13 zero area (gbench -tZ)
+; 57 with directy fall thru
+
+;--------------------------------------------------------------------------        
+    fdivr   One                 ; ooa = 1.0f / area; takes 20-38 clks
+Cull_by_area_sign:
+    sal     tmpx, 31                    ; culltest<<31
+     mov     tmpy, [gc + cull_mode]     ; load gc->state.cull_mode
+    test    tmpy, tmpy                  ; if (gc->state.cull_mode != GR_CULL_DISABLE)
+     je      nocull1
+                                        ; culling ENABLED
+    mov     tmpy, zArea                 ; reload area
+    xor     tmpy,tmpx                   ; if (j ^ (culltest<<31))
+    jge     backfaced
+
+            align 4
+nocull1:                                ; culling DISABLED
+    mov     tmpx, [fa + X]              ; load fa[X]
+     mov     tmpy, [fa + Y]             ; load fa[Y]
+    GR_SET  hw,FVAX,tmpx        ; GR_SETF( hw->FvA.x, fa[X] )
+     GR_SET  hw,FVAY,tmpy       ; GR_SETF( hw->FvA.y, fa[Y] )
+    mov     tmpx, [fb + X]              ; load fb[X]
+     mov     tmpy, [fb + Y]              ; load fb[Y]
+    GR_SET  hw,FVBX,tmpx        ; GR_SETF( hw->FvB.x, fb[X] )
+     GR_SET  hw,FVBY,tmpy       ; GR_SETF( hw->FvB.y, fb[Y] )
+    mov     tmpx, [fc + X]              ; load fc[X]
+     mov     tmpy, [fc + Y]              ; load fc[Y]
+    GR_SET  hw,FVCX,tmpx                ; GR_SETF( hw->FvC.x, fc[X] )
+     GR_SET  hw,FVCY,tmpy               ; GR_SETF( hw->FvC.y, fc[Y] )
+
+    mov     i, [gc+dataList]            ; i = gc->datalist[0]->i
+     add     dlp, dataList              ; dlp = gc->dataList
+; 96-13
+    test     i, i                       ; while (i) early out test
+     je      no_interpolation 
+; 99-13 flat shaded (gbench -t)
+; jmp ret_pop5f      ;==============<<<<<<<==================
+
+;  dxBC *= ooa;
+;  dyAB *= ooa;
+;  dxAB *= ooa;
+;  dyBC *= ooa;
+merge1:                         ; Stack looks like          
+                                ;   dxAB  dxBC  dyBC  dyAB  ooa
+    fmul    st(4), st           ;   DXAB  |     |     |     |
+    fmul    st(3), st           ;   |     DXBC  |     |     |
+    fmul    st(2), st           ;   |     |     DYBC  |     |
+    fmulp   st(1), st           ;   |     |     |     DYAB
+     fxch    st(3)              ;   DYAB  |     |     DXAB  
+; 105-12
+    fstp    zdxAB               ;   |     |     DYBC
+    fstp    zdyBC               ;   |     DXBC
+    fstp    zdxBC               ;   DYAB
+    fstp    zdyAB               ;
+; 112-3
+; jmp ret_pop0f
+
+; NOTE: we know i>0 since we checked for that up above
+;       so we fall right into the parameter gradient compute loop
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;
+;    dpdx = dpAB * dyBC - dpBC * dyAB
+;    dpdy = dpBC * dxAB - dpAB * dxBC
+;
+;       dpAB.dyBC = p0x
+;       dpBC.dyAB = p1x
+;       dpBC.dxAB = p0y
+;       dpAB.dxBC = p1y
+;;
+;;  This piece uses eax, ebx, ecx, edx, edi, esi, ebp, 
+;
+        align 4
+next_parm:
+    mov     hw, [dlp + dl_addr]         ; fp = dlp->addr
+     mov     tmpy, [fa + i]             ; tmpy = fa[i]
+IF 1
+    test    i,1                         ; if (i & 1) {
+     je      no_packer_fix
+    test    i,2                         ; if (i & 2)
+     je      no_p6_1
+    P6Fence                             ; if (i & 2) P6FENCE
+    
+  no_p6_1:
+    GR_SET  hw,0,0                      ; GR_SETF( *fp, 0.0f );
+     je      no_p6_2
+    P6Fence                             ; if (i & 2) P6FENCE
+  no_p6_2:
+    mov     i, [dlp + SIZEOF_dataList + dl_i] ; i = dlp[1]->i
+     add     dlp, SIZEOF_dataList       ; dlp++;
+    test    i,i                         ; while (i)
+     jne     next_parm
+    mov     tmpy, [dlp + SIZEOF_dataList + dl_i] ; tmpy = dlp[1]->i ; preload next i
+     mov    fa, [_GlideRoot + trisDrawn];  _GlideRoot.stats.trisDrawn++
+    jmp     dotri
+
+        align 4
+no_packer_fix:                          ;   dpAB dpBC 
+ENDIF
+    flds    [fa + i]                    ;   pa
+    fsubs   [fb + i]                    ;   dpAB
+    flds    [fb + i]                    ;   |    pb
+    fsubs   [fc + i]                    ;   dpAB dpBC 
+
+    fld     st(1)                       ;   |    |    dpAB   
+    fmuls   zdyBC                       ;   |    |    p0x
+    fld     st(1)                       ;   |    |    |    dpBC
+    fmuls   zdyAB                       ;   |    |    |    p1x
+     fxch    st(3)                      ;   p1x  |    |    dpAB
+    GR_SET  hw,0,tmpy                   ;   |    |    |    |
+    fmuls   zdxBC                       ;   |    |    |    p1y
+     fxch    st(2)                      ;   |    p1y  |    dpBC
+    fmuls   zdxAB                       ;   |    |    |    p0y
+     fxch    st(3)                      ;   p0y  |    |    p1x
+    fsubp   st(1),st                    ;   |    |    dpdx
+     fxch    st(2)                      ;   dpdx |    p0y
+    fsubrp  st(1),st                    ;   |    dpdy
+     fxch    st(1)                      ;   dpdy dpdx
+    mov     i, [dlp + SIZEOF_dataList + dl_i] ; i = dlp[1]->i
+     add     dlp, SIZEOF_dataList       ; dlp++;
+    GR_SETF_P hw,FDPDX_OFFSET           ;   |
+    GR_SETF_P hw,FDPDY_OFFSET           ;   empty
+    test    i,i                         ; while (i)
+     jne     next_parm                  ; 
+
+    mov    tmpy, [dlp + SIZEOF_dataList + dl_i] ; tmpy = dlp[1]->i - for the sake of a fall-thru
+     mov    fa, [_GlideRoot + trisDrawn];  _GlideRoot.stats.trisDrawn++
+        align 4
+;
+; fell through - this means we're done with differentials
+; note: i is preloaded with next token
+; write area, pop fp stack, pop stack, return
+dotri:
+    mov    hw, [dlp + SIZEOF_dataList + dl_addr] ; fp = dlp[1]->addr
+IFDEF STATS
+     inc    fa                          ;  _GlideRoot.stats.trisDrawn++
+    mov    [_GlideRoot + trisDrawn], fa
+ENDIF
+     mov    tmpx, zArea
+    
+    test    tmpy,2                      ; if (i & 2)
+     je      no_p6_3
+    P6Fence                             ; if (i & 2) P6FENCE
+    
+  no_p6_3:
+    GR_SET  hw,0,tmpx                   ; GR_SET( hw->FtriangleCMD, area );
+     je      no_p6_4
+    P6Fence                             ; if (i & 2) P6FENCE
+  no_p6_4:
+
+    pop     ebp
+     pop     edi
+    pop     esi
+     pop     ebx
+    mov     eax, 1h                     ; return 1 (triangle drawn)
+     ret    12       
+
+;-----------------------------------------------------------------------------
+;; We get here if there is no interpolation to be done. Just set area to 
+;; draw the triangle. Unload fp stack, stack, return.
+            align 4
+no_interpolation:
+        mov     tmpx, zArea             ; reload area
+         mov     tmpy, [dlp + SIZEOF_dataList + dl_i]        ; load up the CPU Type
+        and     tmpy, 2                 ; Check for P6
+         je      nofence1
+        P6Fence                         ; Fence off the triangleCmd
+         nop
+            align 4
+nofence1:
+        GR_SET  hw,FTRIANGLECMD,tmpx    ; hit the triangleCmd 
+         je      nofence2
+        P6Fence                         ; Fence off the triangleCmd
+         nop
+            align 4
+nofence2:
+        fstp    st(0)
+        fstp    st(0)
+        fstp    st(0)
+        fstp    st(0)
+        fstp    st(0)
+IFDEF STATS
+        mov    fa, [_GlideRoot + trisDrawn];  _GlideRoot.stats.trisDrawn++
+ENDIF
+        pop     ebp
+IFDEF STATS
+         inc    fa                          ;  _GlideRoot.stats.trisDrawn++
+        mov    [_GlideRoot + trisDrawn], fa
+ENDIF
+         pop     edi
+        pop     esi
+         pop     ebx
+        mov     eax, 1h                 ; return 1 (triangles drawn)
+         ret    12
+ 
+; These labels should only be jumped to when we are trying to rigorously
+; measure times.  Screwing up the floating point stack costs many clocks, 
+; so we want to jump to the place where only the correct number of FSTPs are
+; executed.
+
+            align 4
+backfaced:
+        fstp    st(0)
+        fstp    st(0)
+        fstp    st(0)
+        fstp    st(0)
+        fstp    st(0)
+        mov     eax, 0ffffffffh         ; return -1 (backface culled)
+         pop     ebp
+        pop     edi
+         pop     esi
+        pop     ebx
+         ret    12
+
+ret_pop6f:
+        fstp    st(0)
+
+            align 4
+zero_area:
+; If triangle area is zero, nothing to do...
+; but unload fp stack and then pop the stack, and return.
+
+ret_pop5f:                              ; dyBC dyAB    dxBC     dxAB   area
+        fstp    st(0)
+ret_pop4f:
+        fstp    st(0)
+ret_pop3f:
+        fstp    st(0)
+ret_pop2f:  
+        fstp    st(0)
+ret_pop1f:
+        fstp    st(0)
+ret_pop0f:
+        mov     eax, 0h                 ; return 0 (triangles drawn)
+         pop     ebp
+        pop     edi
+         pop     esi
+        pop     ebx
+         ret    12
+        
+_trisetup_asm@12 ENDP
+
+; [++++ from above]
+; This comment was moved here to make the code in the loop more readable 
+; STALL HERE due to PCI write buffer being full on last instruction:        
+; The write to the packerHackAddress takes 3 bus clocks, during which
+; we may not write to the PCI buffer without stalling.  This causes
+; the amount of clocks the workaround adds to the loop to vary in the
+; following way++:
+; 
+;    CPU          Bus/CPU Clock     Total Bus       Total Penalty
+;                     Ratio*      Clocks Since   (add to later clocks)
+;======================================================================  
+; P55c-200/P5-180:    6/1              1.3       (3 - 1.3) * 6 + 6 = 17 
+; P5-166/P5-150:      5/1              1.8       (3 - 1.8) * 5 + 6 = 12 
+; P5-120:             4/1              2.25      (3 - 2.25) * 4 + 6 = 9 
+; P5-100/P5-90:       3/1               3        (3 - 3) * 3 + 6 = 6
+;
+; * P5-200 haa a 33MHz bus, P5-166 has a 33MHz bus, 
+;   P5-150 has a 30MHz bus, P5-120 has a 30MHz bus,
+;   P5-100 has a 33MHz bus, P5-90 has a 30MHz bus
+;
+;++ These calculations also assume that we NEVER get to continue a burst 
+;   from having the next parameter be consecutive from the current one.
+;   If we did get that, then we have to add two more bus clocks to the
+;   penalty for the next write (labeled loop clock 10), so that looks like
+;      CPU                  Total Penalty
+;      ============================================        
+;      P55c-200/P5-180:(2 * 6) + 17 = 29 clocks!!!
+;      P5-166/P5-150:  (2 * 5) + 12 = 22 clocks!!
+;      P5-120:         (2 * 4) +  9 = 17 clocks!
+;      P5-100/P5-90    (2 * 3) +  6 = 12 clocks    
+;
+
+_TEXT ENDS
+END
Index: trunk/src/opengl/glide/sst1/glide/old/xdraw.s
===================================================================
--- trunk/src/opengl/glide/sst1/glide/old/xdraw.s	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/old/xdraw.s	(revision 2885)
@@ -0,0 +1,689 @@
+# THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+# PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+# TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+# INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+# DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+# THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+# EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+# FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+# 
+# USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+# RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+# TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+# AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+# SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+# THE UNITED STATES.  
+# 
+# COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+#
+# $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/old/xdraw.s,v 1.1 2000-02-25 00:31:24 sandervl Exp $
+# $Log: xdraw.s,v $
+# Revision 1.1  2000-02-25 00:31:24  sandervl
+# Created new Voodoo 1 Glide dir
+#
+# 
+# 15    3/04/97 9:10p Dow
+# Neutered mutiplatform multiheaded monster.
+# 
+# 14    2/26/97 11:58a Jdt
+# Fixed stack bug
+# 
+# 13    2/19/97 4:42p Dow
+# Fixed debug build for Watcom
+# 
+# 12    1/18/97 11:50p Dow
+# Added support for GMT's register debugging
+# 
+# 11    12/23/96 1:37p Dow
+# chagnes for multiplatform glide
+# 
+# 10    11/15/96 5:11p Jdt
+# SST-96 exclusion
+#
+#
+
+# This is a GASP input file
+	
+.file  "xdraw.s"
+# OPTION OLDSTRUCTS       
+# .586P
+
+# EXTRN   _GlideRoot:DWORD
+# EXTRN   _grSpinFifo:NEAR
+        
+# some useful floating load and store macros <ala gmt>
+# flds    TEXTEQU <fld  DWORD PTR>
+# fsubs   TEXTEQU <fsub DWORD PTR>
+# fmuls   TEXTEQU <fmul DWORD PTR>
+
+	.align 4
+\(.data)
+One		.DATA 0x03f800000
+Area		.DATA 0
+dxAB		.DATA 0
+dxBC		.DATA 0
+dyAB		.DATA 0
+dyBC		.DATA 0
+culltest	.DATA 0
+P6FenceVar	.DATA 0
+DBG		.DATA 0	
+
+zArea		.EQU One+04
+zdxAB		.EQU One+8
+zdxBC		.EQU One+12
+zdyAB		.EQU One+16
+zdyBC		.EQU One+20
+zculltest	.EQU One+24
+
+## Some useful SST-1 offsets
+.INCLUDE "fxgasm.h"
+
+# enables/disables trisProcessed and trisDrawn counters
+STATS .ASSIGNA 1
+
+#--------------------------------------------------------------------------
+## Macro for P6 Fencing operation
+## Note that this destroys eax, but if you do 2 fences eax will be
+## restored
+.AIF \&GLIDE_DEBUG EQ 1
+# EXTRN   _grFence:NEAR		
+
+.MACRO P6Fence
+   push    %eax
+   push    %ecx
+   push    %edx
+   call    _grFence
+   pop     %edx
+   pop     %ecx
+   pop     %eax
+   xchgl   %eax, P6FenceVar
+.ENDM
+.AELSE
+.MACRO P6Fence
+    xchg   %eax, P6FenceVar
+.ENDM            
+.AENDI # GLIDE_DEBUG
+
+.AIF \&GLIDE_HARDWARE EQ 1
+.AIF \&GLIDE_DEBUG EQ 1
+
+#EXTRN   _GR_SET:NEAR
+#EXTRN   _GR_SETF:NEAR
+
+.AENDI # GLIDE_DEBUG
+
+.MACRO GR_SET  hw offset value
+.AIF \&GLIDE_DEBUG EQ 1
+    push    %eax
+    push    %ecx
+    push    %edx
+
+    push    \value
+    lea     \offset (\hw),%eax
+    push    %eax
+    call    _GR_SET
+    add     $8, %esp
+
+    pop     %edx
+    pop     %ecx
+    pop     %eax
+.AENDI # GLIDE_DEBUG
+    movl    \value, \offset (\hw)
+.ENDM
+
+.MACRO GR_SETF_P  hw offset
+.AIF \&GLIDE_DEBUG EQ 1
+    push    %eax
+    push    %ecx
+    push    %edx
+
+    fstl    -4(%esp)
+    sub     $4, %esp
+    lea     \offset (\hw),%eax
+    push    %eax
+    call    _GR_SETF
+    add     $8, %esp
+
+    pop     %edx
+    pop     %ecx
+    pop     %eax
+.AENDI # GLIDE_DEBUG
+    fstps   \offset (\hw)
+.ENDM
+
+.AENDI # GLIDE_HARDWARE
+
+#--------------------------------------------------------------------------
+# Arguments (STKOFF = 16 from 4 pushes)
+.AIF \&GLIDE_DEBUG EQ 1
+STKOFF	.EQU  16
+.AELSE
+STKOFF	.EQU  16
+.AENDI
+_va$    .EQU  4 + STKOFF
+_vb$    .EQU  8 + STKOFF
+_vc$    .EQU  12 + STKOFF
+
+X       .EQU 0
+Y       .EQU 4
+
+fa      .REG     (%eax)      # vtx a from caller
+fb      .REG     (%ebx)      # vtx b from caller
+fc      .REG     (%ecx)      # vtx c from caller
+                             #      edx is used as index, loading from *src
+gc      .REG     (%esi)      # points to graphics context
+dlp     .REG     (%esi)      # points to dataList structure
+hw      .REG     (%edi)      # points to the hardware
+
+tmpx    .REG     (%edx)      # temp X storage
+i       .REG     (%edx)      # i = dlp->i
+tmpy    .REG     (%ebp)      # temp Y storage
+
+#--------------------------------------------------------------------------
+.text
+	.align 16
+	
+.AIF \&GLIDE_DEBUG EQ 0
+.globl grDrawTriangle
+	.type grDrawTriangle, @function
+grDrawTriangle:
+.AENDI
+.globl grDrawTriangle_asm
+	.type  grDrawTriangle_asm, @function
+grDrawTriangle_asm:
+
+# FALL THRU to _trisetup
+
+#--------------------------------------------------------------------------
+#
+#  _trisetup_asm - do triangle setup & send down draw command
+#
+#  USAGE:
+#
+#  
+.globl  _trisetup_asm
+	.type _trisetup_asm, @function
+_trisetup_asm:
+#            .code
+# 28
+    # save ebx, esi, edi, ebp
+    push    %ebx
+    push    %esi
+
+    push    %edi
+    push    %ebp
+
+#vertex sorting is done as follows:
+#   1. First, load the y values of vtx a, b, c into integer registers 
+#
+#       This is done in the segment vertex_load below.
+#
+#       Note that this trashes the pointers, we will reload them later
+#
+#       If any of the y values is negative, convert to a pseudo-2s complement
+#       form by xor'ing with 7fffffff. This lets us use 2's complement integer
+#       comparisons for floating point comparisons.
+#
+#   2. Compare a.y, b.y, c.y, and setup pointers fa, fb, fc so that
+#       a.y <= b.y <= c.y.
+#
+#       Note that fa, fb, fc registers point once more to vertex structs,
+#       though not necessarily in the order that the application passes it to
+#       this routine.
+#
+#       This is done in the segment vertex_y_sort below, with many many 
+#       compare/branches.
+#
+#       All the compare/branches converge to sst_load_xy_regs.
+#
+#   3. Load the (x,y) values into the floating point SST registers for Fa, Fb,
+#       and Fc. Done in the segment sst_load_xy_regs.
+#
+#   4. Restore fa, fb, fc to the user's order. Also save the vertex
+#       with lowest y value on the stack, this will be used later for 
+#       loading parameter values into the SST regs.
+#
+#######
+
+
+#--------------------------------------------------------------------------
+    mov     _va$(%esp), fa   # 1
+    mov     _vb$(%esp), fb
+    mov     _vc$(%esp), fc
+    movl    (_GlideRoot+trisProcessed), tmpy    # _GlideRoot.stats.trisProcessed++#
+# 36-3
+vertex_y_load:
+    mov     Y(fa), fa        # 2
+    mov     Y(fb), fb
+    cmp     $0, fa           # 3
+    jge     a_positive
+    xor     $0x7fffffff, fa
+.align 4
+a_positive:
+    cmp     $0, fb            # 4
+    jge     b_positive
+    xor     $0x7fffffff, fb 
+.align 4
+b_positive:
+    mov     Y(fc), fc        # 5
+    movl    (_GlideRoot+curGC), gc
+    cmp     $0, fc           # 6
+    jge     c_positive
+    xor     $0x7fffffff, fc
+c_positive:
+# 42-3
+# 24-30 with direct fall-thru
+# jmp ret_pop0f
+#--------------------------------------------------------------------------
+vertex_y_sort:
+
+    cmp     fb, fa              # if (ay < by) {
+    jge     AgtB
+    cmp     fc, fb              # if (by > cy) {
+    jle     abc
+    cmp     fc, fa              # if (ay < cy) {
+    jge     cab
+
+acb:                          # acb
+        mov     _va$(%esp), fa
+        mov     cull_mode(gc), tmpx # culltest = gc->state.cull_mode
+        mov     _vc$(%esp), fb
+        mov     _vb$(%esp), fc
+        xor     $1, tmpx                 # culltest ^= 1
+        jmp     Area_Computation
+
+.align 4
+cab:                          # cab
+        mov _vc$(%esp), fa            # fa = &vc->x
+        mov cull_mode(gc), tmpx       # culltest = gc->state.cull_mode
+        mov _va$(%esp), fb            # fb = &va->x
+        mov _vb$(%esp), fc            # fc = &vb->x
+                                      # HOLE
+        jmp Area_Computation
+
+.align 4
+abc:                          # abc
+        mov _va$(%esp), fa          # fa = &va->x
+        mov _vb$(%esp), fb          # fb = &vb->x
+        mov _vc$(%esp), fc          # fc = &vc->x
+        mov cull_mode(gc), tmpx     # culltest = gc->state.cull_mode
+                                    # HOLE
+        jmp Area_Computation
+
+.align 4
+AgtB:                          # } else {
+        cmp     fc, fb          #   if (by < cy) 
+        jge     cba
+        cmp     fc, fa          #   if (ay < cy)
+        jge     bca
+bac:                          # bac
+        mov     _vb$(%esp), fa
+        mov     cull_mode(gc), tmpx # culltest = gc->state.cull_mode
+        mov     _va$(%esp), fb
+        mov     _vc$(%esp), fc
+        xor     $1, tmpx                 # culltest ^= 1
+        jmp     Area_Computation
+
+.align 4
+cba:                          # cba
+        mov     _vc$(%esp), fa
+        mov     cull_mode(gc), tmpx # culltest = gc->state.cull_mode
+        mov     _vb$(%esp), fb
+        mov     _va$(%esp), fc
+        xor     $1, tmpx                 # culltest ^= 1
+        jmp     Area_Computation
+
+.align 4
+bca:                          # bca
+        mov     _vb$(%esp), fa
+        mov     _vc$(%esp), fb
+        mov     _va$(%esp), fc
+        mov     cull_mode(gc), tmpx # culltest = gc->state.cull_mode
+#--------------------------------------------------------------------------
+.align 4
+Area_Computation:
+# 47-3
+# jmp ret_pop0f
+    flds    X(fa)            #  xa
+    fsubs   X(fb)            #  dxAB
+    flds    X(fb)            #  |    xb
+    fsubs   X(fc)            #  |    dxBC
+    flds    Y(fb)            #  |    |    yb
+    fsubs   Y(fc)            #  |    |    dyBC
+    flds    Y(fa)            #  |    |    |    ya
+    fsubs   Y(fb)            #  |    |    |    dyAB
+    fld     %st(3)           #  |    |    |    |    dxAB
+    fmul    %st(2), %st      #  |    |    |    |    t0         t0=dxAB*dyBC
+    fld     %st(3)           #  |    |    |    |    |    dxBC
+    fmul    %st(2), %st      #  |    |    |    |    |    t1    t1=dxBC*dyAB
+    mov     fifoFree(gc), hw # load gc->state.fifoFree
+.AIF \&STATS EQ 1
+    inc     tmpy               # _GlideRoot.stats.trisProcessed++#
+    mov  tmpy, (_GlideRoot+trisProcessed)
+.AENDI
+    mov  (_GlideRoot+curTriSize), tmpy # load _GlideRoot.curTriSize
+# 69-12
+                                #  dxAB dxBC dyBC dyAB t0   t1
+    fsubrp  %st, %st(1)         #  |    |    |    |    area
+
+    sub    tmpy, hw             # fifoFree = gc->fifoFree - gc->curTriSize#
+    jge    nostall              # if (fifoFree < 0)
+    push   %eax
+    push   %ecx
+    push   %edx
+    push   tmpy
+    call   _grSpinFifo          # fifoFree = grSpinFifo(gc->curTriSize)#
+    add    $4, %esp
+    mov    %eax, hw              # fifoFree = ...
+    pop    %edx
+    pop    %ecx
+    pop    %eax
+nostall:
+# 52 with direct fall thru
+# jmp ret_pop5f      #==============<<<<<<<==================
+    mov    hw, fifoFree(gc)   #  gc->fifoFree = fifoFree#
+    fsts   zArea              #   2 clocks for fst
+    mov    reg_ptr(gc), hw    # hw = gc->reg_ptr
+    mov    zArea, tmpy        # j = *(long *)&area
+    add    $0x00200000, hw    # hw = SST_WRAP(hw,128)
+    and    $0x7fffffff, tmpy  # if ((j & 0x7FFFFFFF) == 0)
+    jz     zero_area
+# 76-13 zero area (gbench -tZ)
+# 57 with directy fall thru
+
+#--------------------------------------------------------------------------
+    fdivrs   One                 # ooa = 1.0f / area# takes 20-38 clks
+Cull_by_area_sign:
+    sal     $31, tmpx                    # culltest<<31
+    mov     cull_mode(gc), tmpy     # load gc->state.cull_mode
+    test    tmpy, tmpy                  # if (gc->state.cull_mode #= GR_CULL_DISABLE)
+    je      nocull1
+                                        # culling ENABLED
+    mov     zArea, tmpy                 # reload area
+    xor     tmpx, tmpy                   # if (j ^ (culltest<<31))
+    jge     backfaced
+
+.align 4
+nocull1:                             # culling DISABLED
+    mov     X(fa), tmpx              # load fa[X]
+    mov     Y(fa), tmpy              # load fa[Y]
+    GR_SET  hw,FVAX, tmpx
+				     # GR_SETF( hw->FvA.x, fa[X] )
+    GR_SET  hw,FVAY, tmpy
+				     # GR_SETF( hw->FvA.y, fa[Y] )
+    mov     X(fb), tmpx              # load fb[X]
+    mov     Y(fb), tmpy              # load fb[Y]
+    GR_SET  hw,FVBX,tmpx
+			             # GR_SETF( hw->FvB.x, fb[X] )
+    GR_SET  hw,FVBY,tmpy
+				     # GR_SETF( hw->FvB.y, fb[Y] )
+    mov     X(fc), tmpx              # load fc[X]
+    mov     Y(fc), tmpy              # load fc[Y]
+    GR_SET  hw,FVCX,tmpx
+			             # GR_SETF( hw->FvC.x, fc[X] )
+    GR_SET  hw,FVCY,tmpy
+			             # GR_SETF( hw->FvC.y, fc[Y] )
+
+    mov     dataList(gc), i          # i = gc->datalist[0]->i
+    add     $ dataList, dlp            # dlp = gc->dataList
+# 96-13
+    test    i, i                     # while (i) early out test
+    je      no_interpolation 
+# 99-13 flat shaded (gbench -t)
+# jmp ret_pop5f      #==============<<<<<<<==================
+
+#  dxBC *= ooa#
+#  dyAB *= ooa#
+#  dxAB *= ooa#
+#  dyBC *= ooa#
+merge1:                         # Stack looks like          
+                                #   dxAB  dxBC  dyBC  dyAB  ooa
+    fmul    %st, %st(4)         #   DXAB  |     |     |     |
+    fmul    %st, %st(3)         #   |     DXBC  |     |     |
+    fmul    %st, %st(2)         #   |     |     DYBC  |     |
+    fmulp   %st, %st(1)         #   |     |     |     DYAB
+    fxch    %st(3)              #   DYAB  |     |     DXAB  
+# 105-12
+    fstps    zdxAB              #   |     |     DYBC
+    fstps    zdyBC              #   |     DXBC
+    fstps    zdxBC              #   DYAB
+    fstps    zdyAB              #
+# 112-3
+# jmp ret_pop0f
+
+# NOTE: we know i>0 since we checked for that up above
+#       so we fall right into the parameter gradient compute loop
+###################################
+#
+#    dpdx = dpAB * dyBC - dpBC * dyAB
+#    dpdy = dpBC * dxAB - dpAB * dxBC
+#
+#       dpAB.dyBC = p0x
+#       dpBC.dyAB = p1x
+#       dpBC.dxAB = p0y
+#       dpAB.dxBC = p1y
+#
+#  This piece uses eax, ebx, ecx, edx, edi, esi, ebp, 
+#
+.align 4
+next_parm:
+    mov     dl_addr(dlp), hw         # fp = dlp->addr
+    mov     (fa, i), tmpy             # tmpy = fa[i]
+# IF 1
+    test    $1, i                      # if (i & 1) {
+    je      no_packer_fix
+    test    $2, i                      # if (i & 2)
+    je      no_p6_1
+    P6Fence
+				       # if (i & 2) P6FENCE
+    
+no_p6_1:
+    GR_SET  hw,0,$0
+		                       # GR_SETF( *fp, 0.0f )#
+    je      no_p6_2
+    P6Fence
+	                               # if (i & 2) P6FENCE
+no_p6_2:
+    add     $ SIZEOF_dataList, dlp          # dlp++#
+    mov     dl_i(dlp, SIZEOF_dataList), i   # i = dlp[1]->i
+    test    i,i                             # while (i)
+    jne     next_parm
+    mov     dl_i(dlp, SIZEOF_dataList), tmpy # tmpy = dlp[1]->i # preload next i
+    movl    (_GlideRoot+trisDrawn), fa       #  _GlideRoot.stats.trisDrawn++
+    jmp     dotri
+# ENDIF
+.align 4
+no_packer_fix:                            #   dpAB dpBC 
+    flds    (fa, i)                       #   pa
+    fsubs   (fb, i)                       #   dpAB
+    flds    (fb, i)                       #   |    pb
+    fsubs   (fc, i)	                  #   dpAB dpBC
+    fld     %st(1)                        #   |    |    dpAB   
+    fmuls   zdyBC                         #   |    |    p0x
+    fld     %st(1)                        #   |    |    |    dpBC
+    fmuls   zdyAB                         #   |    |    |    p1x
+    fxch    %st(3)                        #   p1x  |    |    dpAB
+    GR_SET  hw,0,tmpy
+			                  #   |    |    |    |
+    fmuls   zdxBC                         #   |    |    |    p1y
+    fxch    %st(2)                        #   |    p1y  |    dpBC
+    fmuls   zdxAB                         #   |    |    |    p0y
+    fxch    %st(3)                        #   p0y  |    |    p1x
+    fsubrp   %st, %st(1)                  #   |    |    dpdx
+    fxch    %st(2)                        #   dpdx |    p0y
+    fsubp  %st, %st(1)                    #   |    dpdy
+    fxch    %st(1)                        #   dpdy dpdx
+    add     $ SIZEOF_dataList, dlp        # dlp++
+    mov     dl_i(dlp, SIZEOF_dataList), i # i = dlp[1]->i
+    GR_SETF_P hw,FDPDX_OFFSET	
+				          #   |
+    GR_SETF_P hw,FDPDY_OFFSET   
+
+				          #   empty
+    test    i,i                           # while (i)
+    jne     next_parm                     # 
+
+    mov    dl_i(dlp, SIZEOF_dataList), tmpy # tmpy = dlp[1]->i - for the sake of a fall-thru
+    movl   (_GlideRoot+trisDrawn), fa    #  _GlideRoot.stats.trisDrawn++
+.align 4
+#
+# fell through - this means we're done with differentials
+# note: i is preloaded with next token
+# write area, pop fp stack, pop stack, return
+dotri:
+    add     $ SIZEOF_dataList, dlp        # dlp++
+    mov     dl_addr(dlp), hw         # fp = dlp->addr
+#    mov    dl_addr(dlp, SIZEOF_dataList), hw # fp = dlp[1]->addr
+.AIF \&STATS EQ 1
+    inc    fa                             #  _GlideRoot.stats.trisDrawn++
+    movl   fa, (_GlideRoot+trisDrawn)
+.AENDI
+    mov    zArea, tmpx
+
+    
+    test   $2, tmpy                      # if (i & 2)
+    je     no_p6_3
+    P6Fence
+		                          # if (i & 2) P6FENCE
+    
+no_p6_3:
+    GR_SET  hw,0,tmpx
+			                  # GR_SET( hw->FtriangleCMD, area )#
+    je      no_p6_4
+    P6Fence
+	                                  # if (i & 2) P6FENCE
+no_p6_4:
+
+    pop     %ebp
+    pop     %edi
+    pop     %esi
+    pop     %ebx
+    mov     $1, %eax                      # return 1 (triangle drawn)
+    ret
+
+#-----------------------------------------------------------------------------
+# We get here if there is no interpolation to be done. Just set area to 
+# draw the triangle. Unload fp stack, stack, return.
+.align 4
+no_interpolation:
+        mov     zArea, tmpx                       # reload area
+        mov     dl_i(dlp, SIZEOF_dataList), tmpy  # load up the CPU Type
+        and     $2, tmpy                          # Check for P6
+        je      nofence1
+        P6Fence
+		                         # Fence off the triangleCmd
+        nop
+.align 4
+nofence1:
+        GR_SET  hw,FTRIANGLECMD,tmpx
+					    # hit the triangleCmd 
+        je      nofence2
+        P6Fence
+		                         # Fence off the triangleCmd
+        nop
+.align 4
+nofence2:
+        fstp   %st(0)
+        fstp   %st(0)
+        fstp   %st(0)
+        fstp   %st(0)
+        fstp   %st(0)
+.AIF \&STATS EQ 1
+        movl   (_GlideRoot+trisDrawn), fa  #  _GlideRoot.stats.trisDrawn++
+.AENDI
+        pop    %ebp
+.AIF \&STATS EQ 1
+        inc    fa                          #  _GlideRoot.stats.trisDrawn++
+        movl    fa, (_GlideRoot+trisDrawn)
+.AENDI
+        pop    %edi
+        pop    %esi
+        pop    %ebx
+        mov    $1, %eax                 # return 1 (triangles drawn)
+        ret
+ 
+# These labels should only be jumped to when we are trying to rigorously
+# measure times.  Screwing up the floating point stack costs many clocks, 
+# so we want to jump to the place where only the correct number of FSTPs are
+# executed.
+
+.align 4
+backfaced:
+        fstp   %st(0)
+        fstp   %st(0)
+        fstp   %st(0)
+        fstp   %st(0)
+        fstp   %st(0)
+        mov    $0x0ffffffff, %eax         # return -1 (backface culled)
+        pop    %ebp
+        pop    %edi
+        pop    %esi
+        pop    %ebx
+        ret
+
+ret_pop6f:
+        fstp   %st(0)
+
+.align 4
+zero_area:
+# If triangle area is zero, nothing to do...
+# but unload fp stack and then pop the stack, and return.
+
+ret_pop5f:                              # dyBC dyAB    dxBC     dxAB   area
+        fstp   %st(0)
+ret_pop4f:
+        fstp   %st(0)
+ret_pop3f:
+        fstp   %st(0)
+ret_pop2f:  
+        fstp   %st(0)
+ret_pop1f:
+        fstp   %st(0)
+ret_pop0f:
+        mov    $0, %eax                 # return 0 (triangles drawn)
+        pop    %ebp
+        pop    %edi
+        pop    %esi
+        pop    %ebx
+        ret
+.L_end_tri_setup_asm:
+.AIF \&GLIDE_DEBUG EQ 0
+.size	grDrawTriangle,.L_end_tri_setup_asm-grDrawTriangle
+.AENDI	
+.size	grDrawTriangle_asm,.L_end_tri_setup_asm-grDrawTriangle_asm
+.size	_trisetup_asm,.L_end_tri_setup_asm-_trisetup_asm	        
+
+# [++++ from above]
+# This comment was moved here to make the code in the loop more readable 
+# STALL HERE due to PCI write buffer being full on last instruction:        
+# The write to the packerHackAddress takes 3 bus clocks, during which
+# we may not write to the PCI buffer without stalling.  This causes
+# the amount of clocks the workaround adds to the loop to vary in the
+# following way++:
+# 
+#    CPU          Bus/CPU Clock     Total Bus       Total Penalty
+#                     Ratio*      Clocks Since   (add to later clocks)
+#======================================================================  
+# P55c-200/P5-180:    6/1              1.3       (3 - 1.3) * 6 + 6 = 17 
+# P5-166/P5-150:      5/1              1.8       (3 - 1.8) * 5 + 6 = 12 
+# P5-120:             4/1              2.25      (3 - 2.25) * 4 + 6 = 9 
+# P5-100/P5-90:       3/1               3        (3 - 3) * 3 + 6 = 6
+#
+# * P5-200 haa a 33MHz bus, P5-166 has a 33MHz bus, 
+#   P5-150 has a 30MHz bus, P5-120 has a 30MHz bus,
+#   P5-100 has a 33MHz bus, P5-90 has a 30MHz bus
+#
+#++ These calculations also assume that we NEVER get to continue a burst 
+#   from having the next parameter be consecutive from the current one.
+#   If we did get that, then we have to add two more bus clocks to the
+#   penalty for the next write (labeled loop clock 10), so that looks like
+#      CPU                  Total Penalty
+#      ============================================        
+#      P55c-200/P5-180:(2 * 6) + 17 = 29 clocks##
+#      P5-166/P5-150:  (2 * 5) + 12 = 22 clocks#
+#      P5-120:         (2 * 4) +  9 = 17 clocks#
+#      P5-100/P5-90    (2 * 3) +  6 = 12 clocks    
+#
+
+#_TEXT ENDS
+.END
Index: trunk/src/opengl/glide/sst1/glide/old/xdraw96.asm
===================================================================
--- trunk/src/opengl/glide/sst1/glide/old/xdraw96.asm	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/old/xdraw96.asm	(revision 2885)
@@ -0,0 +1,689 @@
+;; THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+;; PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+;; TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+;; INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+;; DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+;; THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+;; EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+;; FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+;; 
+;; USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+;; RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+;; TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+;; AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+;; SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+;; THE UNITED STATES.  
+;; 
+;; COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+;;
+;; $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/old/xdraw96.asm,v 1.1 2000-02-25 00:31:24 sandervl Exp $
+;; $Revision: 1.1 $
+;; $Log: xdraw96.asm,v $
+;; Revision 1.1  2000-02-25 00:31:24  sandervl
+;; Created new Voodoo 1 Glide dir
+;;
+; 
+; 2     7/07/97 2:14p Jdt
+; assembly now on par with C code.
+; 
+; 1     7/07/97 8:37a Jdt
+; B4 Chip field fix.
+;;
+
+TITLE   xdraw.asm
+OPTION OLDSTRUCTS       
+.586P
+
+.model FLAT,C                   ; Flat memory, mangle publics with leading '_'
+        
+EXTRN   _GlideRoot:DWORD
+EXTRN   _grSpinFifo:NEAR
+EXTRN   _grSst96FifoMakeRoom:NEAR
+
+        
+; some useful floating load and store macros <ala gmt>
+flds    TEXTEQU <fld  DWORD PTR>
+fsubs   TEXTEQU <fsub DWORD PTR>
+fmuls   TEXTEQU <fmul DWORD PTR>
+
+_DATA   SEGMENT
+    One         DD  03f800000r
+    Area        DD  0
+    dxAB        DD  0
+    dxBC        DD  0
+    dyAB        DD  0
+    dyBC        DD  0
+    culltest    DD  0
+    P6FenceVar  DD  0  
+_DATA   ENDS
+
+; Ugly, but seems to workaround the problem with locally defined
+; data segment globals not getting relocated properly when using
+; djgpp.
+
+zArea   TEXTEQU <One+04h>
+zdxAB   TEXTEQU <One+08h>
+zdxBC   TEXTEQU <One+0ch>
+zdyAB   TEXTEQU <One+10h>
+zdyBC   TEXTEQU <One+14h>
+zculltest TEXTEQU <One+18h>
+
+;;; Some useful SST-1 offsets
+INCLUDE fxgasm.h
+
+;; enables/disables trisProcessed and trisDrawn counters
+STATS = 1
+
+;--------------------------------------------------------------------------        
+;;; Macro for P6 Fencing operation
+;;; Note that this destroys eax, but if you do 2 fences eax will be restored
+IFDEF GLIDE_DEBUG
+EXTRN   _GR_SET_GW_CMD:NEAR
+EXTRN   _GR_SET_GW_HEADER:NEAR
+EXTRN   _GR_SET_GW_ENTRY:NEAR
+ENDIF
+
+GR_SET_GW_CMD   MACRO addr, offset, data
+IFDEF GLIDE_DEBUG
+    push eax
+    push ecx
+    push edx
+
+    push data
+    lea  eax, [addr+offset]
+    push eax
+    call _GR_SET_GW_CMD
+    add  esp, 8
+    pop  edx
+    pop  ecx
+    pop  eax
+ELSE
+    mov [addr+offset], data
+ENDIF
+ENDM
+
+GR_SET_GW_HEADER  MACRO addr, offset, data
+IFDEF GLIDE_DEBUG
+    push eax
+    push ecx
+    push edx
+    push data
+    lea  eax, [addr+offset]
+    push eax
+    call _GR_SET_GW_HEADER
+    add  esp, 8
+    pop  edx
+    pop  ecx
+    pop  eax
+ELSE
+    mov [addr+offset], data
+ENDIF
+ENDM
+
+GR_SET_GW_ENTRY   MACRO addr, offset, data
+IFDEF GLIDE_DEBUG
+    push eax
+    push ecx
+    push edx
+    push data
+    lea  eax, [addr+offset]
+    push eax
+    call _GR_SET_GW_ENTRY
+    add  esp, 8
+    pop  edx
+    pop  ecx
+    pop  eax
+ELSE
+    mov [addr+offset], data
+ENDIF
+ENDM
+
+GR_FSET_GW_ENTRY  MACRO addr, offset
+IFDEF GLIDE_DEBUG
+    push eax
+    push ecx
+    push edx
+    sub  esp, 4
+    fstp DWORD PTR [esp]
+    lea  eax, [addr+offset]
+    push eax
+    call _GR_SET_GW_ENTRY
+    add  esp, 8
+    pop  edx
+    pop  ecx
+    pop  eax
+ELSE
+    fstp DWORD PTR [addr+offset]
+ENDIF
+ENDM
+
+;--------------------------------------------------------------------------        
+; Arguments (STKOFF = 16 from 4 pushes)
+STKOFF  = 16
+
+	
+	
+
+_va$    =  4 + STKOFF
+_vb$    =  8 + STKOFF
+_vc$    = 12 + STKOFF
+
+X       = 0
+Y       = 4
+
+fa      TEXTEQU     <eax>       ; vtx a from caller
+fb      TEXTEQU     <ebx>       ; vtx b from caller
+fc      TEXTEQU     <ecx>       ; vtx c from caller
+                                ; edx is used as index, loading from *src
+gc      TEXTEQU     <esi>       ; points to graphics context
+dlp     TEXTEQU     <esi>       ; points to dataList structure
+hw      TEXTEQU     <edi>       ; points to the hardware
+fifo    TEXTEQU     <edi>       ; points to next entry in fifo
+
+tmpx    TEXTEQU     <edx>       ; temp X storage
+i       TEXTEQU     <edx>       ; i = dlp->i
+tmpy    TEXTEQU     <ebp>       ; temp Y storage
+
+_TEXT       SEGMENT
+
+;--------------------------------------------------------------------------        
+            align 4
+            PUBLIC  grDrawTriangle_asm
+grDrawTriangle_asm  PROC    NEAR
+            .code
+
+grDrawTriangle_asm ENDP
+
+; FALL THRU to _trisetup
+
+;--------------------------------------------------------------------------        
+;;
+;;  _trisetup_asm - do triangle setup & send down draw command
+;;
+;;  USAGE:
+;;
+;;  
+            align 4
+            PUBLIC  _trisetup_asm@12
+_trisetup_asm@12  PROC    NEAR
+            .code
+; 28
+    ; save ebx, esi, edi, ebp
+    push    ebx
+     push    esi
+
+    push    edi
+     push    ebp
+
+;vertex sorting is done as follows:
+;   1. First, load the y values of vtx a, b, c into integer registers 
+;
+;       This is done in the segment vertex_load below.
+;
+;       Note that this trashes the pointers, we will reload them later
+;
+;       If any of the y values is negative, convert to a pseudo-2's complement
+;       form by xor'ing with 7fffffff. This lets us use 2's complement integer
+;       comparisons for floating point comparisons.
+;
+;   2. Compare a.y, b.y, c.y, and setup pointers fa, fb, fc so that
+;       a.y <= b.y <= c.y.
+;
+;       Note that fa, fb, fc registers point once more to vertex structs,
+;       though not necessarily in the order that the application passes it to
+;       this routine.
+;
+;       This is done in the segment vertex_y_sort below, with many many 
+;       compare/branches.
+;
+;       All the compare/branches converge to sst_load_xy_regs.
+;
+;   3. Load the (x,y) values into the floating point SST registers for Fa, Fb,
+;       and Fc. Done in the segment sst_load_xy_regs.
+;
+;   4. Restore fa, fb, fc to the user's order. Also save the vertex
+;       with lowest y value on the stack, this will be used later for 
+;       loading parameter values into the SST regs.
+;
+;;;;;;;;;;;;;;
+
+
+;--------------------------------------------------------------------------        
+
+
+    mov     fa, [esp + _va$]    ; 1
+     mov     fb, [esp + _vb$]
+    mov     fc, [esp + _vc$]
+     mov     tmpy, [_GlideRoot + trisProcessed]    ; _GlideRoot.stats.trisProcessed++;
+; 36-3
+vertex_y_load:
+    mov     fa, [fa + Y]        ; 2
+     mov     fb, [fb + Y]
+    cmp     fa, 0               ; 3
+     jge     a_positive
+    xor     fa, 7fffffffh 
+            align 4
+a_positive:
+    cmp     fb, 0               ; 4
+     jge     b_positive
+    xor     fb, 7fffffffh 
+            align 4
+b_positive:
+    mov     fc, [fc + Y]        ; 5
+     mov     gc, [_GlideRoot + curGC]
+    cmp     fc, 0               ; 6
+     jge     c_positive
+    xor     fc, 7fffffffh
+c_positive:
+; 42-3
+; 24-30 with direct fall-thru
+; jmp ret_pop0f
+;--------------------------------------------------------------------------        
+vertex_y_sort:
+
+    cmp     fa, fb              ; if (ay < by) {
+     jge      AgtB
+    cmp     fb, fc              ; if (by > cy) {
+     jle     abc
+    cmp     fa, fc              ; if (ay < cy) {
+     jge     cab
+
+  acb:                          ; acb
+        mov     fa, [esp + _va$]
+         mov     tmpx, [gc + cull_mode] ; culltest = gc->state.cull_mode
+        mov     fb, [esp + _vc$]
+         mov     fc, [esp + _vb$]
+        xor     tmpx, 1                 ; culltest ^= 1
+         jmp      Area_Computation
+
+            align 4
+  cab:                          ; cab
+        mov fa, [esp + _vc$]            ; fa = &vc->x
+         mov tmpx, [gc + cull_mode]     ; culltest = gc->state.cull_mode
+        mov fb, [esp + _va$]            ; fb = &va->x
+         mov fc, [esp + _vb$]           ; fc = &vb->x
+                                                ; HOLE
+         jmp Area_Computation
+
+            align 4
+  abc:                          ; abc
+        mov fa, [esp + _va$]            ; fa = &va->x
+         mov fb, [esp + _vb$]           ; fb = &vb->x
+        mov fc, [esp + _vc$]            ; fc = &vc->x
+         mov tmpx, [gc + cull_mode]     ; culltest = gc->state.cull_mode
+                                                ; HOLE
+        jmp Area_Computation
+
+            align 4
+ AgtB:                          ; } else {
+        cmp     fb, fc          ;   if (by < cy) 
+         jge     cba
+        cmp     fa, fc          ;   if (ay < cy)
+         jge      bca
+  bac:                          ; bac
+        mov     fa, [esp + _vb$]
+         mov     tmpx, [gc + cull_mode] ; culltest = gc->state.cull_mode
+        mov     fb, [esp + _va$]
+         mov     fc, [esp + _vc$]
+        xor     tmpx, 1                 ; culltest ^= 1
+         jmp     Area_Computation
+
+            align 4
+  cba:                          ; cba
+        mov     fa, [esp + _vc$]
+         mov     tmpx, [gc + cull_mode] ; culltest = gc->state.cull_mode
+        mov     fb, [esp + _vb$]
+         mov     fc, [esp + _va$]
+        xor     tmpx, 1                 ; culltest ^= 1
+         jmp     Area_Computation
+
+            align 4
+  bca:                          ; bca
+        mov     fa, [esp + _vb$]
+         mov     fb, [esp + _vc$]
+        mov     fc, [esp + _va$]
+         mov     tmpx, [gc + cull_mode] ; culltest = gc->state.cull_mode
+;--------------------------------------------------------------------------        
+            align 4
+Area_Computation:
+; 47-3
+; jmp ret_pop0f
+    flds    [fa + X]            ;  xa
+    fsubs   [fb + X]            ;  dxAB
+    flds    [fb + X]            ;  |    xb
+    fsubs   [fc + X]            ;  |    dxBC
+    flds    [fb + Y]            ;  |    |    yb
+    fsubs   [fc + Y]            ;  |    |    dyBC
+    flds    [fa + Y]            ;  |    |    |    ya
+    fsubs   [fb + Y]            ;  |    |    |    dyAB
+    fld     st(3)               ;  |    |    |    |    dxAB
+    fmul    st, st(2)           ;  |    |    |    |    t0         t0=dxAB*dyBC
+    fld     st(3)               ;  |    |    |    |    |    dxBC
+    fmul    st, st(2)           ;  |    |    |    |    |    t1    t1=dxBC*dyAB
+    fsubp   st(1),st            ;  |    |    |    |    area
+
+    fst     zArea               ;  |    |    |    |    area
+
+    ; Zero Area Triangle Check
+    mov     tmpy, zArea        ; j = *(long *)&area
+    and     tmpy, 7fffffffh    ; if ((j & 0x7FFFFFFF) == 0)
+    jz      zero_area
+
+    ; Cull Check
+    sal     tmpx, 31                    ; culltest<<31
+     mov     tmpy, [gc + cull_mode]     ; load gc->state.cull_mode
+    test    tmpy, tmpy                  ; if (gc->state.cull_mode != GR_CULL_DISABLE)
+     je      nocull1
+                                        ; culling ENABLED
+    mov     tmpy, zArea                 ; reload area
+    xor     tmpy,tmpx                   ; if (j ^ (culltest<<31))
+    jge     backfaced
+
+nocull1:                        ; culling disabled
+    ; OOA Calculation
+    fdivr   One                 ;  |    |    |    |    ooa
+
+    ; Fetch Fifo Ptr
+    mov     fifo, [gc + fifoPtr];
+
+    ; P6 Check
+    mov     tmpx, [_GlideRoot + CPUType]
+    cmp     tmpx, 6h
+    
+    je     fence
+
+        align 4
+fenceDone:  
+    ; Wrap Check
+    mov     tmpx, [_GlideRoot + curTriSize]
+    mov     tmpy, [gc + fifoSize]
+
+    sub     tmpy, tmpx
+    jl      wrap
+
+        align 4
+wrapDone:
+    mov     [gc + fifoSize], tmpy
+    ; Adjust Fifo Ptr
+    mov     tmpy, fifo
+    add     tmpy, tmpx
+    mov     [gc + fifoPtr], tmpy
+
+    ; Begin Tri Packet
+    mov     tmpx, [gc + gwCommand]
+    mov     tmpy, [gc + gwHeaders]
+
+    GR_SET_GW_CMD    fifo, 0, tmpx
+    GR_SET_GW_HEADER fifo, 4, tmpy
+
+    ; Download X, Y * 3
+    mov     tmpx, [fa + X]
+    mov     tmpy, [fa + Y]
+
+    GR_SET_GW_ENTRY fifo, 8,  tmpx
+    GR_SET_GW_ENTRY fifo, 12, tmpy
+
+    mov     tmpx, [fb + X]
+    mov     tmpy, [fb + Y]
+
+    GR_SET_GW_ENTRY fifo, 16, tmpx
+    GR_SET_GW_ENTRY fifo, 20, tmpy
+
+    mov     tmpx, [fc + X]
+    mov     tmpy, [fc + Y]
+
+    GR_SET_GW_ENTRY fifo, 24, tmpx
+    GR_SET_GW_ENTRY fifo, 28, tmpy
+
+    add     fifo, 32
+
+    mov     i, [gc+dataList]            ; i = gc->datalist[0]->i
+    add     dlp, dataList               ; dlp = gc->dataList
+
+    ; Early out for no interp
+    test    i, i
+    je      no_interpolation
+
+    ; Setup for Parameter Calculator
+                                ;   dxAB  dxBC  dyBC  dyAB  ooa
+    fmul    st(4), st           ;   DXAB  |     |     |     |
+    fmul    st(3), st           ;   |     DXBC  |     |     |
+    fmul    st(2), st           ;   |     |     DYBC  |     |
+    fmulp   st(1), st           ;   |     |     |     DYAB
+     fxch    st(3)              ;   DYAB  |     |     DXAB  
+    fstp    zdxAB               ;   |     |     DYBC
+    fstp    zdyBC               ;   |     DXBC
+    fstp    zdxBC               ;   DYAB
+    fstp    zdyAB               ;
+
+    ; Parameter Calculator
+        align 4
+next_parm:
+    test    i,1
+    jnz     secondary_packet
+
+    mov     tmpy, [fa + i]              ; tmpy = fa[i]
+    flds    [fa + i]                    ;   pa
+    fsubs   [fb + i]                    ;   dpAB
+    flds    [fb + i]                    ;   |    pb
+    fsubs   [fc + i]                    ;   dpAB dpBC 
+
+    fld     st(1)                       ;   |    |    dpAB   
+    fmuls   zdyBC                       ;   |    |    p0x
+    fld     st(1)                       ;   |    |    |    dpBC
+    fmuls   zdyAB                       ;   |    |    |    p1x
+     fxch    st(3)                      ;   p1x  |    |    dpAB
+
+    GR_SET_GW_ENTRY fifo, 0, tmpy       ;   |    |    |    |
+    fmuls   zdxBC                       ;   |    |    |    p1y
+     fxch    st(2)                      ;   |    p1y  |    dpBC
+    fmuls   zdxAB                       ;   |    |    |    p0y
+     fxch    st(3)                      ;   p0y  |    |    p1x
+    fsubp   st(1),st                    ;   |    |    dpdx
+     fxch    st(2)                      ;   dpdx |    p0y
+    fsubrp  st(1),st                    ;   |    dpdy
+     fxch    st(1)                      ;   dpdy dpdx
+    mov     i, [dlp + SIZEOF_dataList + dl_i] ; i = dlp[1]->i
+     add     dlp, SIZEOF_dataList       ; dlp++;
+ 
+    GR_FSET_GW_ENTRY fifo, 4            ;   |
+
+    GR_FSET_GW_ENTRY fifo, 8            ;   empty
+    add     fifo, 12
+    test    i,i                         ; while (i)
+     jne     next_parm                  ; 
+
+        align 4
+triangle_command:
+    ; Write Triangle Command
+    mov     tmpx, zArea
+    GR_SET_GW_ENTRY fifo, 0, tmpx
+    test    fifo, 7h
+    jnz     no_padding0
+    GR_SET_GW_ENTRY fifo, 4, tmpx
+no_padding0:
+    ; Cleanup
+    pop     ebp
+     pop     edi
+    pop     esi
+     pop     ebx
+    mov     eax, 1h                     ; return 1 (triangle drawn)
+     ret    12       
+    
+
+        align 4
+zero_area:
+backfaced:
+    fstp    st(0)   ; 4
+    fstp    st(0)   ; 3
+    fstp    st(0)   ; 2
+    fstp    st(0)   ; 1
+    fstp    st(0)   ; 0
+    pop     ebp
+     pop     edi
+    pop     esi
+     pop     ebx
+    xor     eax, eax                    ; return 0 (triangle drawn)
+     ret    12       
+
+        align 4
+wrap:
+    push    eax
+    push    ecx
+    push    edx
+    call    _grSst96FifoMakeRoom
+    pop     edx
+    pop     ecx
+    pop     eax
+    mov     fifo, [gc + fifoPtr]
+    mov     tmpy, [gc + fifoSize]
+    sub     tmpy, tmpx
+    jmp     wrapDone
+
+        align 4
+fence:
+    mov     tmpx, [gc + writesSinceFence];
+    mov     tmpy, [_GlideRoot + curTriSize]
+    
+    shr     tmpy, 2
+    sub     tmpx, tmpy
+    jl      dofence
+
+    mov     [gc + writesSinceFence], tmpx
+    jmp     fenceDone
+
+        align 4
+dofence:
+    push    eax
+    xchg    eax, P6FenceVar
+    pop     eax
+    jmp     fenceDone
+
+        align 4
+secondary_packet:
+    test    fifo, 7h
+    jz      no_padding1
+    GR_SET_GW_ENTRY  fifo, 0, tmpx 
+    add     fifo, 4
+        align 4
+no_padding1:
+    push    tmpx
+    push    gc
+    
+    mov     tmpx, [dlp + dl_addr]
+    mov     gc,   [_GlideRoot + curGC]
+
+    GR_SET_GW_CMD  fifo, 0, tmpx
+    mov     tmpy, [gc + gwHeaders + 4]  
+    
+    GR_SET_GW_HEADER fifo, 4, tmpy
+    pop     gc
+
+    pop     tmpx
+    add     fifo, 8
+
+    mov     i, [dlp + SIZEOF_dataList + dl_i]
+     add    dlp, SIZEOF_dataList
+        align 4
+next_parm_1:
+    mov     tmpy, [fa + i]              ; tmpy = fa[i]
+    flds    [fa + i]                    ;   pa
+    fsubs   [fb + i]                    ;   dpAB
+    flds    [fb + i]                    ;   |    pb
+    fsubs   [fc + i]                    ;   dpAB dpBC 
+
+    fld     st(1)                       ;   |    |    dpAB   
+    fmuls   zdyBC                       ;   |    |    p0x
+    fld     st(1)                       ;   |    |    |    dpBC
+    fmuls   zdyAB                       ;   |    |    |    p1x
+     fxch    st(3)                      ;   p1x  |    |    dpAB
+
+    GR_SET_GW_ENTRY fifo, 0, tmpy       ;   |    |    |    |
+    fmuls   zdxBC                       ;   |    |    |    p1y
+     fxch    st(2)                      ;   |    p1y  |    dpBC
+    fmuls   zdxAB                       ;   |    |    |    p0y
+     fxch    st(3)                      ;   p0y  |    |    p1x
+    fsubp   st(1),st                    ;   |    |    dpdx
+     fxch    st(2)                      ;   dpdx |    p0y
+    fsubrp  st(1),st                    ;   |    dpdy
+     fxch    st(1)                      ;   dpdy dpdx
+    mov     i, [dlp + SIZEOF_dataList + dl_i] ; i = dlp[1]->i
+     add     dlp, SIZEOF_dataList       ; dlp++;
+
+    GR_FSET_GW_ENTRY fifo, 4            ;   |
+
+    GR_FSET_GW_ENTRY fifo, 8            ;   empty
+    add     fifo, 12
+    test    i,i                         ; while (i)
+    jne     next_parm_1;
+
+    test    fifo, 7h
+    jz      triangle_command_packet
+    GR_SET_GW_ENTRY fifo, 0, tmpx
+    add     fifo, 4
+        align 4
+triangle_command_packet:
+    mov     gc, [_GlideRoot + curGC]
+    mov     tmpy, 40000000h
+
+    mov     tmpx, [gc + gwCommand]
+    mov     fa, zArea
+
+    GR_SET_GW_CMD    fifo, 0, tmpx
+    GR_SET_GW_HEADER fifo, 4, tmpy
+
+    GR_SET_GW_ENTRY  fifo, 8,  fa
+    GR_SET_GW_ENTRY  fifo, 12, fa
+
+    pop     ebp
+     pop     edi
+    pop     esi
+     pop     ebx
+    mov     eax, 1h                     ; return 1 (triangle drawn)
+     ret    12       
+
+        align 4
+no_interpolation:
+    fstp    st(0)     ; 4
+    fstp    st(0)     ; 3 
+    fstp    st(0)     ; 2 
+    fstp    st(0)     ; 1 
+    fstp    st(0)     ; 0
+    jmp     triangle_command
+
+_trisetup_asm@12 ENDP
+
+; [++++ from above]
+; This comment was moved here to make the code in the loop more readable 
+; STALL HERE due to PCI write buffer being full on last instruction:        
+; The write to the packerHackAddress takes 3 bus clocks, during which
+; we may not write to the PCI buffer without stalling.  This causes
+; the amount of clocks the workaround adds to the loop to vary in the
+; following way++:
+; 
+;    CPU          Bus/CPU Clock     Total Bus       Total Penalty
+;                     Ratio*      Clocks Since   (add to later clocks)
+;======================================================================  
+; P55c-200/P5-180:    6/1              1.3       (3 - 1.3) * 6 + 6 = 17 
+; P5-166/P5-150:      5/1              1.8       (3 - 1.8) * 5 + 6 = 12 
+; P5-120:             4/1              2.25      (3 - 2.25) * 4 + 6 = 9 
+; P5-100/P5-90:       3/1               3        (3 - 3) * 3 + 6 = 6
+;
+; * P5-200 haa a 33MHz bus, P5-166 has a 33MHz bus, 
+;   P5-150 has a 30MHz bus, P5-120 has a 30MHz bus,
+;   P5-100 has a 33MHz bus, P5-90 has a 30MHz bus
+;
+;++ These calculations also assume that we NEVER get to continue a burst 
+;   from having the next parameter be consecutive from the current one.
+;   If we did get that, then we have to add two more bus clocks to the
+;   penalty for the next write (labeled loop clock 10), so that looks like
+;      CPU                  Total Penalty
+;      ============================================        
+;      P55c-200/P5-180:(2 * 6) + 17 = 29 clocks!!!
+;      P5-166/P5-150:  (2 * 5) + 12 = 22 clocks!!
+;      P5-120:         (2 * 4) +  9 = 17 clocks!
+;      P5-100/P5-90    (2 * 3) +  6 = 12 clocks    
+;
+
+_TEXT ENDS
+END
Index: trunk/src/opengl/glide/sst1/glide/old/xdraw96.s
===================================================================
--- trunk/src/opengl/glide/sst1/glide/old/xdraw96.s	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/old/xdraw96.s	(revision 2885)
@@ -0,0 +1,710 @@
+## THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+## PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+## TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+## INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+## DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+## THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+## EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+## FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+## 
+## USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+## RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+## TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+## AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+## SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+## THE UNITED STATES.  
+## 
+## COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+##
+## $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/old/xdraw96.s,v 1.1 2000-02-25 00:31:24 sandervl Exp $
+## $Revision: 1.1 $
+## $Log: xdraw96.s,v $
+## Revision 1.1  2000-02-25 00:31:24  sandervl
+## Created new Voodoo 1 Glide dir
+##
+# 
+# 2     7/07/97 2:14p Jdt
+# assembly now on par with C code.
+# 
+# 1     7/07/97 8:37a Jdt
+# B4 Chip field fix.
+##
+
+.file   "xdraw96.s"
+#OPTION OLDSTRUCTS       
+#.586P
+
+
+	
+#EXTRN   _GlideRoot:DWORD
+#EXTRN   _grSpinFifo:NEAR
+#EXTRN   _grSst96FifoMakeRoom:NEAR
+
+        
+# some useful floating load and store macros <ala gmt>
+#flds    TEXTEQU <fld  DWORD PTR>
+#fsubs   TEXTEQU <fsub DWORD PTR>
+#fmuls   TEXTEQU <fmul DWORD PTR>
+
+.align 4
+.section	.data
+One         .DATA  0x03f800000
+Area        .DATA  0
+dxAB        .DATA  0
+dxBC        .DATA  0
+dyAB        .DATA  0
+dyBC        .DATA  0
+culltest    .DATA  0
+P6FenceVar  .DATA  0
+
+# Ugly, but seems to workaround the problem with locally defined
+# data segment globals not getting relocated properly when using
+# djgpp.
+
+zArea   .EQU One+4
+zdxAB   .EQU One+8
+zdxBC   .EQU One+12
+zdyAB   .EQU One+16
+zdyBC   .EQU One+20
+zculltest .EQU One+24
+
+### Some useful SST-1 offsets
+.INCLUDE "fxgasm.h"
+
+## enables/disables trisProcessed and trisDrawn counters
+STATS .ASSIGNA 1
+
+#--------------------------------------------------------------------------        
+### Macro for P6 Fencing operation
+### Note that this destroys eax, but if you do 2 fences eax will be restored
+#.AIF \&GLIDE_DEBUG EQ 1
+#EXTRN   _GR_SET_GW_CMD:NEAR
+#EXTRN   _GR_SET_GW_HEADER:NEAR
+#EXTRN   _GR_SET_GW_ENTRY:NEAR
+#.AENDI
+
+.MACRO GR_SET_GW_CMD   addr offset data
+.AIF \&GLIDE_DEBUG EQ 1
+    push %eax
+    push %ecx
+    push %edx
+
+    push \data
+    lea  \offset (\addr), %eax
+    push %eax
+    call _GR_SET_GW_CMD
+    add  $8, %esp
+    pop  %edx
+    pop  %ecx
+    pop  %eax
+.AELSE
+    mov \data, \offset (\addr)
+.AENDI
+.ENDM
+
+.MACRO GR_SET_GW_HEADER  addr offset data
+.AIF \&GLIDE_DEBUG EQ 1
+    push %eax
+    push %ecx
+    push %edx
+    push \data
+    lea  \offset (\addr), %eax
+    push %eax
+    call _GR_SET_GW_HEADER
+    add  $8, %esp
+    pop  %edx
+    pop  %ecx
+    pop  %eax
+.AELSE
+    mov \data, \offset (\addr)
+.AENDI
+.ENDM
+
+.MACRO GR_SET_GW_ENTRY   addr offset data
+.AIF \&GLIDE_DEBUG EQ 1
+    push %eax
+    push %ecx
+    push %edx
+    push \data
+    lea  \offset (\addr), %eax
+    push %eax
+    call _GR_SET_GW_ENTRY
+    add  $8, %esp
+    pop  %edx
+    pop  %ecx
+    pop  %eax
+.AELSE
+    mov \data, \offset (\addr)
+.AENDI
+.ENDM
+
+.MACRO GR_FSET_GW_ENTRY addr offset
+.AIF \&GLIDE_DEBUG EQ 1
+    push %eax
+    push %ecx
+    push %edx
+    sub  $4, %esp
+    fstps (%esp)
+    lea  \offset (\addr), %eax
+    push %eax
+    call _GR_SET_GW_ENTRY
+    add  $8, %esp
+    pop  %edx
+    pop  %ecx
+    pop  %eax
+.AELSE
+    fstps \offset (\addr)
+.AENDI
+.ENDM
+
+#--------------------------------------------------------------------------        
+# Arguments (STKOFF = 16 from 4 pushes)
+.AIF \&GLIDE_DEBUG EQ 1
+STKOFF	.EQU 16
+.AELSE	
+STKOFF  .EQU 16
+.AENDI	
+_va$    .EQU  4 + STKOFF
+_vb$    .EQU  8 + STKOFF
+_vc$    .EQU 12 + STKOFF
+
+X       .EQU 0
+Y       .EQU 4
+
+fa      .REG     (%eax)       # vtx a from caller
+fb      .REG     (%ebx)       # vtx b from caller
+fc      .REG     (%ecx)       # vtx c from caller
+                              # edx is used as index, loading from *src
+gc      .REG     (%esi)       # points to graphics context
+dlp     .REG     (%esi)       # points to dataList structure
+hw      .REG     (%edi)       # points to the hardware
+fifo    .REG     (%edi)       # points to next entry in fifo
+
+tmpx    .REG     (%edx)       # temp X storage
+i       .REG     (%edx)       # i = dlp->i
+tmpy    .REG     (%ebp)       # temp Y storage
+
+.text
+.align 4
+
+#--------------------------------------------------------------------------
+
+.AIF \&GLIDE_DEBUG EQ 0
+.globl  grDrawTriangle
+.type	grDrawTriangle, @function
+grDrawTriangle:
+.AENDI	
+.globl  grDrawTriangle_asm
+.type grDrawTriangle_asm, @function
+grDrawTriangle_asm:	
+# FALL THRU to _trisetup
+
+
+	
+	
+#--------------------------------------------------------------------------        
+##
+##  _trisetup_asm - do triangle setup & send down draw command
+##
+##  USAGE:
+##
+##  
+.globl  _trisetup_asm
+.type _trisetup_asm, @function
+_trisetup_asm:	
+# 28
+
+
+    # save ebx, esi, edi, ebp
+    push    %ebx
+    push    %esi
+
+    push    %edi
+    push    %ebp
+
+#vertex sorting is done as follows:
+#   1 First, load the y values of vtx a, b, c into integer registers 
+#
+#       This is done in the segment vertex_load below.
+#
+#       Note that this trashes the pointers, we will reload them later
+#
+#       If any of the y values is negative, convert to a pseudo-2s complement
+#       form by xor'ing with 7fffffff. This lets us use 2s complement integer
+#       comparisons for floating point comparisons.
+#
+#   2 Compare a.y, b.y, c.y, and setup pointers fa, fb, fc so that
+#       a.y <= b.y <= c.y.
+#
+#       Note that fa, fb, fc registers point once more to vertex structs,
+#       though not necessarily in the order that the application passes it to
+#       this routine.
+#
+#       This is done in the segment vertex_y_sort below, with many many 
+#       compare/branches.
+#
+#       All the compare/branches converge to sst_load_xy_regs.
+#
+#   3 Load the (x,y) values into the floating point SST registers for Fa, Fb,
+#       and Fc. Done in the segment sst_load_xy_regs.
+#
+#   4 Restore fa, fb, fc to the user's order. Also save the vertex
+#       with lowest y value on the stack, this will be used later for 
+#       loading parameter values into the SST regs.
+#
+##############
+
+
+#--------------------------------------------------------------------------        
+
+    mov     _va$(%esp), fa   # 1
+    mov     _vb$(%esp), fb
+    mov     _vc$(%esp), fc
+    movl    (_GlideRoot+trisProcessed), tmpy    # _GlideRoot.stats.trisProcessed++#
+# 36-3
+.Lvertex_y_load:
+    mov     Y(fa), fa        # 2
+    mov     Y(fb), fb
+    cmp     $0, fa           # 3
+    jge     .La_positive
+    xor     $0x7fffffff, fa
+.align 4
+.La_positive:
+    cmp     $0, fb            # 4
+    jge     .Lb_positive
+    xor     $0x7fffffff, fb 
+.align 4
+.Lb_positive:
+    mov     Y(fc), fc        # 5
+    movl    (_GlideRoot+curGC), gc
+    cmp     $0, fc           # 6
+    jge     .Lc_positive
+    xor     $0x7fffffff, fc
+.Lc_positive:
+# 42-3
+# 24-30 with direct fall-thru
+# jmp ret_pop0f
+#--------------------------------------------------------------------------        
+.Lvertex_y_sort:
+
+    cmp     fb, fa              # if (ay < by) {
+    jge     .LAgtB
+    cmp     fc, fb              # if (by > cy) {
+    jle     .Labc
+    cmp     fc, fa              # if (ay < cy) {
+    jge     .Lcab
+
+.Lacb:                          # acb
+        mov     _va$(%esp), fa
+        mov     cull_mode(gc), tmpx # culltest = gc->state.cull_mode
+        mov     _vc$(%esp), fb
+        mov     _vb$(%esp), fc
+        xor     $1, tmpx                 # culltest ^= 1
+        jmp     .LArea_Computation
+
+.align 4
+.Lcab:                          # cab
+        mov _vc$(%esp), fa            # fa = &vc->x
+        mov cull_mode(gc), tmpx       # culltest = gc->state.cull_mode
+        mov _va$(%esp), fb            # fb = &va->x
+        mov _vb$(%esp), fc            # fc = &vb->x
+                                      # HOLE
+        jmp .LArea_Computation
+
+.align 4
+.Labc:                          # abc
+        mov _va$(%esp), fa          # fa = &va->x
+        mov _vb$(%esp), fb          # fb = &vb->x
+        mov _vc$(%esp), fc          # fc = &vc->x
+        mov cull_mode(gc), tmpx     # culltest = gc->state.cull_mode
+                                    # HOLE
+        jmp .LArea_Computation
+
+.align 4
+.LAgtB:                          # } else {
+        cmp     fc, fb          #   if (by < cy) 
+        jge     .Lcba
+        cmp     fc, fa          #   if (ay < cy)
+        jge     .Lbca
+.Lbac:                          # bac
+        mov     _vb$(%esp), fa
+        mov     cull_mode(gc), tmpx # culltest = gc->state.cull_mode
+        mov     _va$(%esp), fb
+        mov     _vc$(%esp), fc
+        xor     $1, tmpx                 # culltest ^= 1
+        jmp     .LArea_Computation
+
+.align 4
+.Lcba:                          # cba
+        mov     _vc$(%esp), fa
+        mov     cull_mode(gc), tmpx # culltest = gc->state.cull_mode
+        mov     _vb$(%esp), fb
+        mov     _va$(%esp), fc
+        xor     $1, tmpx                 # culltest ^= 1
+        jmp     .LArea_Computation
+
+.align 4
+.Lbca:                          # bca
+        mov     _vb$(%esp), fa
+        mov     _vc$(%esp), fb
+        mov     _va$(%esp), fc
+        mov     cull_mode(gc), tmpx # culltest = gc->state.cull_mode
+#--------------------------------------------------------------------------        
+.align 4
+.LArea_Computation:
+# 47-3
+# jmp ret_pop0f
+    flds    X(fa)            #  xa
+    fsubs   X(fb)            #  dxAB
+    fsts    dxAB
+    flds    X(fb)            #  |    xb
+    fsubs   X(fc)            #  |    dxBC
+    fsts    dxBC
+    flds    Y(fb)            #  |    |    yb
+    fsubs   Y(fc)            #  |    |    dyBC
+    fsts    dyBC
+    flds    Y(fa)            #  |    |    |    ya
+    fsubs   Y(fb)            #  |    |    |    dyAB
+    fsts    dyAB
+    fld     %st(3)           #  |    |    |    |    dxAB
+    fsts    Area
+    fmul    %st(2), %st      #  |    |    |    |    t0         t0=dxAB*dyBC
+    fsts    Area
+    fld     %st(3)           #  |    |    |    |    |    dxBC
+    fsts    Area
+    fmul    %st(2), %st      #  |    |    |    |    |    t1    t1=dxBC*dyAB
+    fsts    Area
+    fsubrp  %st,%st(1)       #  |    |    |    |    area
+
+    fsts    zArea            #  |    |    |    |    area
+
+    # Zero Area Triangle Check
+    mov     zArea, tmpy        # j = *(long *)&area
+    and     $0x7fffffff,tmpy   # if ((j & 0x7FFFFFFF) == 0)
+    jz      .Lzero_area
+
+    # Cull Check
+    sal     $31, tmpx                   # culltest<<31
+    mov     cull_mode (gc), tmpy        # load gc->state.cull_mode
+    test    tmpy, tmpy                  # if (gc->state.cull_mode != GR_CULL_DISABLE)
+    je      .Lnocull1
+                                        # culling ENABLED
+    mov     zArea, tmpy                 # reload area
+    xor     tmpx, tmpy                  # if (j ^ (culltest<<31))
+    jge     .Lbackfaced
+
+.Lnocull1:                        # culling disabled
+    # OOA Calculation
+    fdivrs  One                 #  |    |    |    |    ooa
+
+    # Fetch Fifo Ptr
+    mov     fifoPtr(gc), fifo
+
+    # P6 Check
+    mov     (_GlideRoot+CPUType), tmpx
+    cmp     $6, tmpx
+    
+    je      .Lfence
+
+.align 4
+.LfenceDone:  
+    # Wrap Check
+    mov     (_GlideRoot+curTriSize), tmpx
+    mov     fifoSize(gc), tmpy
+
+    sub     tmpx, tmpy
+    jl      .Lwrap
+
+.align 4
+.LwrapDone:
+    mov     tmpy, fifoSize(gc)
+    # Adjust Fifo Ptr
+    mov     fifo, tmpy
+    add     tmpx, tmpy
+    mov     tmpy, fifoPtr(gc)
+
+    # Begin Tri Packet
+    mov     gwCommand(gc), tmpx
+    mov     gwHeaders(gc), tmpy
+
+    GR_SET_GW_CMD    fifo, 0, tmpx
+    GR_SET_GW_HEADER fifo, 4, tmpy
+
+    # Download X, Y * 3
+    mov     X(fa), tmpx
+    mov     Y(fa), tmpy
+
+    GR_SET_GW_ENTRY fifo, 8,  tmpx
+    GR_SET_GW_ENTRY fifo, 12, tmpy
+
+    mov     X(fb), tmpx
+    mov     Y(fb), tmpy
+
+    GR_SET_GW_ENTRY fifo, 16, tmpx
+    GR_SET_GW_ENTRY fifo, 20, tmpy
+
+    mov     X(fc), tmpx
+    mov     Y(fc), tmpy
+
+    GR_SET_GW_ENTRY fifo, 24, tmpx
+    GR_SET_GW_ENTRY fifo, 28, tmpy
+
+    add     $32, fifo
+
+    mov     dataList(gc), i            # i = gc->datalist[0]->i
+    add     $ dataList, dlp            # dlp = gc->dataList
+
+    # Early out for no interp
+    test    i, i
+    je      .Lno_interpolation
+
+    # Setup for Parameter Calculator
+                                #   dxAB  dxBC  dyBC  dyAB  ooa
+    fmul    %st, %st(4)         #   DXAB  |     |     |     |
+    fmul    %st, %st(3)         #   |     DXBC  |     |     |
+    fmul    %st, %st(2)         #   |     |     DYBC  |     |
+    fmulp   %st, %st(1)         #   |     |     |     DYAB
+    fxch    %st(3)              #   DYAB  |     |     DXAB  
+    fstps   zdxAB               #   |     |     DYBC
+    fstps   zdyBC               #   |     DXBC
+    fstps   zdxBC               #   DYAB
+    fstps   zdyAB               #
+
+    # Parameter Calculator
+.align 4
+.Lnext_parm:
+    test    $1, i
+    jnz     .Lsecondary_packet
+
+    mov     (fa, i), tmpy                 # tmpy = fa[i]
+    flds    (fa, i)                       #   pa
+    fsubs   (fb, i)                       #   dpAB
+    flds    (fb, i)                       #   |    pb
+    fsubs   (fc, i)	                  #   dpAB dpBC
+
+    fld     %st(1)                        #   |    |    dpAB   
+    fmuls   zdyBC                         #   |    |    p0x
+    fld     %st(1)                        #   |    |    |    dpBC
+    fmuls   zdyAB                         #   |    |    |    p1x
+    fxch    %st(3)                        #   p1x  |    |    dpAB
+					  #   |    |    |    |
+    GR_SET_GW_ENTRY fifo, 0, tmpy
+    fmuls   zdxBC                         #   |    |    |    p1y
+    fxch    %st(2)                        #   |    p1y  |    dpBC
+    fmuls   zdxAB                         #   |    |    |    p0y
+    fxch    %st(3)                        #   p0y  |    |    p1x
+    fsubrp  %st, %st(1)                   #   |    |    dpdx
+    fxch    %st(2)                        #   dpdx |    p0y
+    fsubp   %st, %st(1)                   #   |    dpdy
+    fxch    %st(1)                        #   dpdy dpdx
+    mov     dl_i + SIZEOF_dataList(dlp), i # i = dlp[1]->i
+    add     $ SIZEOF_dataList, dlp        # dlp++
+					  #   |
+    GR_FSET_GW_ENTRY fifo, 4
+					  #   empty
+    GR_FSET_GW_ENTRY fifo, 8
+    add     $12, fifo
+    test    i,i                           # while (i)
+    jne     .Lnext_parm                     # 
+
+.align 4
+.Ltriangle_command:
+    # Write Triangle Command
+    mov     zArea, tmpx
+    GR_SET_GW_ENTRY fifo, 0, tmpx
+    test    $7, fifo
+    jnz     .Lno_padding0
+    GR_SET_GW_ENTRY fifo, 4, tmpx
+.Lno_padding0:
+    # Cleanup
+    pop    %ebp
+    pop    %edi
+    pop    %esi
+    pop    %ebx
+    mov    $1, %eax                     # return 1 (triangle drawn)
+    ret
+    
+
+.align 4
+.Lzero_area:
+.Lbackfaced:
+    fstp    %st(0)   # 4
+    fstp    %st(0)   # 3
+    fstp    %st(0)   # 2
+    fstp    %st(0)   # 1
+    fstp    %st(0)   # 0
+    pop     %ebp
+    pop     %edi
+    pop     %esi
+    pop     %ebx
+    xor     %eax, %eax                    # return 0 (triangle drawn)
+    ret
+
+.align 4
+.Lwrap:
+    push    %eax
+    push    %ebx	
+    push    %ecx
+    push    %edx
+    call    _grSst96FifoMakeRoom
+    pop     %edx
+    pop     %ecx
+    pop     %ebx
+    pop     %eax
+    mov     fifoPtr(gc), fifo
+    mov     fifoSize(gc), tmpy
+    sub     tmpx, tmpy
+    jmp     .LwrapDone
+
+.align 4
+.Lfence:
+    mov     writesSinceFence(gc), tmpx
+    mov     (_GlideRoot+curTriSize), tmpy
+    
+    shr     $2, tmpy
+    sub     tmpy, tmpx
+    jl      .Ldofence
+
+    mov     tmpx, writesSinceFence(gc)
+    jmp     .LfenceDone
+
+.align 4
+.Ldofence:
+    push    %eax
+    xchg    %eax, P6FenceVar
+    pop     %eax
+    jmp     .LfenceDone
+
+.align 4
+.Lsecondary_packet:
+    test    $7, fifo
+    jz      .Lno_padding1
+    GR_SET_GW_ENTRY  fifo, 0, tmpx 
+    add     $4, fifo
+.align 4
+.Lno_padding1:
+    push    tmpx
+    push    gc
+    
+    mov     dl_addr(dlp), tmpx
+    mov     (_GlideRoot+curGC), gc
+
+    GR_SET_GW_CMD  fifo, 0, tmpx
+    mov     gwHeaders(gc, 4), tmpy
+    
+    GR_SET_GW_HEADER fifo, 4, tmpy
+    pop     gc
+
+    pop     tmpx
+    add     $8, fifo
+
+    mov     dl_i + SIZEOF_dataList(dlp), i
+    add     $ SIZEOF_dataList, dlp
+.align 4
+.Lnext_parm_1:
+    mov    (fa, i), tmpx               # tmpy = fa[i]
+    flds   (fa, i)                     #   pa
+    fsubs  (fb, i)                     #   dpAB
+    flds   (fb, i)                     #   |    pb
+    fsubs  (fc, i)                     #   dpAB dpBC 
+
+    fld    %st(1)                      #   |    |    dpAB   
+    fmuls  zdyBC                       #   |    |    p0x
+    fld    %st(1)                      #   |    |    |    dpBC
+    fmuls  zdyAB                       #   |    |    |    p1x
+    fxch   %st(3)                      #   p1x  |    |    dpAB
+				       #   |    |    |    |
+    GR_SET_GW_ENTRY fifo, 0, tmpy       
+    fmuls  zdxBC                       #   |    |    |    p1y
+    fxch   %st(2)                      #   |    p1y  |    dpBC
+    fmuls  zdxAB                       #   |    |    |    p0y
+    fxch   %st(3)                      #   p0y  |    |    p1x
+    fsubrp %st,%st(1)                  #   |    |    dpdx
+    fxch   %st(2)                      #   dpdx |    p0y
+    fsubp  %st,%st(1)                  #   |    dpdy
+    fxch   %st(1)                      #   dpdy dpdx
+    mov    dl_i + SIZEOF_dataList(dlp), i # i = dlp[1]->i
+    add    $ SIZEOF_dataList, dlp        # dlp++
+				       #   |
+    GR_FSET_GW_ENTRY fifo, 4
+				       #   empty
+    GR_FSET_GW_ENTRY fifo, 8            
+    add     $12, fifo
+    test    i,i                        # while (i)
+    jne     .Lnext_parm_1 
+
+    test    $7, fifo
+    jz      .Ltriangle_command_packet
+    GR_SET_GW_ENTRY fifo, 0, tmpx
+    add     $4, fifo
+.align 4
+.Ltriangle_command_packet:
+    mov     (_GlideRoot+curGC), gc
+    mov     $0x40000000, tmpy
+
+    mov     gwCommand(gc), tmpx
+    mov     zArea, fa
+
+    GR_SET_GW_CMD    fifo, 0, tmpx
+    GR_SET_GW_HEADER fifo, 4, tmpy
+
+    GR_SET_GW_ENTRY  fifo, 8,  fa
+    GR_SET_GW_ENTRY  fifo, 12, fa
+
+    pop    %ebp
+    pop    %edi
+    pop    %esi
+    pop    %ebx
+    mov    $1, %eax                     # return 1 (triangle drawn)
+    ret
+
+.align 4
+.Lno_interpolation:
+    fstp    %st(0)     # 4
+    fstp    %st(0)     # 3 
+    fstp    %st(0)     # 2 
+    fstp    %st(0)     # 1 
+    fstp    %st(0)     # 0
+    jmp     .Ltriangle_command
+
+.L_end_tri_setup_asm:
+.AIF \&GLIDE_DEBUG EQ 0
+.size	grDrawTriangle,.L_end_tri_setup_asm-grDrawTriangle
+.AENDI	
+.size	grDrawTriangle_asm,.L_end_tri_setup_asm-grDrawTriangle_asm
+.size	_trisetup_asm,.L_end_tri_setup_asm-_trisetup_asm	        
+	
+# [++++ from above]
+# This comment was moved here to make the code in the loop more readable 
+# STALL HERE due to PCI write buffer being full on last instruction:        
+# The write to the packerHackAddress takes 3 bus clocks, during which
+# we may not write to the PCI buffer without stalling.  This causes
+# the amount of clocks the workaround adds to the loop to vary in the
+# following way++:
+# 
+#    CPU          Bus/CPU Clock     Total Bus       Total Penalty
+#                     Ratio*      Clocks Since   (add to later clocks)
+#======================================================================  
+# P55c-200/P5-180:    6/1              1.3       (3 - 1.3) * 6 + 6 = 17 
+# P5-166/P5-150:      5/1              1.8       (3 - 1.8) * 5 + 6 = 12 
+# P5-120:             4/1              2.25      (3 - 2.25) * 4 + 6 = 9 
+# P5-100/P5-90:       3/1               3        (3 - 3) * 3 + 6 = 6
+#
+# * P5-200 haa a 33MHz bus, P5-166 has a 33MHz bus, 
+#   P5-150 has a 30MHz bus, P5-120 has a 30MHz bus,
+#   P5-100 has a 33MHz bus, P5-90 has a 30MHz bus
+#
+#++ These calculations also assume that we NEVER get to continue a burst 
+#   from having the next parameter be consecutive from the current one.
+#   If we did get that, then we have to add two more bus clocks to the
+#   penalty for the next write (labeled loop clock 10), so that looks like
+#      CPU                  Total Penalty
+#      ============================================        
+#      P55c-200/P5-180:(2 * 6) + 17 = 29 clocks!!!
+#      P5-166/P5-150:  (2 * 5) + 12 = 22 clocks!!
+#      P5-120:         (2 * 4) +  9 = 17 clocks!
+#      P5-100/P5-90    (2 * 3) +  6 = 12 clocks    
+#
+
+#_TEXT ENDS
+.END
Index: trunk/src/opengl/glide/sst1/glide/p6fence.asm
===================================================================
--- trunk/src/opengl/glide/sst1/glide/p6fence.asm	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/p6fence.asm	(revision 2885)
@@ -0,0 +1,45 @@
+;;
+;; THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+;; PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+;; TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+;; INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+;; DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+;; THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+;; EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+;; FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+;; 
+;; USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+;; RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+;; TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+;; AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+;; SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+;; THE UNITED STATES.  
+;; 
+;; COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+;;
+
+	title	p6Fence.asm
+	.586P
+CODE32	segment para use32 public 'CODE'
+CODE32	ends
+DATA32	segment para use32 public 'DATA'
+DATA32	ends
+BSS32	segment para use32 public 'BSS'
+BSS32	ends
+DGROUP	group BSS32, DATA32
+	assume	cs:FLAT, ds:FLAT, ss:FLAT, es:FLAT
+
+BSS32	segment
+P6FenceVar	DD	0
+BSS32	ends
+
+CODE32	segment
+
+	public p6Fence
+p6Fence	proc
+	xchg	eax, P6FenceVar
+	ret	
+p6Fence	endp
+CODE32	ends
+
+end
Index: trunk/src/opengl/glide/sst1/glide/rcver.h
===================================================================
--- trunk/src/opengl/glide/sst1/glide/rcver.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/rcver.h	(revision 2885)
@@ -0,0 +1,60 @@
+/* 
+ * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ * FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ * 
+ * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ * TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ * THE UNITED STATES.  
+ * 
+ * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+ */
+
+#define MANVERSION              2
+#define MANREVISION             46
+
+#ifndef GLIDE3
+#define VERSIONSTR "2.46\0"
+#else
+#define VERSIONSTR "3.0\0"
+#endif
+
+#ifdef SST1
+#   define HWSTR   "Voodoo Graphics(tm)\0"
+#   ifdef NT_BUILD
+#     define PRODNAME "Glide(tm) for Voodoo Graphics\251 and Windows\256 NT\0"
+#   else
+#     define PRODNAME "Glide(tm) for Voodoo Graphics\251 and Windows\256 95/98\0"
+#   endif /* NT_BUILD */
+#elif defined(SST96)
+#   define HWSTR   " Voodoo Rush(tm)\0"
+#   ifdef NT_BUILD
+#     define PRODNAME "Glide(tm) for Voodoo Rush\251 and Windows\256 NT\0"
+#   else
+#     define PRODNAME "Glide(tm) for Voodoo Rush\251 and Windows\256 95/98\0"
+#   endif /* NT_BUILD */
+#elif defined(CVG) || defined(VOODOO2)
+#   define HWSTR   " Voodoo^2(tm)\0"
+#   ifdef NT_BUILD
+#     define PRODNAME "Glide(tm) for Voodoo^2\251 and Windows\256 NT\0"
+#   else
+#     define PRODNAME "Glide(tm) for Voodoo^2\251 and Windows\256 95/98\0"
+#   endif /* NT_BUILD */
+#elif defined(H3)
+#   define HWSTR   " Banshee(tm)\0"
+#   ifdef NT_BUILD
+#     define PRODNAME "Glide(tm) for Banshee\251 and Windows\256 NT\0"
+#   else
+#     define PRODNAME "Glide(tm) for Banshee\251 and Windows\256 95/98\0"
+#   endif /* NT_BUILD */
+#else
+#   define HWSTR   "Unknown Chip\0"
+#endif
Index: trunk/src/opengl/glide/sst1/glide/readme
===================================================================
--- trunk/src/opengl/glide/sst1/glide/readme	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/readme	(revision 2885)
@@ -0,0 +1,40 @@
+GDEBUG levels:
+
+Level   Description
+-----   ------------------------------------------------
+ 80     init routines
+ 81     gu3df*
+ 82	grLfb*
+ 83	grSst*
+ 84	grSstStatus, grSstIsBusy, grSstVideoLine
+ 85	gr* misc state routines
+ 86	grBuffer*
+ 87	grDisableAllEffects, grGlide?etState
+ 88	grTex* attribute routines
+ 89	grTex* download routines
+ 90	grDrawPoint
+ 91	grDrawLine
+ 92	grDrawTriangle
+ 93	grDrawPolygon*
+ 94	grDrawAAPoint
+ 95	grDrawAALine
+ 96	grDrawAATriangle
+ 97	grDrawAAPolygon*
+ 98	guMP* routines
+ 99	gu* misc. routines
+280	internal init routines
+281	routine exit traces
+282     dataList values
+
+GLIDE_PLATFORM: 
+
+        GLIDE_HARDWARE:
+                Defined if GLIDE should use the actual SST hardware.
+
+        GLIDE_HW_*:
+        GLIDE_HW_SST1:
+                This macro is for compiling 
+        GLIDE_HW_SST96:
+                This macro is for compiling Glide for SST96
+        GLIDE_HW_H3:
+                This macro is for compiling Glide for H3
Index: trunk/src/opengl/glide/sst1/glide/splshdat.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/splshdat.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/splshdat.c	(revision 2885)
@@ -0,0 +1,17361 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/splshdat.c,v 1.1 2000-02-25 00:31:21 sandervl Exp $
+** $Log: splshdat.c,v $
+** Revision 1.1  2000-02-25 00:31:21  sandervl
+** Created new Voodoo 1 Glide dir
+**
+**
+*/
+
+static Vert vert_0[] = {
+{ 273.149261f, -24.549585f, 271.420441f, 0.012590f, -0.999890f, 0.007876f, 189.411841f, 18.708570f },
+{ 262.776489f, -24.549574f, 143.489777f, 0.005015f, -0.999765f, 0.021108f, 187.071440f, 69.986058f },
+{ 484.061951f, -24.549578f, 188.438385f, 0.011169f, -0.999936f, -0.001735f, 236.999758f, 51.969644f },
+{ 383.791992f, -24.549570f, 84.710793f, 0.010803f, -0.999785f, 0.017720f, 214.376000f, 93.546010f },
+{ 563.586426f, -24.549566f, 46.677605f, 0.009678f, -0.999914f, -0.008881f, 254.942760f, 108.790640f },
+{ 432.198181f, -24.549561f, -5.186394f, 0.013545f, -0.999894f, 0.005335f, 225.297815f, 129.578823f },
+{ 542.840820f, -24.549555f, -77.795677f, 0.007103f, -0.999894f, -0.012739f, 250.261958f, 158.682259f },
+{ 407.995087f, -24.549522f, -95.083649f, 0.013879f, -0.999904f, -0.000529f, 219.836900f, 165.611674f },
+{ 494.434692f, -24.549543f, -205.726379f, 0.002522f, -0.999903f, -0.013725f, 239.340159f, 209.959770f },
+{ 300.809937f, -24.549547f, -171.150482f, 0.015764f, -0.999874f, -0.001621f, 195.652869f, 196.100972f },
+{ 331.928192f, -24.549507f, -274.878052f, 0.002234f, -0.999897f, -0.014178f, 202.674041f, 237.677320f },
+{ 155.591354f, -24.549513f, -202.268799f, 0.011551f, -0.999861f, -0.012043f, 162.887410f, 208.573894f },
+{ 138.303436f, -24.549505f, -288.708374f, -0.003900f, -0.999855f, -0.016564f, 158.986767f, 243.220826f },
+{ -10.372740f, -24.549486f, -178.065643f, 0.019735f, -0.999598f, -0.020336f, 125.441172f, 198.872725f },
+{ -76.066864f, -24.549473f, -316.369080f, -0.005668f, -0.999796f, -0.019403f, 110.618699f, 254.307860f },
+{ -148.676147f, -24.549513f, -212.641541f, 0.006169f, -0.999812f, -0.018392f, 94.235969f, 212.731524f },
+{ -235.115784f, -24.549473f, -316.369080f, -0.011969f, -0.999851f, -0.012476f, 74.732718f, 254.307860f },
+{ -276.606812f, -24.549515f, -191.895996f, 0.001960f, -0.999741f, -0.022663f, 65.371153f, 204.416240f },
+{ -394.164703f, -24.549477f, -267.962891f, -0.008901f, -0.999940f, -0.006464f, 38.846733f, 234.905569f },
+{ -352.673676f, -24.549488f, -136.574646f, -0.001484f, -0.999702f, -0.024356f, 48.208294f, 182.242196f },
+{ -490.977112f, -24.549486f, -167.692871f, -0.010745f, -0.999942f, -0.000498f, 17.003084f, 194.715083f },
+{ -404.537445f, -24.549494f, -81.253296f, -0.011367f, -0.999900f, -0.008360f, 36.506343f, 160.068151f },
+{ -563.586426f, -24.549498f, -29.389488f, -0.008846f, -0.999795f, 0.018188f, 0.620349f, 139.279968f },
+{ -421.825378f, -24.549501f, 8.643953f, -0.014278f, -0.999891f, -0.003750f, 32.605693f, 124.035300f },
+{ -522.095337f, -24.549541f, 105.456299f, -0.006669f, -0.999881f, 0.013889f, 9.981924f, 85.230734f },
+{ -363.046448f, -24.549541f, 112.371468f, -0.021114f, -0.999733f, -0.009357f, 45.867897f, 82.458980f },
+{ -446.028503f, -24.549519f, 205.726318f, 0.001853f, -0.999682f, 0.025132f, 27.144776f, 45.040260f },
+{ -304.267487f, -24.549698f, 160.777710f, -0.020407f, -0.999774f, 0.005967f, 59.130113f, 63.056674f },
+{ -325.013000f, -24.549555f, 267.962860f, 0.003703f, -0.999746f, 0.022221f, 54.449330f, 20.094447f },
+{ -203.997513f, -24.549549f, 198.811157f, -0.010313f, -0.999774f, 0.018587f, 81.753890f, 47.811998f },
+{ -138.303391f, -24.549589f, 316.369080f, 0.008523f, -0.999823f, 0.016755f, 96.576363f, 0.692140f },
+{ -44.948593f, -24.549578f, 178.065643f, -0.007338f, -0.999733f, 0.021901f, 117.639871f, 56.127275f },
+{ 79.524475f, -24.549589f, 302.538696f, 0.018197f, -0.999766f, 0.011712f, 145.724552f, 6.235663f },
+{ 107.185158f, -24.549576f, 164.235291f, 0.002913f, -0.999764f, 0.021512f, 151.965595f, 61.670797f },
+{ 257.177246f, -24.933891f, 247.388947f, -0.002196f, -0.999908f, 0.013383f, 189.411841f, 18.708570f },
+{ 248.097778f, -24.933882f, 127.560898f, 0.006178f, -0.999976f, 0.003207f, 187.071440f, 69.986058f },
+{ 449.640747f, -24.933884f, 170.658722f, 0.002530f, -0.999944f, 0.010309f, 236.999758f, 51.969644f },
+{ 357.436859f, -24.933876f, 80.888054f, 0.006209f, -0.999981f, -0.000250f, 214.376000f, 93.546010f },
+{ 521.126526f, -24.933874f, 43.160934f, 0.006734f, -0.999927f, 0.010037f, 254.942760f, 108.790640f },
+{ 404.311340f, -24.933870f, -2.458469f, 0.006431f, -0.999963f, -0.005670f, 225.297815f, 129.578823f },
+{ 501.943878f, -24.933863f, -69.597458f, 0.008351f, -0.999957f, 0.004028f, 250.261958f, 158.682259f },
+{ 380.763092f, -24.933832f, -86.167274f, 0.003817f, -0.999973f, -0.006297f, 219.836900f, 165.611674f },
+{ 459.521820f, -24.933853f, -187.305740f, 0.007558f, -0.999970f, -0.001392f, 239.340159f, 209.959770f },
+{ 277.039581f, -24.933857f, -148.476547f, 0.001550f, -0.999981f, -0.006005f, 195.652869f, 196.100972f },
+{ 310.612000f, -24.933817f, -250.478271f, 0.010282f, -0.999945f, -0.002099f, 202.674041f, 237.677320f },
+{ 143.869293f, -24.933823f, -182.877960f, 0.000385f, -0.999975f, -0.007022f, 162.887410f, 208.573894f },
+{ 126.038422f, -24.933817f, -261.421204f, 0.007580f, -0.999942f, -0.007664f, 158.986767f, 243.220826f },
+{ -12.511669f, -24.933794f, -160.756546f, 0.000504f, -0.999969f, -0.007865f, 125.441172f, 198.872725f },
+{ -76.663612f, -24.933783f, -297.401611f, 0.011523f, -0.999829f, -0.014451f, 110.618699f, 254.307860f },
+{ -148.031876f, -24.933823f, -192.176437f, -0.004257f, -0.999964f, -0.007337f, 94.235969f, 212.731524f },
+{ -229.626144f, -24.933783f, -288.089294f, 0.004915f, -0.999922f, -0.011510f, 74.732718f, 254.307860f },
+{ -271.880676f, -24.933825f, -170.771347f, -0.005194f, -0.999973f, -0.005174f, 65.371153f, 204.416240f },
+{ -371.136383f, -24.933788f, -242.218704f, 0.003027f, -0.999922f, -0.012100f, 38.846733f, 234.905569f },
+{ -331.104309f, -24.933798f, -120.729073f, -0.004534f, -0.999987f, -0.002245f, 48.208294f, 182.242196f },
+{ -457.056519f, -24.933796f, -151.361816f, -0.000889f, -0.999896f, -0.014400f, 17.003084f, 194.715083f },
+{ -375.726990f, -24.933802f, -71.798042f, -0.008099f, -0.999961f, 0.003607f, 36.506343f, 160.068151f },
+{ -521.126587f, -24.933805f, -27.175323f, -0.006509f, -0.999977f, 0.001914f, 0.620349f, 139.279968f },
+{ -393.095642f, -24.933809f, 1.511459f, -0.005247f, -0.999950f, 0.008552f, 32.605693f, 124.035300f },
+{ -489.623932f, -24.933847f, 94.842606f, -0.009209f, -0.999957f, -0.000960f, 9.981924f, 85.230734f },
+{ -339.383545f, -24.933847f, 99.110413f, -0.004875f, -0.999978f, 0.004578f, 45.867897f, 82.458980f },
+{ -420.171265f, -24.933825f, 190.964874f, -0.009048f, -0.999950f, 0.004143f, 27.144776f, 45.040260f },
+{ -291.672363f, -24.934004f, 144.238663f, -0.000427f, -0.999928f, 0.011948f, 59.130113f, 63.056674f },
+{ -309.379486f, -24.933861f, 249.619171f, -0.011270f, -0.999908f, 0.007562f, 54.449330f, 20.094447f },
+{ -195.040344f, -24.933855f, 180.815704f, 0.002731f, -0.999942f, 0.010459f, 81.753890f, 47.811998f },
+{ -136.935654f, -24.933895f, 293.288574f, -0.005146f, -0.999926f, 0.011049f, 96.576363f, 0.692140f },
+{ -48.893070f, -24.933884f, 161.229355f, 0.003108f, -0.999963f, 0.008062f, 117.639871f, 56.127275f },
+{ 72.555756f, -24.933893f, 275.836060f, -0.004433f, -0.999894f, 0.013872f, 145.724552f, 6.235663f },
+{ 102.042297f, -24.933882f, 146.974792f, 0.007025f, -0.999961f, 0.005404f, 151.965595f, 61.670797f }
+};
+
+static Face face_0[] = {
+{ 61, 60, 59, 3, 0 },
+{ 55, 54, 53, 3, 0 },
+{ 57, 56, 55, 3, 0 },
+{ 39, 38, 37, 3, 0 },
+{ 37, 36, 35, 3, 0 },
+{ 53, 52, 51, 3, 0 },
+{ 41, 40, 39, 3, 0 },
+{ 43, 42, 41, 3, 0 },
+{ 59, 58, 57, 3, 0 },
+{ 63, 62, 61, 3, 0 },
+{ 45, 44, 43, 3, 0 },
+{ 35, 34, 67, 3, 0 },
+{ 67, 66, 65, 3, 0 },
+{ 51, 50, 49, 3, 0 },
+{ 49, 48, 47, 3, 0 },
+{ 65, 64, 63, 3, 0 },
+{ 47, 46, 45, 3, 0 },
+{ 41, 39, 37, 3, 0 },
+{ 43, 41, 37, 3, 0 },
+{ 43, 37, 35, 3, 0 },
+{ 45, 43, 35, 3, 0 },
+{ 45, 35, 67, 3, 0 },
+{ 47, 45, 67, 3, 0 },
+{ 47, 67, 65, 3, 0 },
+{ 49, 47, 65, 3, 0 },
+{ 49, 65, 63, 3, 0 },
+{ 51, 49, 63, 3, 0 },
+{ 51, 63, 61, 3, 0 },
+{ 53, 51, 61, 3, 0 },
+{ 53, 61, 59, 3, 0 },
+{ 53, 59, 57, 3, 0 },
+{ 53, 57, 55, 3, 0 },
+{ 61, 27, 26, 4, 2 },
+{ 26, 60, 61, 4, 0 },
+{ 60, 26, 25, 4, 2 },
+{ 25, 59, 60, 4, 0 },
+{ 55, 21, 20, 4, 2 },
+{ 20, 54, 55, 4, 0 },
+{ 54, 20, 19, 4, 2 },
+{ 19, 53, 54, 4, 0 },
+{ 57, 23, 22, 4, 2 },
+{ 22, 56, 57, 4, 0 },
+{ 56, 22, 21, 4, 2 },
+{ 21, 55, 56, 4, 0 },
+{ 39, 5, 4, 4, 2 },
+{ 4, 38, 39, 4, 0 },
+{ 38, 4, 3, 4, 2 },
+{ 3, 37, 38, 4, 0 },
+{ 37, 3, 2, 4, 2 },
+{ 2, 36, 37, 4, 0 },
+{ 36, 2, 1, 4, 2 },
+{ 1, 35, 36, 4, 0 },
+{ 53, 19, 18, 4, 2 },
+{ 18, 52, 53, 4, 0 },
+{ 52, 18, 17, 4, 2 },
+{ 17, 51, 52, 4, 0 },
+{ 41, 7, 6, 4, 2 },
+{ 6, 40, 41, 4, 0 },
+{ 40, 6, 5, 4, 2 },
+{ 5, 39, 40, 4, 0 },
+{ 43, 9, 8, 4, 2 },
+{ 8, 42, 43, 4, 0 },
+{ 42, 8, 7, 4, 2 },
+{ 7, 41, 42, 4, 0 },
+{ 59, 25, 24, 4, 2 },
+{ 24, 58, 59, 4, 0 },
+{ 58, 24, 23, 4, 2 },
+{ 23, 57, 58, 4, 0 },
+{ 63, 29, 28, 4, 2 },
+{ 28, 62, 63, 4, 0 },
+{ 62, 28, 27, 4, 2 },
+{ 27, 61, 62, 4, 0 },
+{ 45, 11, 10, 4, 2 },
+{ 10, 44, 45, 4, 0 },
+{ 44, 10, 9, 4, 2 },
+{ 9, 43, 44, 4, 0 },
+{ 35, 1, 0, 4, 2 },
+{ 0, 34, 35, 4, 0 },
+{ 34, 0, 33, 4, 2 },
+{ 33, 67, 34, 4, 0 },
+{ 67, 33, 32, 4, 2 },
+{ 32, 66, 67, 4, 0 },
+{ 66, 32, 31, 4, 2 },
+{ 31, 65, 66, 4, 0 },
+{ 51, 17, 16, 4, 2 },
+{ 16, 50, 51, 4, 0 },
+{ 50, 16, 15, 4, 2 },
+{ 15, 49, 50, 4, 0 },
+{ 49, 15, 14, 4, 2 },
+{ 14, 48, 49, 4, 0 },
+{ 48, 14, 13, 4, 2 },
+{ 13, 47, 48, 4, 0 },
+{ 65, 31, 30, 4, 2 },
+{ 30, 64, 65, 4, 0 },
+{ 64, 30, 29, 4, 2 },
+{ 29, 63, 64, 4, 0 },
+{ 47, 13, 12, 4, 2 },
+{ 12, 46, 47, 4, 0 },
+{ 46, 12, 11, 4, 2 },
+{ 11, 45, 46, 4, 0 }
+};
+
+static Vert vert_1[] = {
+{ -227.530014f, -20.966743f, 18.889576f, -0.132901f, 0.000004f, -0.991129f, 11.312357f, 104.759467f },
+{ -227.530014f, -20.966749f, 49.094059f, -0.113407f, 0.000000f, 0.993549f, 24.483732f, 68.571409f },
+{ -220.271423f, -20.966749f, 49.922577f, -0.278891f, 0.000000f, 0.960323f, 33.541598f, 70.744057f },
+{ -214.348251f, -20.966755f, 52.198391f, -0.521000f, 0.000000f, 0.853557f, 41.630631f, 70.600333f },
+{ -209.753510f, -20.966747f, 55.606861f, -0.731747f, 0.000000f, 0.681577f, 48.621978f, 68.520264f },
+{ -206.480209f, -20.966747f, 59.833366f, -0.886449f, 0.000000f, 0.462826f, 54.386820f, 64.883859f },
+{ -204.521362f, -20.966749f, 64.563301f, -0.976238f, 0.000000f, 0.216703f, 58.796339f, 60.071098f },
+{ -203.869965f, -20.966747f, 69.481987f, -0.998414f, 0.000000f, -0.056296f, 61.721703f, 54.462037f },
+{ -204.699646f, -20.966759f, 74.975159f, -0.937504f, 0.000000f, -0.347976f, 63.123094f, 47.518821f },
+{ -207.067520f, -20.966751f, 79.783142f, -0.793604f, 0.000000f, -0.608435f, 62.382769f, 40.725774f },
+{ -210.791794f, -20.966751f, 83.766113f, -0.597880f, 0.000001f, -0.801586f, 59.657563f, 34.329668f },
+{ -215.690674f, -20.966751f, 86.784210f, -0.383174f, 0.000001f, -0.923676f, 55.104290f, 28.577385f },
+{ -221.582382f, -20.966751f, 88.697617f, -0.170028f, 0.000001f, -0.985439f, 48.879779f, 23.715683f },
+{ -228.285126f, -20.966751f, 89.366486f, -0.004631f, 0.000001f, -0.999989f, 41.140841f, 19.991411f },
+{ -233.272552f, -20.966751f, 89.153244f, 0.101449f, 0.000001f, -0.994841f, 35.072373f, 18.071997f },
+{ -238.232040f, -20.966751f, 88.499512f, 0.188036f, 0.000001f, -0.982162f, 28.845299f, 16.692535f },
+{ -243.261429f, -20.966751f, 87.384338f, 0.268237f, 0.000001f, -0.963353f, 22.333248f, 15.835422f },
+{ -248.458618f, -20.966747f, 85.786713f, 0.337432f, 0.000001f, -0.941350f, 15.409765f, 15.483181f },
+{ -253.921509f, -20.966747f, 83.685699f, 0.393673f, 0.000001f, -0.919251f, 7.948429f, 15.618211f },
+{ -259.747955f, -20.966747f, 81.060303f, 0.410820f, 0.000001f, -0.911717f, -0.177157f, 16.222941f },
+{ -259.747955f, -20.966751f, 111.264603f, -0.366219f, -0.000001f, 0.930529f, 12.994208f, -19.965071f },
+{ -253.885376f, -20.966755f, 113.571884f, -0.315937f, -0.000001f, 0.948780f, 21.024357f, -20.172935f },
+{ -247.666229f, -20.966757f, 115.459656f, -0.243578f, -0.000001f, 0.969881f, 29.298774f, -19.722674f },
+{ -241.153412f, -20.966763f, 116.927917f, -0.175846f, -0.000001f, 0.984418f, 37.742109f, -18.641708f },
+{ -234.409882f, -20.966763f, 117.976685f, -0.111723f, -0.000001f, 0.993739f, 46.278933f, -16.957548f },
+{ -227.498550f, -20.966763f, 118.605942f, -0.050166f, -0.000001f, 0.998741f, 54.833858f, -14.697611f },
+{ -220.482346f, -20.966763f, 118.815689f, 0.049994f, -0.000001f, 0.998749f, 63.331494f, -11.889319f },
+{ -205.143631f, -20.966763f, 117.432495f, 0.221684f, -0.000001f, 0.975119f, 81.105759f, -3.543264f },
+{ -191.825546f, -20.966755f, 113.455368f, 0.430806f, -0.000001f, 0.902444f, 95.327940f, 7.029456f },
+{ -180.870651f, -20.966755f, 107.142990f, 0.647042f, -0.000001f, 0.762454f, 105.700410f, 19.369521f },
+{ -172.621567f, -20.966755f, 98.754059f, 0.840384f, 0.000000f, 0.541992f, 111.925502f, 33.017599f },
+{ -167.420868f, -20.966753f, 88.547287f, 0.966795f, 0.000000f, 0.255554f, 113.705577f, 47.514307f },
+{ -165.611176f, -20.966751f, 76.781357f, 0.999957f, 0.000000f, -0.009295f, 110.742945f, 62.400328f },
+{ -166.340637f, -20.966751f, 68.696579f, 0.976852f, 0.000000f, -0.213918f, 106.343396f, 71.768664f },
+{ -168.510422f, -20.966749f, 61.101204f, 0.918400f, 0.000000f, -0.395654f, 100.431605f, 79.922555f },
+{ -172.092514f, -20.966755f, 54.065182f, 0.827210f, 0.000000f, -0.561892f, 93.071636f, 86.790413f },
+{ -177.058975f, -20.966747f, 47.658421f, 0.712639f, 0.000000f, -0.701531f, 84.327446f, 92.300650f },
+{ -183.381851f, -20.966743f, 41.950832f, 0.586577f, 0.000000f, -0.809893f, 74.263017f, 96.381707f },
+{ -191.033142f, -20.966743f, 37.012333f, 0.830953f, 0.000000f, 0.556343f, 62.942380f, 98.962027f },
+{ -181.454453f, -20.966751f, 32.298737f, 0.560396f, -0.000001f, 0.828225f, 72.363203f, 108.786445f },
+{ -173.805496f, -20.966743f, 26.319462f, 0.724928f, -0.000003f, 0.688825f, 78.920131f, 119.285616f },
+{ -168.002350f, -20.966745f, 19.235668f, 0.857930f, -0.000002f, 0.513767f, 82.783855f, 130.303376f },
+{ -163.961121f, -20.966740f, 11.208173f, 0.946024f, 0.000000f, 0.324095f, 84.125031f, 141.683643f },
+{ -161.597916f, -20.966740f, 2.397420f, 0.990004f, 0.000000f, 0.141040f, 83.114247f, 153.270415f },
+{ -160.828827f, -20.966740f, -7.035602f, 0.998047f, 0.000000f, -0.062465f, 79.922191f, 164.907572f },
+{ -162.772522f, -20.966736f, -21.426922f, 0.945614f, 0.000000f, -0.325292f, 71.317727f, 181.302331f },
+{ -168.407867f, -20.966743f, -33.734730f, 0.805843f, 0.000000f, -0.592129f, 59.198844f, 193.590982f },
+{ -177.441193f, -20.966736f, -43.721256f, 0.600640f, 0.000000f, -0.799519f, 44.021060f, 201.616710f },
+{ -189.578857f, -20.966732f, -51.148808f, 0.373832f, 0.000000f, -0.927496f, 26.239853f, 205.222777f },
+{ -204.527191f, -20.966740f, -55.779682f, 0.160102f, 0.000000f, -0.987101f, 6.310721f, 204.252461f },
+{ -221.992554f, -20.966740f, -57.376118f, 0.002576f, 0.000000f, -0.999997f, -15.310837f, 198.548949f },
+{ -229.371170f, -20.966740f, -57.068485f, -0.093624f, 0.000000f, -0.995608f, -24.017065f, 194.962735f },
+{ -236.805725f, -20.966740f, -56.173542f, -0.168365f, 0.000000f, -0.985725f, -32.534211f, 190.648469f },
+{ -244.142380f, -20.966740f, -54.733250f, -0.240737f, 0.000000f, -0.970590f, -40.696227f, 185.723508f },
+{ -251.227341f, -20.966732f, -52.789539f, -0.314259f, 0.000000f, -0.949337f, -48.337180f, 180.305151f },
+{ -257.906799f, -20.966732f, -50.384388f, -0.392630f, 0.000000f, -0.919696f, -55.291061f, 174.510773f },
+{ -264.026886f, -20.966732f, -47.559727f, -0.419059f, 0.000000f, -0.907959f, -61.391828f, 168.457698f },
+{ -264.026886f, -20.966738f, -14.334979f, 0.543306f, 0.000000f, 0.839534f, -46.903330f, 128.650867f },
+{ -257.339294f, -20.966736f, -18.662861f, 0.501817f, 0.000000f, 0.864974f, -40.778150f, 136.752428f },
+{ -251.050217f, -20.966736f, -22.109791f, 0.426524f, 0.000000f, 0.904476f, -34.746278f, 143.624739f },
+{ -245.054810f, -20.966736f, -24.717709f, 0.331870f, 0.000000f, 0.943325f, -28.700379f, 149.363753f },
+{ -239.248169f, -20.966736f, -26.528568f, 0.220540f, 0.000000f, 0.975378f, -22.533070f, 154.065492f },
+{ -233.525421f, -20.966736f, -27.584324f, 0.100336f, 0.000000f, 0.994954f, -16.136991f, 157.825952f },
+{ -227.781708f, -20.966736f, -27.926914f, -0.045215f, 0.000000f, 0.998977f, -9.404798f, 160.741110f },
+{ -220.280746f, -20.966736f, -27.192783f, -0.239464f, 0.000000f, 0.970905f, -0.097693f, 163.132527f },
+{ -213.751633f, -20.966736f, -25.074284f, -0.460291f, 0.000000f, 0.887768f, 8.648720f, 163.441519f },
+{ -208.369156f, -20.966736f, -21.697269f, -0.678343f, 0.000000f, 0.734745f, 16.570136f, 161.742661f },
+{ -204.308121f, -20.966736f, -17.187603f, -0.860689f, 0.000000f, 0.509130f, 23.402251f, 158.110511f },
+{ -201.743317f, -20.966747f, -11.671123f, -0.971980f, 0.000000f, 0.235065f, 28.880766f, 152.619616f },
+{ -200.849533f, -20.966740f, -5.273685f, -0.999103f, 0.000000f, -0.042355f, 32.741388f, 145.344557f },
+{ -201.724655f, -20.966740f, 1.288052f, -0.949258f, 0.000000f, -0.314499f, 34.554308f, 137.101264f },
+{ -204.242859f, -20.966745f, 7.031773f, -0.823833f, 0.000000f, -0.566833f, 34.041921f, 129.121540f },
+{ -208.243301f, -20.966740f, 11.810628f, -0.639055f, 0.000000f, -0.769161f, 31.332898f, 121.651460f },
+{ -213.565170f, -20.966740f, 15.477796f, -0.424211f, 0.000001f, -0.905563f, 26.555888f, 114.937053f },
+{ -220.047684f, -20.966743f, 17.886265f, -0.205822f, 0.000004f, -0.978589f, 19.839473f, 109.224409f },
+{ -148.686584f, -20.966757f, 116.550354f, 0.000000f, -0.000001f, 1.000000f, 148.362720f, 22.133174f },
+{ -72.924095f, -20.966761f, 116.550354f, 0.071640f, -0.000001f, 0.997431f, 239.134392f, 55.171337f },
+{ -44.133286f, -20.966759f, 113.442535f, 0.268782f, -0.000001f, 0.963201f, 272.273660f, 71.449816f },
+{ -20.467419f, -20.966759f, 104.692368f, 0.513694f, -0.000001f, 0.857974f, 296.812166f, 92.253563f },
+{ -1.975434f, -20.966759f, 91.159866f, 0.734379f, 0.000000f, 0.678739f, 313.066387f, 116.530870f },
+{ 11.293716f, -20.966763f, 73.704994f, 0.894190f, 0.000000f, 0.447688f, 321.352617f, 143.230046f },
+{ 19.291100f, -20.966763f, 53.187717f, 0.979694f, 0.000000f, 0.200499f, 321.987274f, 171.299429f },
+{ 21.967770f, -20.966759f, 30.467985f, 0.999373f, 0.000000f, -0.035418f, 315.286714f, 199.687265f },
+{ 19.338877f, -20.966749f, 6.999157f, 0.959992f, 0.000000f, -0.280027f, 301.902798f, 226.659149f },
+{ 11.340330f, -20.966751f, -13.645114f, 0.842717f, 0.000000f, -0.538357f, 283.317205f, 247.905254f },
+{ -2.195676f, -20.966743f, -30.821491f, 0.643022f, 0.000000f, -0.765848f, 259.609426f, 262.581684f },
+{ -21.436935f, -20.966740f, -43.886723f, 0.400098f, 0.000000f, -0.916472f, 230.858877f, 269.844599f },
+{ -46.551262f, -20.966736f, -52.197575f, 0.167743f, 0.000000f, -0.985831f, 197.145034f, 268.850158f },
+{ -77.706444f, -20.966743f, -55.110798f, 0.031064f, 0.000000f, -0.999517f, 158.547374f, 258.754495f },
+{ -148.686584f, -20.966743f, -55.110798f, 0.000000f, 0.000000f, -1.000000f, 73.505490f, 227.801797f },
+{ -105.897141f, -20.966753f, 85.087540f, 0.894427f, 0.000000f, -0.447214f, 185.908946f, 78.488452f },
+{ -105.897141f, -20.966742f, -23.647968f, 0.447214f, 0.000000f, 0.894427f, 138.492050f, 208.765350f },
+{ -77.958153f, -20.966742f, -23.647968f, -0.079186f, 0.000000f, 0.996860f, 171.965974f, 220.948864f },
+{ -58.874207f, -20.966740f, -21.368664f, -0.304705f, 0.000000f, 0.952447f, 195.824559f, 226.540055f },
+{ -44.341877f, -20.966745f, -15.146022f, -0.579111f, 0.000000f, 0.815249f, 215.949404f, 225.421851f },
+{ -33.878738f, -20.966743f, -5.902942f, -0.798828f, 0.000000f, 0.601559f, 232.516059f, 218.910357f },
+{ -27.002363f, -20.966749f, 5.437657f, -0.929901f, 0.000000f, 0.367810f, 245.700060f, 208.321713f },
+{ -23.230320f, -20.966747f, 17.952679f, -0.987642f, -0.000001f, 0.156725f, 255.676941f, 194.972086f },
+{ -22.080179f, -20.966755f, 30.719687f, -0.999434f, 0.000000f, -0.033649f, 262.622269f, 180.177463f },
+{ -23.442402f, -20.966751f, 44.972424f, -0.970480f, 0.000000f, -0.241182f, 267.205431f, 162.507202f },
+{ -27.692215f, -20.966751f, 57.903645f, -0.878100f, 0.000000f, -0.478477f, 267.752663f, 145.160958f },
+{ -35.074326f, -20.966751f, 68.947113f, -0.700409f, 0.000000f, -0.713742f, 263.723906f, 128.710531f },
+{ -45.833443f, -20.966755f, 77.536469f, -0.453361f, 0.000001f, -0.891327f, 254.578922f, 113.727776f },
+{ -60.214287f, -20.966755f, 83.105392f, -0.193834f, 0.000001f, -0.981034f, 239.777576f, 100.784454f },
+{ -78.461555f, -20.966755f, 85.087540f, -0.036044f, 0.000001f, -0.999350f, 218.779751f, 90.452444f },
+{ 53.459190f, 2.970489f, -63.834198f, 0.000000f, 0.000000f, -1.000000f, 0.000000f, 255.000000f },
+{ 53.459190f, 2.970482f, 19.696451f, 0.000000f, 0.000010f, -1.000000f, 0.000000f, 255.000000f },
+{ 34.431496f, 2.970485f, 19.696451f, 0.000000f, 0.000010f, -1.000000f, 0.000000f, 255.000000f },
+{ 34.431496f, 2.970482f, 37.767296f, 0.000000f, 0.000000f, 1.000000f, 0.000000f, 255.000000f },
+{ 53.459190f, 2.970482f, 37.767296f, -0.894427f, 0.000000f, 0.447214f, 0.000000f, 255.000000f },
+{ 53.459190f, 2.970471f, 52.887688f, -0.994427f, 0.000000f, 0.105425f, 0.000000f, 255.000000f },
+{ 54.761124f, 2.970478f, 61.040325f, -0.930341f, 0.000000f, 0.366696f, 0.000000f, 255.000000f },
+{ 58.744659f, 2.970474f, 68.629539f, -0.769108f, -0.000001f, 0.639119f, 0.000000f, 255.000000f },
+{ 65.526382f, 2.970473f, 75.245560f, -0.554146f, -0.000001f, 0.832420f, 0.000000f, 255.000000f },
+{ 75.222885f, 2.970474f, 80.478622f, -0.334245f, -0.000001f, 0.942486f, 0.000000f, 255.000000f },
+{ 87.950760f, 2.970474f, 83.918953f, -0.139337f, -0.000002f, 0.990245f, 0.000000f, 255.000000f },
+{ 103.826599f, 2.970474f, 85.156792f, -0.014576f, -0.000002f, 0.999894f, 0.000000f, 255.000000f },
+{ 107.486267f, 2.970474f, 85.094475f, 0.038307f, -0.000002f, 0.999266f, 0.000000f, 255.000000f },
+{ 111.371353f, 2.970474f, 84.904106f, 0.070572f, -0.000002f, 0.997507f, 0.000000f, 255.000000f },
+{ 115.334160f, 2.970474f, 84.580559f, 0.105682f, -0.000002f, 0.994400f, 0.000000f, 255.000000f },
+{ 119.227013f, 2.970474f, 84.118721f, 0.147635f, -0.000002f, 0.989042f, 0.000000f, 255.000000f },
+{ 122.902229f, 2.970474f, 83.513466f, 0.202285f, -0.000002f, 0.979327f, 0.000000f, 255.000000f },
+{ 126.212128f, 2.970474f, 82.759666f, 0.996088f, 0.000000f, -0.088370f, 0.000000f, 255.000000f },
+{ 114.179916f, 2.970478f, 65.426537f, 0.125438f, 0.000002f, -0.992102f, 0.000000f, 255.000000f },
+{ 112.235428f, 2.970474f, 65.933624f, -0.222749f, 0.000002f, -0.974876f, 0.000000f, 255.000000f },
+{ 110.283180f, 2.970474f, 66.348511f, -0.174788f, 0.000002f, -0.984606f, 0.000000f, 255.000000f },
+{ 108.268738f, 2.970474f, 66.671196f, -0.124447f, 0.000002f, -0.992226f, 0.000000f, 255.000000f },
+{ 106.137703f, 2.970474f, 66.901688f, -0.075842f, 0.000002f, -0.997120f, 0.000000f, 255.000000f },
+{ 103.835670f, 2.970474f, 67.039986f, -0.032153f, 0.000002f, -0.999483f, 0.000000f, 255.000000f },
+{ 101.308228f, 2.970474f, 67.086082f, 0.055747f, 0.000002f, -0.998445f, 0.000000f, 255.000000f },
+{ 95.838806f, 2.970474f, 66.577293f, 0.226773f, 0.000002f, -0.973948f, 0.000000f, 255.000000f },
+{ 91.224388f, 2.970478f, 65.167015f, 0.433606f, 0.000001f, -0.901103f, 0.000000f, 255.000000f },
+{ 87.527145f, 2.970478f, 63.029404f, 0.640544f, 0.000000f, -0.767921f, 0.000000f, 255.000000f },
+{ 84.809280f, 2.970478f, 60.338612f, 0.827378f, 0.000000f, -0.561646f, 0.000000f, 255.000000f },
+{ 83.132957f, 2.970478f, 57.268784f, 0.960620f, 0.000000f, -0.277867f, 0.000000f, 255.000000f },
+{ 82.560364f, 2.970479f, 53.994072f, 0.998339f, 0.000000f, -0.057605f, 0.000000f, 255.000000f },
+{ 82.560364f, 2.970478f, 37.767296f, 0.447214f, 0.000000f, 0.894427f, 0.000000f, 255.000000f },
+{ 111.661545f, 2.970478f, 37.767296f, 0.000000f, 0.000000f, 1.000000f, 0.000000f, 255.000000f },
+{ 111.661545f, 2.970482f, 19.696451f, 0.000000f, 0.000010f, -1.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 2.970482f, 19.696451f, 0.000000f, 0.000010f, -1.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 2.970489f, -63.834198f, 0.000000f, 0.000000f, -1.000000f, 0.000000f, 255.000000f },
+{ 109.261765f, 2.970490f, -33.040283f, -0.936759f, 0.000000f, 0.349975f, 0.000000f, 255.000000f },
+{ 158.509918f, 2.970482f, 10.661288f, -0.945897f, 0.000000f, -0.324468f, 0.000000f, 255.000000f },
+{ 110.660858f, 2.970478f, 56.206810f, -0.475466f, 0.000000f, 0.879734f, 0.000000f, 255.000000f },
+{ 147.037323f, 2.970478f, 56.206810f, 0.529090f, -0.000002f, 0.848566f, 0.000000f, 255.000000f },
+{ 175.299042f, 2.970477f, 25.597071f, -0.347260f, -0.000006f, 0.937769f, 0.000000f, 255.000000f },
+{ 203.001129f, 2.970478f, 56.206810f, -0.267475f, 0.000000f, 0.963565f, 0.000000f, 255.000000f },
+{ 237.139038f, 2.970478f, 56.206810f, 0.947348f, 0.000000f, -0.320206f, 0.000000f, 255.000000f },
+{ 189.569809f, 2.970482f, 11.767657f, 0.937358f, 0.000000f, 0.348368f, 0.000000f, 255.000000f },
+{ 239.097778f, 2.970486f, -33.040283f, 0.470435f, 0.000000f, -0.882435f, 0.000000f, 255.000000f },
+{ 202.161682f, 2.970486f, -33.040283f, -0.518991f, 0.000000f, -0.854780f, 0.000000f, 255.000000f },
+{ 173.620132f, 2.970482f, -3.168332f, 0.311085f, 0.000000f, -0.950382f, 0.000000f, 255.000000f },
+{ 143.679504f, 2.970490f, -33.040283f, 0.252382f, 0.000000f, -0.967628f, 0.000000f, 255.000000f },
+{ 246.695496f, 2.970477f, 44.635109f, -0.894427f, 0.000000f, -0.447214f, 0.000000f, 255.000000f },
+{ 246.695496f, 2.970479f, 54.095207f, -0.447214f, 0.000000f, -0.894427f, 0.000000f, 255.000000f },
+{ 243.335144f, 2.970479f, 54.095207f, -0.894427f, 0.000000f, -0.447214f, 0.000000f, 255.000000f },
+{ 243.335144f, 2.970478f, 56.104118f, -0.447214f, 0.000000f, 0.894427f, 0.000000f, 255.000000f },
+{ 252.174316f, 2.970478f, 56.104118f, 0.894427f, 0.000000f, 0.447214f, 0.000000f, 255.000000f },
+{ 252.174316f, 2.970475f, 54.095207f, 0.447214f, 0.000000f, -0.894427f, 0.000000f, 255.000000f },
+{ 248.813965f, 2.970479f, 54.095207f, 0.894427f, 0.000000f, -0.447214f, 0.000000f, 255.000000f },
+{ 248.813965f, 2.970477f, 44.635109f, 0.447214f, 0.000000f, -0.894427f, 0.000000f, 255.000000f },
+{ 253.836212f, 2.970477f, 44.635109f, -0.894427f, 0.000000f, -0.447214f, 0.000000f, 255.000000f },
+{ 253.836212f, 2.970478f, 56.341530f, 0.287199f, 0.000000f, 0.957871f, 0.000000f, 255.000000f },
+{ 258.931549f, 2.970471f, 51.191429f, -0.319282f, 0.000000f, 0.947660f, 0.000000f, 255.000000f },
+{ 264.026886f, 2.970478f, 56.341530f, 0.877850f, 0.000000f, 0.478935f, 0.000000f, 255.000000f },
+{ 264.026886f, 2.970477f, 44.635109f, 0.447214f, 0.000000f, -0.894427f, 0.000000f, 255.000000f },
+{ 261.908356f, 2.970477f, 44.635109f, -0.894427f, 0.000000f, -0.447214f, 0.000000f, 255.000000f },
+{ 261.908356f, 2.970467f, 51.721062f, 0.301814f, 0.000000f, -0.953367f, 0.000000f, 255.000000f },
+{ 258.931549f, 2.970471f, 48.634651f, -0.326641f, 0.000000f, -0.945149f, 0.000000f, 255.000000f },
+{ 255.954681f, 2.970471f, 51.721062f, 0.879074f, 0.000000f, -0.476685f, 0.000000f, 255.000000f },
+{ 255.954681f, 2.970477f, 44.635109f, 0.447214f, 0.000000f, -0.894427f, 0.000000f, 255.000000f },
+{ 53.398365f, 9.484123f, -118.046249f, -0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 53.398365f, 9.484118f, -89.641510f, -0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 58.399651f, 9.484118f, -89.641510f, 0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 58.399651f, 9.484123f, -118.046249f, 0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 64.683319f, 9.484123f, -118.046249f, -0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 64.683319f, 9.484118f, -89.641510f, -0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 69.684608f, 9.484118f, -89.641510f, 0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 69.684608f, 9.484118f, -92.719223f, -0.390384f, -0.000002f, 0.920652f, 0.000000f, 255.000000f },
+{ 71.361206f, 9.484118f, -90.693527f, -0.520918f, -0.000002f, 0.853607f, 0.000000f, 255.000000f },
+{ 75.070610f, 9.484118f, -89.192673f, 0.065749f, -0.000003f, 0.997836f, 0.000000f, 255.000000f },
+{ 78.221947f, 9.484118f, -90.116470f, 0.641452f, -0.000002f, 0.767163f, 0.000000f, 255.000000f },
+{ 80.447113f, 9.484106f, -92.906830f, 0.914903f, -0.000001f, 0.403674f, 0.000000f, 255.000000f },
+{ 81.069901f, 9.484118f, -95.010895f, 0.988384f, 0.000000f, 0.151978f, 0.000000f, 255.000000f },
+{ 81.290161f, 9.484118f, -97.592270f, 0.999598f, 0.000000f, 0.028362f, 0.000000f, 255.000000f },
+{ 81.290161f, 9.484123f, -118.046249f, 0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 76.288872f, 9.484123f, -118.046249f, -0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 76.288872f, 9.484118f, -97.720505f, -0.997195f, 0.000000f, -0.074851f, 0.000000f, 255.000000f },
+{ 76.046646f, 9.484118f, -95.573715f, -0.873911f, 0.000001f, -0.486087f, 0.000000f, 255.000000f },
+{ 74.507790f, 9.484118f, -93.751663f, -0.206069f, 0.000002f, -0.978537f, 0.000000f, 255.000000f },
+{ 72.154381f, 9.484118f, -93.999222f, 0.497835f, 0.000001f, -0.867272f, 0.000000f, 255.000000f },
+{ 70.869621f, 9.484118f, -95.136749f, 0.791861f, 0.000001f, -0.610702f, 0.000000f, 255.000000f },
+{ 69.684608f, 9.484118f, -97.015213f, 0.982874f, 0.000000f, -0.184277f, 0.000000f, 255.000000f },
+{ 69.684608f, 9.484123f, -118.046249f, 0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 116.042702f, 9.484123f, -111.377884f, 0.874270f, -0.000001f, 0.485440f, 0.000000f, 255.000000f },
+{ 116.042702f, 9.484123f, -116.315048f, 0.760144f, 0.000001f, -0.649755f, 0.000000f, 255.000000f },
+{ 112.247803f, 9.484123f, -118.552078f, 0.152177f, 0.000001f, -0.988353f, 0.000000f, 255.000000f },
+{ 107.574234f, 9.484123f, -118.394455f, -0.459333f, 0.000001f, -0.888264f, 0.000000f, 255.000000f },
+{ 103.539482f, 9.484123f, -115.040680f, -0.838627f, 0.000001f, -0.544706f, 0.000000f, 255.000000f },
+{ 102.209610f, 9.484123f, -112.118805f, -0.959193f, 0.000000f, -0.282751f, 0.000000f, 255.000000f },
+{ 101.385559f, 9.484118f, -108.374069f, -0.993577f, 0.000000f, -0.113155f, 0.000000f, 255.000000f },
+{ 101.102959f, 9.484118f, -103.811813f, -0.999878f, 0.000000f, 0.015607f, 0.000000f, 255.000000f },
+{ 101.339844f, 9.484118f, -99.454697f, -0.989803f, 0.000000f, 0.142441f, 0.000000f, 255.000000f },
+{ 102.036247f, 9.484118f, -95.777939f, -0.953092f, -0.000001f, 0.302681f, 0.000000f, 255.000000f },
+{ 103.170799f, 9.484106f, -92.831436f, -0.859240f, -0.000001f, 0.511573f, 0.000000f, 255.000000f },
+{ 104.722122f, 9.484118f, -90.665039f, -0.601898f, -0.000001f, 0.798573f, 0.000000f, 255.000000f },
+{ 107.933678f, 9.484118f, -88.927658f, -0.064729f, -0.000002f, 0.997903f, 0.000000f, 255.000000f },
+{ 111.632736f, 9.484118f, -89.470520f, 0.480740f, -0.000002f, 0.876863f, 0.000000f, 255.000000f },
+{ 113.549179f, 9.484118f, -91.009384f, 0.770417f, -0.000001f, 0.637540f, 0.000000f, 255.000000f },
+{ 114.952675f, 9.484106f, -93.103928f, 0.938897f, 0.000000f, 0.344197f, 0.000000f, 255.000000f },
+{ 116.387047f, 9.484118f, -99.154877f, 0.994578f, 0.000000f, 0.103992f, 0.000000f, 255.000000f },
+{ 116.619774f, 9.484118f, -104.965958f, 0.454185f, 0.000001f, -0.890908f, 0.000000f, 255.000000f },
+{ 106.104248f, 9.484118f, -104.965958f, 0.931736f, 0.000000f, -0.363137f, 0.000000f, 255.000000f },
+{ 106.676575f, 9.484123f, -110.009995f, 0.932112f, 0.000000f, 0.362171f, 0.000000f, 255.000000f },
+{ 108.374535f, 9.484123f, -113.130463f, 0.561654f, -0.000001f, 0.827372f, 0.000000f, 255.000000f },
+{ 111.169655f, 9.484123f, -114.199112f, -0.059665f, -0.000002f, 0.998218f, 0.000000f, 255.000000f },
+{ 113.774490f, 9.484123f, -113.485794f, -0.556104f, -0.000002f, 0.831112f, 0.000000f, 255.000000f },
+{ 106.040123f, 9.484118f, -101.247055f, 0.458115f, -0.000001f, 0.888893f, 0.000000f, 255.000000f },
+{ 111.618484f, 9.484118f, -101.247055f, -0.917639f, -0.000001f, 0.397415f, 0.000000f, 255.000000f },
+{ 111.312141f, 9.484118f, -96.746857f, -0.968412f, 0.000000f, -0.249357f, 0.000000f, 255.000000f },
+{ 110.364601f, 9.484118f, -94.098984f, -0.666434f, 0.000002f, -0.745564f, 0.000000f, 255.000000f },
+{ 108.733131f, 9.484106f, -93.232178f, 0.199195f, 0.000001f, -0.979960f, 0.000000f, 255.000000f },
+{ 107.208519f, 9.484118f, -94.113220f, 0.848531f, 0.000001f, -0.529146f, 0.000000f, 255.000000f },
+{ 106.325096f, 9.484118f, -96.775345f, 0.988917f, 0.000000f, -0.148471f, 0.000000f, 255.000000f },
+{ 122.262253f, 9.484123f, -118.046249f, -0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 122.262253f, 9.484118f, -89.641510f, -0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 127.263535f, 9.484118f, -89.641510f, 0.888400f, -0.000001f, 0.459070f, 0.000000f, 255.000000f },
+{ 127.391785f, 9.484118f, -97.335800f, -0.832354f, -0.000001f, 0.554244f, 0.000000f, 255.000000f },
+{ 128.306671f, 9.484118f, -94.372665f, -0.943875f, -0.000001f, 0.330303f, 0.000000f, 255.000000f },
+{ 129.111130f, 9.484118f, -92.203903f, -0.906859f, -0.000001f, 0.421435f, 0.000000f, 255.000000f },
+{ 129.876404f, 9.484118f, -90.715500f, -0.732608f, -0.000001f, 0.680651f, 0.000000f, 255.000000f },
+{ 131.574371f, 9.484118f, -89.323883f, -0.237380f, -0.000001f, 0.971417f, 0.000000f, 255.000000f },
+{ 133.556717f, 9.484118f, -89.280533f, 0.272164f, -0.000002f, 0.962251f, 0.000000f, 255.000000f },
+{ 135.214310f, 9.484118f, -90.026230f, 0.953239f, -0.000001f, 0.302219f, 0.000000f, 255.000000f },
+{ 134.829590f, 9.484118f, -95.155746f, 0.189441f, 0.000002f, -0.981892f, 0.000000f, 255.000000f },
+{ 132.649551f, 9.484118f, -94.450439f, 0.149986f, 0.000002f, -0.988688f, 0.000000f, 255.000000f },
+{ 130.914764f, 9.484118f, -95.135269f, 0.671985f, 0.000002f, -0.740564f, 0.000000f, 255.000000f },
+{ 129.543335f, 9.484118f, -96.915451f, 0.885876f, 0.000001f, -0.463921f, 0.000000f, 255.000000f },
+{ 128.513855f, 9.484118f, -99.379593f, 0.955085f, 0.000001f, -0.296334f, 0.000000f, 255.000000f },
+{ 127.804985f, 9.484118f, -102.116226f, 0.982240f, 0.000000f, -0.187627f, 0.000000f, 255.000000f },
+{ 127.395340f, 9.484118f, -104.713943f, 0.998278f, 0.000000f, -0.058653f, 0.000000f, 255.000000f },
+{ 127.263535f, 9.484123f, -118.046249f, 0.445434f, 0.000001f, -0.895315f, 0.000000f, 255.000000f },
+{ 155.668289f, 9.484123f, -112.788498f, 0.872224f, -0.000001f, 0.489107f, 0.000000f, 255.000000f },
+{ 155.668289f, 9.484123f, -116.571518f, 0.821354f, 0.000001f, -0.570419f, 0.000000f, 255.000000f },
+{ 154.127060f, 9.484123f, -117.804031f, 0.488794f, 0.000002f, -0.872399f, 0.000000f, 255.000000f },
+{ 152.305023f, 9.484123f, -118.637589f, 0.117071f, 0.000003f, -0.993124f, 0.000000f, 255.000000f },
+{ 150.903000f, 9.484123f, -118.586227f, -0.347726f, 0.000002f, -0.937596f, 0.000000f, 255.000000f },
+{ 149.472794f, 9.484123f, -117.781754f, -0.743957f, 0.000001f, -0.668227f, 0.000000f, 255.000000f },
+{ 148.448669f, 9.484123f, -116.186508f, -0.922915f, 0.000001f, -0.385003f, 0.000000f, 255.000000f },
+{ 148.102249f, 9.484123f, -115.096786f, 0.319982f, 0.000002f, -0.947424f, 0.000000f, 255.000000f },
+{ 146.276031f, 9.484123f, -117.172348f, 0.536214f, 0.000002f, -0.844082f, 0.000000f, 255.000000f },
+{ 142.652115f, 9.484123f, -118.815689f, -0.095167f, 0.000003f, -0.995461f, 0.000000f, 255.000000f },
+{ 139.866501f, 9.484123f, -117.808792f, -0.663668f, 0.000002f, -0.748027f, 0.000000f, 255.000000f },
+{ 137.850311f, 9.484123f, -115.206024f, -0.935434f, 0.000001f, -0.353502f, 0.000000f, 255.000000f },
+{ 137.073761f, 9.484123f, -111.634354f, -0.994825f, 0.000000f, 0.101602f, 0.000000f, 255.000000f },
+{ 138.144791f, 9.484118f, -107.571106f, -0.821232f, -0.000001f, 0.570594f, 0.000000f, 255.000000f },
+{ 141.623840f, 9.484118f, -104.049301f, -0.614743f, -0.000001f, 0.788728f, 0.000000f, 255.000000f },
+{ 144.391052f, 9.484118f, -102.166397f, -0.533800f, -0.000001f, 0.845611f, 0.000000f, 255.000000f },
+{ 147.909882f, 9.484118f, -100.028793f, -0.946986f, 0.000000f, 0.321275f, 0.000000f, 255.000000f },
+{ 147.909882f, 9.484118f, -97.335800f, -0.985542f, 0.000000f, -0.169429f, 0.000000f, 255.000000f },
+{ 147.180527f, 9.484118f, -94.538605f, -0.721135f, 0.000001f, -0.692794f, 0.000000f, 255.000000f },
+{ 145.869064f, 9.484118f, -93.718704f, -0.178468f, 0.000002f, -0.983946f, 0.000000f, 255.000000f },
+{ 143.898575f, 9.484118f, -93.732071f, 0.275751f, 0.000003f, -0.961229f, 0.000000f, 255.000000f },
+{ 141.682312f, 9.484118f, -94.706924f, 0.547231f, 0.000002f, -0.836982f, 0.000000f, 255.000000f },
+{ 137.779068f, 9.484118f, -98.297592f, -0.401856f, 0.000002f, -0.915703f, 0.000000f, 255.000000f },
+{ 137.779068f, 9.484118f, -92.526871f, -0.805424f, -0.000001f, 0.592699f, 0.000000f, 255.000000f },
+{ 141.658264f, 9.484118f, -89.665543f, -0.393509f, -0.000002f, 0.919321f, 0.000000f, 255.000000f },
+{ 144.054428f, 9.484118f, -88.951340f, -0.070072f, -0.000003f, 0.997542f, 0.000000f, 255.000000f },
+{ 147.152328f, 9.484118f, -89.072159f, 0.314714f, -0.000002f, 0.949187f, 0.000000f, 255.000000f },
+{ 150.474655f, 9.484118f, -90.715500f, 0.737681f, -0.000002f, 0.675150f, 0.000000f, 255.000000f },
+{ 152.600082f, 9.484118f, -94.111435f, 0.963322f, 0.000000f, 0.268347f, 0.000000f, 255.000000f },
+{ 152.911179f, 9.484118f, -96.502243f, 0.999034f, 0.000000f, 0.043950f, 0.000000f, 255.000000f },
+{ 152.932556f, 9.484123f, -113.100784f, 0.988647f, 0.000000f, 0.150259f, 0.000000f, 255.000000f },
+{ 153.103531f, 9.484123f, -113.846451f, 0.722615f, -0.000001f, 0.691251f, 0.000000f, 255.000000f },
+{ 153.680603f, 9.484123f, -114.199112f, -0.065774f, -0.000002f, 0.997835f, 0.000000f, 255.000000f },
+{ 154.124680f, 9.484123f, -114.032883f, -0.508023f, -0.000002f, 0.861344f, 0.000000f, 255.000000f },
+{ 154.796753f, 9.484123f, -113.553177f, -0.634043f, -0.000002f, 0.773298f, 0.000000f, 255.000000f },
+{ 147.909882f, 9.484123f, -110.800797f, -0.988652f, 0.000000f, 0.150224f, 0.000000f, 255.000000f },
+{ 147.909882f, 9.484118f, -103.491226f, 0.063729f, 0.000001f, -0.997967f, 0.000000f, 255.000000f },
+{ 146.048050f, 9.484118f, -104.727600f, 0.606494f, 0.000001f, -0.795088f, 0.000000f, 255.000000f },
+{ 144.556686f, 9.484118f, -105.944382f, 0.698230f, 0.000002f, -0.715873f, 0.000000f, 255.000000f },
+{ 143.421539f, 9.484118f, -107.154037f, 0.856732f, 0.006809f, -0.515717f, 0.000000f, 255.000000f },
+{ 142.162918f, 9.484122f, -109.601837f, 0.996222f, 0.008519f, -0.086430f, 0.000000f, 255.000000f },
+{ 142.329147f, 9.484123f, -112.551010f, 0.896470f, -0.000001f, 0.443104f, 0.000000f, 255.000000f },
+{ 143.188812f, 9.484123f, -113.667160f, 0.487260f, -0.000002f, 0.873257f, 0.000000f, 255.000000f },
+{ 144.447449f, 9.484123f, -114.070877f, -0.092078f, -0.000002f, 0.995752f, 0.000000f, 255.000000f },
+{ 145.715591f, 9.484123f, -113.693283f, -0.563378f, -0.000001f, 0.826199f, 0.000000f, 255.000000f },
+{ 146.898224f, 9.484123f, -112.589005f, -0.789808f, -0.000001f, 0.613355f, 0.000000f, 255.000000f },
+{ 147.430771f, 9.484123f, -111.777725f, -0.878742f, -0.000001f, 0.477296f, 0.000000f, 255.000000f },
+{ 173.749878f, 9.484123f, -112.467911f, 0.866044f, -0.000001f, 0.499968f, 0.000000f, 255.000000f },
+{ 173.749878f, 9.484123f, -117.276840f, 0.738938f, 0.000002f, -0.673773f, 0.000000f, 255.000000f },
+{ 172.085159f, 9.484123f, -118.160263f, 0.289883f, 0.000003f, -0.957062f, 0.000000f, 255.000000f },
+{ 168.812698f, 9.484123f, -118.815689f, -0.052447f, 0.000003f, -0.998624f, 0.000000f, 255.000000f },
+{ 166.009262f, 9.484123f, -118.315506f, -0.398492f, 0.000002f, -0.917172f, 0.000000f, 255.000000f },
+{ 163.547806f, 9.484123f, -116.887375f, -0.667370f, 0.000002f, -0.744726f, 0.000000f, 255.000000f },
+{ 161.503128f, 9.484123f, -114.639938f, -0.842882f, 0.000001f, -0.538099f, 0.000000f, 255.000000f },
+{ 159.950012f, 9.484123f, -111.681854f, -0.942324f, 0.000000f, -0.334701f, 0.000000f, 255.000000f },
+{ 158.963303f, 9.484118f, -108.121765f, -0.989253f, 0.000000f, -0.146212f, 0.000000f, 255.000000f },
+{ 158.617767f, 9.484118f, -104.068314f, -0.998414f, 0.000000f, 0.056296f, 0.000000f, 255.000000f },
+{ 159.531387f, 9.484118f, -96.903595f, -0.905095f, -0.000001f, 0.425210f, 0.000000f, 255.000000f },
+{ 163.822617f, 9.484118f, -90.542221f, -0.501771f, -0.000002f, 0.865000f, 0.000000f, 255.000000f },
+{ 169.115997f, 9.484118f, -88.872086f, 0.060412f, -0.000003f, 0.998173f, 0.000000f, 255.000000f },
+{ 173.301041f, 9.484118f, -89.897995f, 0.917345f, -0.000001f, 0.398092f, 0.000000f, 255.000000f },
+{ 173.301041f, 9.484118f, -95.027512f, 0.153606f, 0.000003f, -0.988132f, 0.000000f, 255.000000f },
+{ 169.582138f, 9.484118f, -93.616898f, 0.141905f, 0.000002f, -0.989880f, 0.000000f, 255.000000f },
+{ 166.473557f, 9.484118f, -94.882645f, 0.742680f, 0.000001f, -0.669646f, 0.000000f, 255.000000f },
+{ 164.462112f, 9.484118f, -98.442444f, 0.967176f, 0.000000f, -0.254107f, 0.000000f, 255.000000f },
+{ 163.747299f, 9.484118f, -103.940063f, 0.998594f, 0.000000f, 0.053008f, 0.000000f, 255.000000f },
+{ 164.523849f, 9.484122f, -109.302322f, 0.912953f, -0.000001f, 0.408064f, 0.000000f, 255.000000f },
+{ 166.711029f, 9.484123f, -112.812241f, 0.468894f, -0.000002f, 0.883254f, 0.000000f, 255.000000f },
+{ 171.313354f, 9.484123f, -113.911758f, -0.280562f, -0.000002f, 0.959836f, 0.000000f, 255.000000f },
+{ 188.369019f, 9.484123f, -113.301437f, 0.869996f, -0.000001f, 0.493059f, 0.000000f, 255.000000f },
+{ 188.369019f, 9.484123f, -117.725662f, 0.673699f, 0.000002f, -0.739006f, 0.000000f, 255.000000f },
+{ 186.637802f, 9.484123f, -118.378738f, 0.251252f, 0.000003f, -0.967922f, 0.000000f, 255.000000f },
+{ 184.602036f, 9.484123f, -118.792831f, 0.027993f, 0.000002f, -0.999608f, 0.000000f, 255.000000f },
+{ 182.419891f, 9.484123f, -118.666077f, -0.249737f, 0.000002f, -0.968314f, 0.000000f, 255.000000f },
+{ 181.128311f, 9.484123f, -118.195877f, -0.534105f, 0.000002f, -0.845418f, 0.000000f, 255.000000f },
+{ 180.089645f, 9.484123f, -117.373001f, -0.779634f, 0.000001f, -0.626236f, 0.000000f, 255.000000f },
+{ 179.323486f, 9.484123f, -116.165436f, -0.929593f, 0.000001f, -0.368587f, 0.000000f, 255.000000f },
+{ 178.849426f, 9.484123f, -114.541092f, -0.989265f, 0.000000f, -0.146131f, 0.000000f, 255.000000f },
+{ 178.687042f, 9.484123f, -112.467911f, -0.999661f, 0.000000f, -0.026047f, 0.000000f, 255.000000f },
+{ 178.687042f, 9.484118f, -94.001602f, -0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 175.416977f, 9.484118f, -94.001602f, -0.996832f, -0.000001f, 0.079535f, 0.000000f, 255.000000f },
+{ 178.200211f, 9.484118f, -89.945480f, -0.823749f, -0.000001f, 0.566955f, 0.000000f, 255.000000f },
+{ 180.755478f, 9.484117f, -86.238449f, -0.837145f, -0.000001f, 0.546981f, 0.000000f, 255.000000f },
+{ 183.239502f, 9.484117f, -82.331924f, -0.315664f, -0.000001f, 0.948871f, 0.000000f, 255.000000f },
+{ 183.688324f, 9.484117f, -82.331924f, 0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 183.688324f, 9.484118f, -89.641510f, 0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 188.369019f, 9.484118f, -89.641510f, 0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 188.369019f, 9.484118f, -94.001602f, 0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 183.688324f, 9.484118f, -94.001602f, 0.896316f, -0.004678f, -0.443391f, 0.000000f, 255.000000f },
+{ 183.724243f, 9.484123f, -111.466034f, 0.997969f, -0.005230f, 0.063485f, 0.000000f, 255.000000f },
+{ 183.847443f, 9.484123f, -112.446518f, 0.909068f, 0.001063f, 0.416646f, 0.000000f, 255.000000f },
+{ 184.448257f, 9.484123f, -113.686172f, 0.726480f, -0.015559f, 0.687011f, 0.000000f, 255.000000f },
+{ 184.972198f, 9.484123f, -113.977371f, 0.170193f, -0.000003f, 0.985411f, 0.000000f, 255.000000f },
+{ 186.488205f, 9.484123f, -113.985397f, -0.229252f, -0.000002f, 0.973367f, 0.000000f, 255.000000f },
+{ 192.280289f, 9.484123f, -118.046249f, -0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 192.280289f, 9.484118f, -89.641510f, -0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 197.281570f, 9.484118f, -89.641510f, 0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 197.281570f, 9.484123f, -118.046249f, 0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 209.400085f, 9.484123f, -118.687454f, -0.775277f, 0.000002f, -0.631621f, 0.000000f, 255.000000f },
+{ 200.872238f, 9.484118f, -89.641510f, -0.487542f, -0.000001f, 0.873100f, 0.000000f, 255.000000f },
+{ 205.873535f, 9.484118f, -89.641510f, 0.791121f, -0.000001f, 0.611659f, 0.000000f, 255.000000f },
+{ 210.041275f, 9.484118f, -105.863632f, 0.395561f, -0.000001f, 0.918440f, 0.000000f, 255.000000f },
+{ 210.169510f, 9.484118f, -105.863632f, -0.791121f, -0.000001f, 0.611659f, 0.000000f, 255.000000f },
+{ 214.337250f, 9.484118f, -89.641510f, -0.395561f, -0.000001f, 0.918440f, 0.000000f, 255.000000f },
+{ 219.338531f, 9.484118f, -89.641510f, 0.975084f, 0.000000f, 0.221838f, 0.000000f, 255.000000f },
+{ 210.810699f, 9.484123f, -118.687454f, 0.387639f, 0.000002f, -0.921811f, 0.000000f, 255.000000f },
+{ -227.530014f, 20.966755f, 18.889763f, -0.132902f, 0.000004f, -0.991129f, 11.312366f, 104.759421f },
+{ -227.530014f, 20.966747f, 49.094074f, -0.113407f, 0.000000f, 0.993549f, 24.483732f, 68.571394f },
+{ -220.271423f, 20.966747f, 49.922592f, -0.196555f, 0.000000f, 0.980493f, 33.541610f, 70.744042f },
+{ -214.348251f, 20.966747f, 52.198406f, -0.441307f, 0.000000f, 0.897356f, 41.630631f, 70.600318f },
+{ -209.753510f, 20.966751f, 55.606876f, -0.666260f, 0.000000f, 0.745720f, 48.621982f, 68.520264f },
+{ -206.480209f, 20.966751f, 59.833382f, -0.841668f, 0.000000f, 0.539995f, 54.386827f, 64.883844f },
+{ -204.521362f, 20.966751f, 64.563332f, -0.953587f, 0.000000f, 0.301119f, 58.796350f, 60.071068f },
+{ -203.869965f, 20.966747f, 69.482018f, -0.999275f, 0.000000f, 0.038078f, 61.721714f, 54.462006f },
+{ -204.699646f, 20.966745f, 74.975189f, -0.968387f, 0.000000f, -0.249452f, 63.123110f, 47.518791f },
+{ -207.067520f, 20.966745f, 79.783180f, -0.849701f, 0.000000f, -0.527265f, 62.382784f, 40.725728f },
+{ -210.791794f, 20.966745f, 83.766144f, -0.667060f, 0.000001f, -0.745004f, 59.657578f, 34.329638f },
+{ -215.690674f, 20.966745f, 86.784241f, -0.455510f, 0.000001f, -0.890230f, 55.104305f, 28.577339f },
+{ -221.582382f, 20.966745f, 88.697647f, -0.240248f, 0.000001f, -0.970712f, 48.879791f, 23.715652f },
+{ -228.285126f, 20.966745f, 89.366524f, -0.052076f, 0.000001f, -0.998643f, 41.140860f, 19.991366f },
+{ -233.272552f, 20.966745f, 89.153275f, 0.072102f, 0.000001f, -0.997397f, 35.072392f, 18.071967f },
+{ -238.232040f, 20.966745f, 88.499550f, 0.159415f, 0.000001f, -0.987212f, 28.845318f, 16.692474f },
+{ -243.261429f, 20.966745f, 87.384369f, 0.242432f, 0.000001f, -0.970168f, 22.333258f, 15.835392f },
+{ -248.458618f, 20.966745f, 85.786751f, 0.315709f, 0.000001f, -0.948856f, 15.409784f, 15.483151f },
+{ -253.921509f, 20.966745f, 83.685738f, 0.376381f, 0.000001f, -0.926465f, 7.948449f, 15.618150f },
+{ -259.747955f, 20.966745f, 81.060341f, 0.410820f, 0.000001f, -0.911717f, -0.177137f, 16.222895f },
+{ -259.747955f, 20.966743f, 111.264641f, -0.366218f, -0.000001f, 0.930529f, 12.994218f, -19.965132f },
+{ -253.885376f, 20.966743f, 113.571915f, -0.341209f, -0.000001f, 0.939987f, 21.024369f, -20.172966f },
+{ -247.666229f, 20.966742f, 115.459694f, -0.267103f, -0.000001f, 0.963668f, 29.298793f, -19.722705f },
+{ -241.153412f, 20.966742f, 116.927956f, -0.197940f, -0.000001f, 0.980214f, 37.742128f, -18.641769f },
+{ -234.409882f, 20.966742f, 117.976715f, -0.132733f, -0.000001f, 0.991152f, 46.278944f, -16.957608f },
+{ -227.498550f, 20.966742f, 118.605980f, -0.070438f, -0.000001f, 0.997516f, 54.833877f, -14.697672f },
+{ -220.482346f, 20.966742f, 118.815727f, 0.010033f, -0.000001f, 0.999950f, 63.331513f, -11.889380f },
+{ -205.143631f, 20.966742f, 117.432526f, 0.155949f, -0.000001f, 0.987765f, 81.105774f, -3.543295f },
+{ -191.825546f, 20.966743f, 113.455399f, 0.359337f, -0.000001f, 0.933208f, 95.327947f, 7.029410f },
+{ -180.870651f, 20.966740f, 107.143021f, 0.575202f, -0.000001f, 0.818011f, 105.700425f, 19.369491f },
+{ -172.621567f, 20.966740f, 98.754097f, 0.780436f, -0.000001f, 0.625235f, 111.925517f, 33.017553f },
+{ -167.420868f, 20.966738f, 88.547325f, 0.933968f, 0.000000f, 0.357358f, 113.705593f, 47.514262f },
+{ -165.611176f, 20.966738f, 76.781395f, 0.997415f, 0.000000f, 0.071862f, 110.742960f, 62.400282f },
+{ -166.340637f, 20.966747f, 68.696609f, 0.988370f, 0.000000f, -0.152067f, 106.343412f, 71.768634f },
+{ -168.510422f, 20.966751f, 61.101219f, 0.941956f, 0.000000f, -0.335737f, 100.431613f, 79.922540f },
+{ -172.092514f, 20.966747f, 54.065197f, 0.860949f, 0.000000f, -0.508692f, 93.071636f, 86.790398f },
+{ -177.058975f, 20.966749f, 47.658436f, 0.752871f, 0.000000f, -0.658168f, 84.327446f, 92.300634f },
+{ -183.381851f, 20.966749f, 41.950848f, 0.629290f, 0.000000f, -0.777170f, 74.263017f, 96.381691f },
+{ -191.033142f, 20.966749f, 37.012348f, 0.889699f, 0.000000f, -0.456548f, 62.942388f, 98.962011f },
+{ -181.454453f, 20.966749f, 32.298752f, 0.502007f, 0.000000f, 0.864864f, 72.363211f, 108.786445f },
+{ -173.805496f, 20.966751f, 26.319649f, 0.672072f, -0.000002f, 0.740485f, 78.920146f, 119.285570f },
+{ -168.002350f, 20.966755f, 19.235847f, 0.817837f, -0.000002f, 0.575450f, 82.783870f, 130.303345f },
+{ -163.961121f, 20.966755f, 11.208177f, 0.921693f, -0.000001f, 0.387921f, 84.125031f, 141.683643f },
+{ -161.597916f, 20.966753f, 2.397416f, 0.979689f, 0.000000f, 0.200522f, 83.114247f, 153.270422f },
+{ -160.828827f, 20.966753f, -7.035606f, 0.999954f, 0.000000f, 0.009609f, 79.922183f, 164.907587f },
+{ -162.772522f, 20.966755f, -21.426933f, 0.973138f, 0.000000f, -0.230221f, 71.317727f, 181.302347f },
+{ -168.407867f, 20.966755f, -33.734711f, 0.862300f, 0.000000f, -0.506399f, 59.198847f, 193.590963f },
+{ -177.441193f, 20.966757f, -43.721252f, 0.674528f, 0.000000f, -0.738249f, 44.021060f, 201.616710f },
+{ -189.578857f, 20.966757f, -51.148804f, 0.449703f, 0.000000f, -0.893178f, 26.239853f, 205.222777f },
+{ -204.527191f, 20.966757f, -55.779663f, 0.228732f, 0.000000f, -0.973489f, 6.310730f, 204.252446f },
+{ -221.992554f, 20.966764f, -57.376114f, 0.046891f, 0.000000f, -0.998900f, -15.310837f, 198.548949f },
+{ -229.371170f, 20.966764f, -57.068481f, -0.067655f, 0.000000f, -0.997709f, -24.017065f, 194.962735f },
+{ -236.805725f, 20.966764f, -56.173538f, -0.143976f, 0.000000f, -0.989581f, -32.534211f, 190.648469f },
+{ -244.142380f, 20.966764f, -54.733246f, -0.216746f, 0.000000f, -0.976228f, -40.696227f, 185.723508f },
+{ -251.227341f, 20.966764f, -52.789536f, -0.289503f, 0.000000f, -0.957177f, -48.337180f, 180.305151f },
+{ -257.906799f, 20.966764f, -50.384384f, -0.365851f, 0.000000f, -0.930674f, -55.291061f, 174.510773f },
+{ -264.026886f, 20.966764f, -47.559723f, -0.419059f, 0.000000f, -0.907959f, -61.391828f, 168.457698f },
+{ -264.026886f, 20.966753f, -14.334975f, 0.543307f, 0.000000f, 0.839534f, -46.903330f, 128.650867f },
+{ -257.339294f, 20.966755f, -18.662872f, 0.522722f, 0.000000f, 0.852503f, -40.778150f, 136.752450f },
+{ -251.050217f, 20.966759f, -22.109795f, 0.453797f, 0.000000f, 0.891105f, -34.746278f, 143.624746f },
+{ -245.054810f, 20.966759f, -24.717712f, 0.365635f, 0.000000f, 0.930758f, -28.700388f, 149.363761f },
+{ -239.248169f, 20.966759f, -26.528572f, 0.259367f, 0.000000f, 0.965779f, -22.533070f, 154.065507f },
+{ -233.525421f, 20.966759f, -27.584328f, 0.141032f, 0.000000f, 0.990005f, -16.136991f, 157.825968f },
+{ -227.781708f, 20.966759f, -27.926926f, 0.007245f, 0.000000f, 0.999974f, -9.404798f, 160.741125f },
+{ -220.280746f, 20.966759f, -27.192787f, -0.168689f, 0.000000f, 0.985669f, -0.097693f, 163.132535f },
+{ -213.751633f, 20.966759f, -25.074295f, -0.385508f, 0.000000f, 0.922705f, 8.648710f, 163.441542f },
+{ -208.369156f, 20.966755f, -21.697281f, -0.607191f, 0.000000f, 0.794556f, 16.570136f, 161.742676f },
+{ -204.308121f, 20.966755f, -17.187607f, -0.805587f, 0.000000f, 0.592477f, 23.402251f, 158.110519f },
+{ -201.743317f, 20.966753f, -11.671119f, -0.943840f, 0.000000f, 0.330403f, 28.880766f, 152.619616f },
+{ -200.849533f, 20.966753f, -5.273689f, -0.998820f, 0.000000f, 0.048575f, 32.741376f, 145.344564f },
+{ -201.724655f, 20.966753f, 1.288060f, -0.974605f, 0.000000f, -0.223930f, 34.554308f, 137.101256f },
+{ -204.242859f, 20.966751f, 7.031769f, -0.873964f, 0.000000f, -0.485991f, 34.041921f, 129.121548f },
+{ -208.243301f, 20.966755f, 11.810632f, -0.706060f, 0.000000f, -0.708152f, 31.332898f, 121.651460f },
+{ -213.565170f, 20.966755f, 15.477799f, -0.497756f, 0.000000f, -0.867317f, 26.555888f, 114.937053f },
+{ -220.047684f, 20.966755f, 17.886444f, -0.278017f, 0.000003f, -0.960576f, 19.839494f, 109.224379f },
+{ -148.686584f, 20.966726f, 116.550392f, 0.000000f, -0.000001f, 1.000000f, 148.362750f, 22.133128f },
+{ -72.924095f, 20.966726f, 116.550392f, 0.035820f, -0.000001f, 0.999358f, 239.134392f, 55.171292f },
+{ -44.133286f, 20.966728f, 113.442566f, 0.188416f, -0.000001f, 0.982089f, 272.273660f, 71.449770f },
+{ -20.467419f, 20.966740f, 104.692406f, 0.431738f, -0.000001f, 0.901999f, 296.812196f, 92.253517f },
+{ -1.975434f, 20.966738f, 91.159897f, 0.665230f, -0.000001f, 0.746638f, 313.066387f, 116.530840f },
+{ 11.293716f, 20.966730f, 73.705025f, 0.848586f, 0.000000f, 0.529057f, 321.352617f, 143.230008f },
+{ 19.291100f, 20.966740f, 53.187733f, 0.959076f, 0.000000f, 0.283149f, 321.987274f, 171.299414f },
+{ 21.967770f, 20.966734f, 30.467978f, 0.999154f, 0.000000f, 0.041134f, 315.286714f, 199.687280f },
+{ 19.338877f, 20.966743f, 6.999154f, 0.980586f, 0.000000f, -0.196088f, 301.902798f, 226.659158f },
+{ 11.340330f, 20.966745f, -13.645118f, 0.892215f, 0.000000f, -0.451610f, 283.317205f, 247.905264f },
+{ -2.195676f, 20.966759f, -30.821503f, 0.718364f, 0.000000f, -0.695667f, 259.609396f, 262.581703f },
+{ -21.436935f, 20.966757f, -43.886719f, 0.483336f, 0.000000f, -0.875435f, 230.858877f, 269.844599f },
+{ -46.551262f, 20.966757f, -52.197571f, 0.241852f, 0.000000f, -0.970313f, 197.145034f, 268.850158f },
+{ -77.706444f, 20.966757f, -55.110794f, 0.062127f, 0.000000f, -0.998068f, 158.547374f, 258.754495f },
+{ -148.686584f, 20.966757f, -55.110794f, 0.000000f, 0.000000f, -1.000000f, 73.505490f, 227.801797f },
+{ -105.897141f, 20.966738f, 85.087578f, 0.447214f, 0.000001f, -0.894427f, 185.908961f, 78.488406f },
+{ -105.897141f, 20.966759f, -23.647980f, 0.894427f, 0.000000f, 0.447214f, 138.492035f, 208.765369f },
+{ -77.958153f, 20.966759f, -23.647980f, -0.039593f, 0.000000f, 0.999216f, 171.965959f, 220.948887f },
+{ -58.874207f, 20.966755f, -21.368675f, -0.212191f, 0.000000f, 0.977228f, 195.824544f, 226.540074f },
+{ -44.341877f, 20.966753f, -15.146018f, -0.488613f, 0.000000f, 0.872501f, 215.949404f, 225.421851f },
+{ -33.878738f, 20.966745f, -5.902946f, -0.733828f, 0.000000f, 0.679335f, 232.516059f, 218.910365f },
+{ -27.002363f, 20.966743f, 5.437653f, -0.895536f, 0.000000f, 0.444989f, 245.700045f, 208.321724f },
+{ -23.230320f, 20.966747f, 17.952866f, -0.974747f, -0.000001f, 0.223313f, 255.676941f, 194.972041f },
+{ -22.080179f, 20.966734f, 30.719679f, -0.999602f, 0.000000f, 0.028209f, 262.622269f, 180.177478f },
+{ -23.442402f, 20.966742f, 44.972439f, -0.985715f, 0.000000f, -0.168424f, 267.205431f, 162.507187f },
+{ -27.692215f, 20.966743f, 57.903660f, -0.917976f, 0.000000f, -0.396636f, 267.752663f, 145.160943f },
+{ -35.074326f, 20.966740f, 68.947144f, -0.770297f, 0.000000f, -0.637685f, 263.723906f, 128.710501f },
+{ -45.833443f, 20.966738f, 77.536499f, -0.541864f, 0.000001f, -0.840466f, 254.578922f, 113.727730f },
+{ -60.214287f, 20.966738f, 83.105423f, -0.278852f, 0.000001f, -0.960334f, 239.777591f, 100.784424f },
+{ -78.461555f, 20.966738f, 85.087578f, -0.072088f, 0.000001f, -0.997398f, 218.779751f, 90.452398f },
+{ 53.459190f, 21.106728f, -63.834198f, 0.000000f, 0.000000f, -1.000000f, 0.000000f, 255.000000f },
+{ 53.459190f, 21.106720f, 19.696632f, 0.000000f, 0.000010f, -1.000000f, 0.000000f, 255.000000f },
+{ 34.431496f, 21.106720f, 19.696632f, 0.000000f, 0.000010f, -1.000000f, 0.000000f, 255.000000f },
+{ 34.431496f, 21.106718f, 37.767292f, 0.000000f, 0.000000f, 1.000000f, 0.000000f, 255.000000f },
+{ 53.459190f, 21.106718f, 37.767292f, -0.447214f, 0.000000f, 0.894427f, 0.000000f, 255.000000f },
+{ 53.459190f, 21.106716f, 52.887684f, -0.998610f, 0.000000f, 0.052712f, 0.000000f, 255.000000f },
+{ 54.761124f, 21.106716f, 61.040321f, -0.964760f, 0.000000f, 0.263130f, 0.000000f, 255.000000f },
+{ 58.744659f, 21.106709f, 68.629570f, -0.832175f, -0.000001f, 0.554513f, 0.000000f, 255.000000f },
+{ 65.526382f, 21.106707f, 75.245590f, -0.629247f, -0.000001f, 0.777205f, 0.000000f, 255.000000f },
+{ 75.222885f, 21.106714f, 80.478653f, -0.406003f, -0.000001f, 0.913872f, 0.000000f, 255.000000f },
+{ 87.950760f, 21.106714f, 83.918983f, -0.200640f, -0.000002f, 0.979665f, 0.000000f, 255.000000f },
+{ 103.826599f, 21.106714f, 85.156822f, -0.046194f, -0.000002f, 0.998932f, 0.000000f, 255.000000f },
+{ 107.486267f, 21.106707f, 85.094505f, 0.027667f, -0.000002f, 0.999617f, 0.000000f, 255.000000f },
+{ 111.371353f, 21.106707f, 84.904137f, 0.059760f, -0.000002f, 0.998213f, 0.000000f, 255.000000f },
+{ 115.334160f, 21.106707f, 84.580589f, 0.093534f, -0.000002f, 0.995616f, 0.000000f, 255.000000f },
+{ 119.227013f, 21.106707f, 84.118752f, 0.132736f, -0.000002f, 0.991151f, 0.000000f, 255.000000f },
+{ 122.902229f, 21.106707f, 83.513496f, 0.182424f, -0.000002f, 0.983220f, 0.000000f, 255.000000f },
+{ 126.212128f, 21.106707f, 82.759697f, 0.675942f, -0.000001f, 0.736955f, 0.000000f, 255.000000f },
+{ 114.179916f, 21.106716f, 65.426567f, 0.550632f, 0.000001f, -0.834748f, 0.000000f, 255.000000f },
+{ 112.235428f, 21.106709f, 65.933655f, -0.237575f, 0.000002f, -0.971369f, 0.000000f, 255.000000f },
+{ 110.283180f, 21.106709f, 66.348541f, -0.191361f, 0.000002f, -0.981520f, 0.000000f, 255.000000f },
+{ 108.268738f, 21.106709f, 66.671227f, -0.141331f, 0.000002f, -0.989962f, 0.000000f, 255.000000f },
+{ 106.137703f, 21.106709f, 66.901718f, -0.091701f, 0.000002f, -0.995787f, 0.000000f, 255.000000f },
+{ 103.835670f, 21.106709f, 67.040016f, -0.046066f, 0.000002f, -0.998938f, 0.000000f, 255.000000f },
+{ 101.308228f, 21.106709f, 67.086113f, 0.018743f, 0.000002f, -0.999824f, 0.000000f, 255.000000f },
+{ 95.838806f, 21.106709f, 66.577324f, 0.159913f, 0.000002f, -0.987131f, 0.000000f, 255.000000f },
+{ 91.224388f, 21.106716f, 65.167046f, 0.363788f, 0.000001f, -0.931482f, 0.000000f, 255.000000f },
+{ 87.527145f, 21.106716f, 63.029400f, 0.572373f, 0.000000f, -0.819993f, 0.000000f, 255.000000f },
+{ 84.809280f, 21.106716f, 60.338608f, 0.768792f, 0.000000f, -0.639499f, 0.000000f, 255.000000f },
+{ 83.132957f, 21.106716f, 57.268780f, 0.924396f, 0.000000f, -0.381433f, 0.000000f, 255.000000f },
+{ 82.560364f, 21.106716f, 53.994068f, 0.993341f, 0.000000f, -0.115210f, 0.000000f, 255.000000f },
+{ 82.560364f, 21.106718f, 37.767292f, 0.894427f, 0.000000f, 0.447214f, 0.000000f, 255.000000f },
+{ 111.661545f, 21.106718f, 37.767292f, 0.000000f, 0.000000f, 1.000000f, 0.000000f, 255.000000f },
+{ 111.661545f, 21.106720f, 19.696632f, 0.000000f, 0.000010f, -1.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 21.106720f, 19.696632f, 0.000000f, 0.000010f, -1.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 21.106728f, -63.834198f, 0.000000f, 0.000000f, -1.000000f, 0.000000f, 255.000000f },
+{ 109.261765f, 21.106724f, -33.040283f, -0.468379f, 0.000000f, -0.883527f, 0.000000f, 255.000000f },
+{ 158.509918f, 21.106720f, 10.661286f, -0.933984f, 0.000000f, 0.357316f, 0.000000f, 255.000000f },
+{ 110.660858f, 21.106716f, 56.206806f, -0.950931f, 0.000000f, -0.309402f, 0.000000f, 255.000000f },
+{ 147.037323f, 21.106716f, 56.206806f, 0.264544f, 0.000000f, 0.964374f, 0.000000f, 255.000000f },
+{ 175.299042f, 21.106712f, 25.597252f, 0.337904f, -0.000006f, 0.941181f, 0.000000f, 255.000000f },
+{ 203.001129f, 21.106716f, 56.206806f, -0.534949f, -0.000002f, 0.844884f, 0.000000f, 255.000000f },
+{ 237.139038f, 21.106712f, 56.206806f, 0.473674f, 0.000000f, 0.880700f, 0.000000f, 255.000000f },
+{ 189.569809f, 21.106720f, 11.767655f, 0.942807f, 0.000000f, -0.333339f, 0.000000f, 255.000000f },
+{ 239.097778f, 21.106724f, -33.040283f, 0.940870f, 0.000000f, 0.338768f, 0.000000f, 255.000000f },
+{ 202.161682f, 21.106724f, -33.040283f, -0.259495f, 0.000000f, -0.965744f, 0.000000f, 255.000000f },
+{ 173.620132f, 21.106722f, -3.168342f, -0.333727f, 0.000000f, -0.942670f, 0.000000f, 255.000000f },
+{ 143.679504f, 21.106724f, -33.040283f, 0.504764f, 0.000000f, -0.863257f, 0.000000f, 255.000000f },
+{ 246.695496f, 21.106710f, 44.635105f, -0.447214f, 0.000000f, -0.894427f, 0.000000f, 255.000000f },
+{ 246.695496f, 21.106709f, 54.095203f, -0.894427f, 0.000000f, -0.447214f, 0.000000f, 255.000000f },
+{ 243.335144f, 21.106709f, 54.095203f, -0.447214f, 0.000000f, -0.894427f, 0.000000f, 255.000000f },
+{ 243.335144f, 21.106712f, 56.104115f, -0.894427f, 0.000000f, 0.447214f, 0.000000f, 255.000000f },
+{ 252.174316f, 21.106712f, 56.104115f, 0.447214f, 0.000000f, 0.894427f, 0.000000f, 255.000000f },
+{ 252.174316f, 21.106709f, 54.095203f, 0.894427f, 0.000000f, -0.447214f, 0.000000f, 255.000000f },
+{ 248.813965f, 21.106709f, 54.095203f, 0.447214f, 0.000000f, -0.894427f, 0.000000f, 255.000000f },
+{ 248.813965f, 21.106710f, 44.635105f, 0.894427f, 0.000000f, -0.447214f, 0.000000f, 255.000000f },
+{ 253.836212f, 21.106710f, 44.635105f, -0.447214f, 0.000000f, -0.894427f, 0.000000f, 255.000000f },
+{ 253.836212f, 21.106712f, 56.341526f, -0.877850f, 0.000000f, 0.478935f, 0.000000f, 255.000000f },
+{ 258.931549f, 21.106709f, 51.191425f, 0.319282f, 0.000000f, 0.947660f, 0.000000f, 255.000000f },
+{ 264.026886f, 21.106712f, 56.341526f, -0.287199f, 0.000000f, 0.957871f, 0.000000f, 255.000000f },
+{ 264.026886f, 21.106710f, 44.635105f, 0.894427f, 0.000000f, -0.447214f, 0.000000f, 255.000000f },
+{ 261.908356f, 21.106710f, 44.635105f, -0.447214f, 0.000000f, -0.894427f, 0.000000f, 255.000000f },
+{ 261.908356f, 21.106709f, 51.721058f, -0.879075f, 0.000000f, -0.476683f, 0.000000f, 255.000000f },
+{ 258.931549f, 21.106709f, 48.634647f, 0.326650f, 0.000000f, -0.945145f, 0.000000f, 255.000000f },
+{ 255.954681f, 21.106709f, 51.721058f, -0.301802f, 0.000000f, -0.953371f, 0.000000f, 255.000000f },
+{ 255.954681f, 21.106710f, 44.635105f, 0.894427f, 0.000000f, -0.447214f, 0.000000f, 255.000000f },
+{ 53.398365f, 21.091320f, -118.046234f, -0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 53.398365f, 21.091311f, -89.641495f, -0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 58.399651f, 21.091311f, -89.641495f, 0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 58.399651f, 21.091320f, -118.046234f, 0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 64.683319f, 21.091320f, -118.046234f, -0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 64.683319f, 21.091311f, -89.641495f, -0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 69.684608f, 21.091311f, -89.641495f, 0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 69.684608f, 21.091311f, -92.719193f, 0.887750f, -0.000001f, 0.460327f, 0.000000f, 255.000000f },
+{ 71.361206f, 21.091311f, -90.693512f, -0.656342f, -0.000001f, 0.754463f, 0.000000f, 255.000000f },
+{ 75.070610f, 21.091311f, -89.192642f, -0.164366f, -0.000002f, 0.986400f, 0.000000f, 255.000000f },
+{ 78.221947f, 21.091311f, -90.116440f, 0.467430f, -0.000002f, 0.884030f, 0.000000f, 255.000000f },
+{ 80.447113f, 21.091311f, -92.906815f, 0.854905f, -0.000001f, 0.518785f, 0.000000f, 255.000000f },
+{ 81.069901f, 21.091311f, -95.010880f, 0.975826f, 0.000000f, 0.218549f, 0.000000f, 255.000000f },
+{ 81.290161f, 21.091311f, -97.592255f, 0.998390f, 0.000000f, 0.056724f, 0.000000f, 255.000000f },
+{ 81.290161f, 21.091320f, -118.046234f, 0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 76.288872f, 21.091320f, -118.046234f, -0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 76.288872f, 21.091311f, -97.720490f, -0.999299f, 0.000000f, -0.037426f, 0.000000f, 255.000000f },
+{ 76.046646f, 21.091311f, -95.573685f, -0.953521f, 0.000001f, -0.301328f, 0.000000f, 255.000000f },
+{ 74.507790f, 21.091311f, -93.751633f, -0.528723f, 0.000002f, -0.848795f, 0.000000f, 255.000000f },
+{ 72.154381f, 21.091311f, -93.999207f, 0.303533f, 0.000002f, -0.952821f, 0.000000f, 255.000000f },
+{ 70.869621f, 21.091311f, -95.136734f, 0.730358f, 0.000001f, -0.683065f, 0.000000f, 255.000000f },
+{ 69.684608f, 21.091311f, -97.015182f, 0.929606f, 0.000001f, -0.368555f, 0.000000f, 255.000000f },
+{ 69.684608f, 21.091320f, -118.046234f, 0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 116.042702f, 21.091320f, -111.377853f, -0.239564f, -0.000003f, 0.970881f, 0.000000f, 255.000000f },
+{ 116.042702f, 21.091320f, -116.315018f, 0.945756f, 0.000001f, -0.324877f, 0.000000f, 255.000000f },
+{ 112.247803f, 21.091320f, -118.552063f, 0.339296f, 0.000002f, -0.940680f, 0.000000f, 255.000000f },
+{ 107.574234f, 21.091320f, -118.394440f, -0.247366f, 0.000001f, -0.968922f, 0.000000f, 255.000000f },
+{ 103.539482f, 21.091320f, -115.040665f, -0.746247f, 0.000001f, -0.665669f, 0.000000f, 255.000000f },
+{ 102.209610f, 21.091320f, -112.118790f, -0.936927f, 0.000000f, -0.349526f, 0.000000f, 255.000000f },
+{ 101.385559f, 21.091312f, -108.374054f, -0.986407f, 0.000000f, -0.164321f, 0.000000f, 255.000000f },
+{ 101.102959f, 21.091311f, -103.811798f, -0.999732f, 0.000000f, -0.023155f, 0.000000f, 255.000000f },
+{ 101.339844f, 21.091307f, -99.454666f, -0.995145f, 0.000000f, 0.098417f, 0.000000f, 255.000000f },
+{ 102.036247f, 21.091311f, -95.777908f, -0.969592f, -0.000001f, 0.244727f, 0.000000f, 255.000000f },
+{ 103.170799f, 21.091311f, -92.831406f, -0.899584f, -0.000001f, 0.436747f, 0.000000f, 255.000000f },
+{ 104.722122f, 21.091311f, -90.665024f, -0.716919f, -0.000001f, 0.697157f, 0.000000f, 255.000000f },
+{ 107.933678f, 21.091311f, -88.927628f, -0.281539f, -0.000002f, 0.959550f, 0.000000f, 255.000000f },
+{ 111.632736f, 21.091311f, -89.470505f, 0.315299f, -0.000002f, 0.948992f, 0.000000f, 255.000000f },
+{ 113.549179f, 21.091311f, -91.009354f, 0.701500f, -0.000002f, 0.712669f, 0.000000f, 255.000000f },
+{ 114.952675f, 21.091311f, -93.103912f, 0.890786f, -0.000001f, 0.454424f, 0.000000f, 255.000000f },
+{ 116.387047f, 21.091307f, -99.154861f, 0.985821f, 0.000000f, 0.167802f, 0.000000f, 255.000000f },
+{ 116.619774f, 21.091309f, -104.965942f, 0.908369f, 0.000001f, -0.418169f, 0.000000f, 255.000000f },
+{ 106.104248f, 21.091312f, -104.965942f, 0.465868f, 0.000001f, -0.884854f, 0.000000f, 255.000000f },
+{ 106.676575f, 21.091320f, -110.009979f, 0.971167f, 0.000000f, 0.238399f, 0.000000f, 255.000000f },
+{ 108.374535f, 21.091320f, -113.130447f, 0.745484f, -0.000001f, 0.666523f, 0.000000f, 255.000000f },
+{ 111.169655f, 21.091320f, -114.199097f, 0.156933f, -0.000001f, 0.987609f, 0.000000f, 255.000000f },
+{ 113.774490f, 21.091320f, -113.485764f, -0.413582f, -0.000002f, 0.910467f, 0.000000f, 255.000000f },
+{ 106.040123f, 21.091307f, -101.247040f, 0.916229f, -0.000001f, 0.400654f, 0.000000f, 255.000000f },
+{ 111.618484f, 21.091307f, -101.247040f, -0.458820f, -0.000001f, 0.888529f, 0.000000f, 255.000000f },
+{ 111.312141f, 21.091311f, -96.746841f, -0.987291f, 0.000000f, -0.158925f, 0.000000f, 255.000000f },
+{ 110.364601f, 21.091311f, -94.098953f, -0.833881f, 0.000001f, -0.551945f, 0.000000f, 255.000000f },
+{ 108.733131f, 21.091311f, -93.232162f, -0.164167f, 0.000002f, -0.986433f, 0.000000f, 255.000000f },
+{ 107.208519f, 21.091311f, -94.113205f, 0.689773f, 0.000001f, -0.724025f, 0.000000f, 255.000000f },
+{ 106.325096f, 21.091311f, -96.775330f, 0.972507f, 0.000000f, -0.232875f, 0.000000f, 255.000000f },
+{ 122.262253f, 21.091320f, -118.046234f, -0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 122.262253f, 21.091311f, -89.641495f, -0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 127.263535f, 21.091311f, -89.641495f, 0.444200f, -0.000001f, 0.895928f, 0.000000f, 255.000000f },
+{ 127.391785f, 21.091311f, -97.335770f, 0.953952f, -0.000001f, 0.299959f, 0.000000f, 255.000000f },
+{ 128.306671f, 21.091311f, -94.372635f, -0.949849f, -0.000001f, 0.312709f, 0.000000f, 255.000000f },
+{ 129.111130f, 21.091311f, -92.203873f, -0.922966f, -0.000001f, 0.384882f, 0.000000f, 255.000000f },
+{ 129.876404f, 21.091311f, -90.715469f, -0.819365f, -0.000002f, 0.573272f, 0.000000f, 255.000000f },
+{ 131.574371f, 21.091311f, -89.323868f, -0.451781f, -0.000002f, 0.892129f, 0.000000f, 255.000000f },
+{ 133.556717f, 21.091311f, -89.280518f, 0.124905f, -0.000001f, 0.992169f, 0.000000f, 255.000000f },
+{ 135.214310f, 21.091311f, -90.026199f, 0.720568f, -0.000001f, 0.693384f, 0.000000f, 255.000000f },
+{ 134.829590f, 21.091311f, -95.155716f, 0.837365f, 0.000001f, -0.546645f, 0.000000f, 255.000000f },
+{ 132.649551f, 21.091311f, -94.450424f, -0.087364f, 0.000002f, -0.996176f, 0.000000f, 255.000000f },
+{ 130.914764f, 21.091311f, -95.135239f, 0.525644f, 0.000002f, -0.850705f, 0.000000f, 255.000000f },
+{ 129.543335f, 21.091311f, -96.915436f, 0.842037f, 0.000001f, -0.539420f, 0.000000f, 255.000000f },
+{ 128.513855f, 21.091307f, -99.379562f, 0.939937f, 0.000001f, -0.341349f, 0.000000f, 255.000000f },
+{ 127.804985f, 21.091307f, -102.116196f, 0.975653f, 0.000001f, -0.219322f, 0.000000f, 255.000000f },
+{ 127.395340f, 21.091309f, -104.713913f, 0.994216f, 0.000000f, -0.107397f, 0.000000f, 255.000000f },
+{ 127.263535f, 21.091320f, -118.046234f, 0.890868f, 0.000001f, -0.454263f, 0.000000f, 255.000000f },
+{ 155.668289f, 21.091312f, -112.788467f, -0.207596f, -0.000003f, 0.978215f, 0.000000f, 255.000000f },
+{ 155.668289f, 21.091312f, -116.571503f, 0.958465f, 0.000000f, -0.285210f, 0.000000f, 255.000000f },
+{ 154.127060f, 21.091320f, -117.804016f, 0.558773f, 0.000001f, -0.829321f, 0.000000f, 255.000000f },
+{ 152.305023f, 21.091320f, -118.637558f, 0.271646f, 0.000002f, -0.962397f, 0.000000f, 255.000000f },
+{ 150.903000f, 21.091320f, -118.586197f, -0.192636f, 0.000003f, -0.981270f, 0.000000f, 255.000000f },
+{ 149.472794f, 21.091320f, -117.781738f, -0.623712f, 0.000001f, -0.781654f, 0.000000f, 255.000000f },
+{ 148.448669f, 21.091320f, -116.186478f, -0.885465f, 0.000001f, -0.464706f, 0.000000f, 255.000000f },
+{ 148.102249f, 21.091320f, -115.096756f, -0.673915f, 0.000002f, -0.738809f, 0.000000f, 255.000000f },
+{ 146.276031f, 21.091320f, -117.172318f, 0.651081f, 0.000002f, -0.759008f, 0.000000f, 255.000000f },
+{ 142.652115f, 21.091320f, -118.815659f, 0.173318f, 0.000003f, -0.984866f, 0.000000f, 255.000000f },
+{ 139.866501f, 21.091320f, -117.808762f, -0.507992f, 0.000002f, -0.861362f, 0.000000f, 255.000000f },
+{ 137.850311f, 21.091320f, -115.206009f, -0.871837f, 0.000001f, -0.489796f, 0.000000f, 255.000000f },
+{ 137.073761f, 21.091320f, -111.634323f, -0.998311f, 0.000000f, -0.058104f, 0.000000f, 255.000000f },
+{ 138.144791f, 21.091309f, -107.571091f, -0.909053f, -0.000001f, 0.416680f, 0.000000f, 255.000000f },
+{ 141.623840f, 21.091307f, -104.049286f, -0.664570f, -0.000001f, 0.747226f, 0.000000f, 255.000000f },
+{ 144.391052f, 21.091307f, -102.166382f, -0.548261f, -0.000001f, 0.836307f, 0.000000f, 255.000000f },
+{ 147.909882f, 21.091307f, -100.028778f, -0.766243f, -0.000001f, 0.642551f, 0.000000f, 255.000000f },
+{ 147.909882f, 21.091311f, -97.335770f, -0.996405f, 0.000000f, -0.084715f, 0.000000f, 255.000000f },
+{ 147.180527f, 21.091311f, -94.538589f, -0.876729f, 0.000001f, -0.480984f, 0.000000f, 255.000000f },
+{ 145.869064f, 21.091311f, -93.718689f, -0.363965f, 0.000001f, -0.931413f, 0.000000f, 255.000000f },
+{ 143.898575f, 21.091311f, -93.732040f, 0.141328f, 0.000002f, -0.989963f, 0.000000f, 255.000000f },
+{ 141.682312f, 21.091311f, -94.706894f, 0.547231f, 0.000002f, -0.836982f, 0.000000f, 255.000000f },
+{ 137.779068f, 21.091307f, -98.297562f, -0.401856f, 0.000002f, -0.915703f, 0.000000f, 255.000000f },
+{ 137.779068f, 21.091311f, -92.526840f, -0.955079f, -0.000001f, 0.296350f, 0.000000f, 255.000000f },
+{ 141.658264f, 21.091311f, -89.665527f, -0.497538f, -0.000001f, 0.867442f, 0.000000f, 255.000000f },
+{ 144.054428f, 21.091311f, -88.951309f, -0.179589f, -0.000002f, 0.983742f, 0.000000f, 255.000000f },
+{ 147.152328f, 21.091311f, -89.072128f, 0.177231f, -0.000003f, 0.984169f, 0.000000f, 255.000000f },
+{ 150.474655f, 21.091311f, -90.715469f, 0.598228f, -0.000002f, 0.801326f, 0.000000f, 255.000000f },
+{ 152.600082f, 21.091311f, -94.111420f, 0.914330f, -0.000001f, 0.404969f, 0.000000f, 255.000000f },
+{ 152.911179f, 21.091311f, -96.502228f, 0.996242f, 0.000000f, 0.086610f, 0.000000f, 255.000000f },
+{ 152.932556f, 21.091312f, -113.100754f, 0.997125f, 0.000000f, 0.075777f, 0.000000f, 255.000000f },
+{ 153.103531f, 21.091312f, -113.846436f, 0.884948f, -0.000001f, 0.465690f, 0.000000f, 255.000000f },
+{ 153.680603f, 21.091312f, -114.199097f, 0.253386f, -0.000001f, 0.967365f, 0.000000f, 255.000000f },
+{ 154.124680f, 21.091312f, -114.032852f, -0.430647f, -0.000002f, 0.902520f, 0.000000f, 255.000000f },
+{ 154.796753f, 21.091312f, -113.553146f, -0.607827f, -0.000002f, 0.794070f, 0.000000f, 255.000000f },
+{ 147.909882f, 21.091312f, -110.800781f, -0.953798f, 0.000000f, 0.300449f, 0.000000f, 255.000000f },
+{ 147.909882f, 21.091307f, -103.491211f, -0.866611f, 0.000001f, -0.498984f, 0.000000f, 255.000000f },
+{ 146.048050f, 21.091309f, -104.727585f, 0.580141f, 0.000001f, -0.814516f, 0.000000f, 255.000000f },
+{ 144.556686f, 21.091309f, -105.944351f, 0.665820f, 0.000002f, -0.746113f, 0.000000f, 255.000000f },
+{ 143.421539f, 21.091309f, -107.154007f, 0.767879f, 0.000002f, -0.640594f, 0.000000f, 255.000000f },
+{ 142.628372f, 21.091309f, -108.369003f, 0.891623f, 0.013556f, -0.452576f, 0.000000f, 255.000000f },
+{ 142.162918f, 21.091312f, -109.601822f, 0.949579f, 0.009083f, -0.313397f, 0.000000f, 255.000000f },
+{ 142.010925f, 21.091312f, -110.864899f, 0.999304f, 0.016713f, 0.033337f, 0.000000f, 255.000000f },
+{ 142.329147f, 21.091312f, -112.550995f, 0.955846f, 0.011386f, 0.293649f, 0.000000f, 255.000000f },
+{ 143.188812f, 21.091320f, -113.667130f, 0.656317f, -0.000002f, 0.754485f, 0.000000f, 255.000000f },
+{ 144.447449f, 21.091320f, -114.070847f, 0.112970f, -0.000003f, 0.993598f, 0.000000f, 255.000000f },
+{ 145.715591f, 21.091312f, -113.693268f, -0.427813f, -0.000002f, 0.903867f, 0.000000f, 255.000000f },
+{ 146.898224f, 21.091312f, -112.588989f, -0.738315f, -0.000001f, 0.674456f, 0.000000f, 255.000000f },
+{ 147.430771f, 21.091312f, -111.777710f, -0.858087f, -0.000001f, 0.513505f, 0.000000f, 255.000000f },
+{ 173.749878f, 21.091312f, -112.467880f, -0.011390f, -0.000002f, 0.999935f, 0.000000f, 255.000000f },
+{ 173.749878f, 21.091312f, -117.276810f, 0.941545f, 0.000001f, -0.336887f, 0.000000f, 255.000000f },
+{ 172.085159f, 21.091312f, -118.160233f, 0.381529f, 0.000002f, -0.924357f, 0.000000f, 255.000000f },
+{ 168.812698f, 21.091312f, -118.815659f, 0.073515f, 0.000003f, -0.997294f, 0.000000f, 255.000000f },
+{ 166.009262f, 21.091312f, -118.315475f, -0.288270f, 0.000003f, -0.957549f, 0.000000f, 255.000000f },
+{ 163.547806f, 21.091312f, -116.887344f, -0.587254f, 0.000002f, -0.809402f, 0.000000f, 255.000000f },
+{ 161.503128f, 21.091312f, -114.639908f, -0.793964f, 0.000002f, -0.607965f, 0.000000f, 255.000000f },
+{ 159.950012f, 21.091312f, -111.681839f, -0.916096f, 0.000001f, -0.400960f, 0.000000f, 255.000000f },
+{ 158.963303f, 21.091309f, -108.121750f, -0.978307f, 0.000000f, -0.207162f, 0.000000f, 255.000000f },
+{ 158.617767f, 21.091307f, -104.068283f, -0.999894f, 0.000000f, -0.014533f, 0.000000f, 255.000000f },
+{ 159.531387f, 21.091311f, -96.903564f, -0.960752f, -0.000001f, 0.277410f, 0.000000f, 255.000000f },
+{ 163.822617f, 21.091311f, -90.542206f, -0.686978f, -0.000001f, 0.726678f, 0.000000f, 255.000000f },
+{ 169.115997f, 21.091311f, -88.872055f, -0.125351f, -0.000002f, 0.992112f, 0.000000f, 255.000000f },
+{ 173.301041f, 21.091311f, -89.897964f, 0.605053f, -0.000002f, 0.796185f, 0.000000f, 255.000000f },
+{ 173.301041f, 21.091311f, -95.027481f, 0.869424f, 0.000001f, -0.494066f, 0.000000f, 255.000000f },
+{ 169.582138f, 21.091311f, -93.616867f, -0.117972f, 0.000003f, -0.993017f, 0.000000f, 255.000000f },
+{ 166.473557f, 21.091311f, -94.882629f, 0.569661f, 0.000002f, -0.821880f, 0.000000f, 255.000000f },
+{ 164.462112f, 21.091307f, -98.442429f, 0.926161f, 0.000000f, -0.377127f, 0.000000f, 255.000000f },
+{ 163.747299f, 21.091307f, -103.940048f, 0.999259f, 0.000000f, -0.038502f, 0.000000f, 255.000000f },
+{ 164.523849f, 21.091312f, -109.302292f, 0.960848f, -0.000001f, 0.277074f, 0.000000f, 255.000000f },
+{ 166.711029f, 21.091312f, -112.812210f, 0.688926f, -0.000002f, 0.724832f, 0.000000f, 255.000000f },
+{ 171.313354f, 21.091312f, -113.911743f, -0.016062f, -0.000002f, 0.999871f, 0.000000f, 255.000000f },
+{ 188.369019f, 21.091312f, -113.301422f, 0.166049f, -0.000002f, 0.986117f, 0.000000f, 255.000000f },
+{ 188.369019f, 21.091312f, -117.725632f, 0.929230f, 0.000001f, -0.369503f, 0.000000f, 255.000000f },
+{ 186.637802f, 21.091312f, -118.378708f, 0.302607f, 0.000003f, -0.953115f, 0.000000f, 255.000000f },
+{ 184.602036f, 21.091312f, -118.792801f, 0.114406f, 0.000003f, -0.993434f, 0.000000f, 255.000000f },
+{ 182.419891f, 21.091312f, -118.666061f, -0.154137f, 0.000002f, -0.988049f, 0.000000f, 255.000000f },
+{ 181.128311f, 21.091312f, -118.195847f, -0.440071f, 0.000002f, -0.897963f, 0.000000f, 255.000000f },
+{ 180.089645f, 21.091312f, -117.372986f, -0.704223f, 0.000001f, -0.709979f, 0.000000f, 255.000000f },
+{ 179.323486f, 21.091312f, -116.165421f, -0.890730f, 0.000001f, -0.454533f, 0.000000f, 255.000000f },
+{ 178.849426f, 21.091312f, -114.541061f, -0.976876f, 0.000000f, -0.213806f, 0.000000f, 255.000000f },
+{ 178.687042f, 21.091312f, -112.467880f, -0.998642f, 0.000000f, -0.052093f, 0.000000f, 255.000000f },
+{ 178.687042f, 21.091311f, -94.001587f, -0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 175.416977f, 21.091311f, -94.001587f, -0.498416f, 0.000001f, -0.866938f, 0.000000f, 255.000000f },
+{ 178.200211f, 21.091311f, -89.945450f, -0.824150f, -0.000001f, 0.566372f, 0.000000f, 255.000000f },
+{ 180.755478f, 21.091311f, -86.238419f, -0.830310f, -0.000001f, 0.557302f, 0.000000f, 255.000000f },
+{ 183.239502f, 21.091309f, -82.331909f, -0.631328f, -0.000001f, 0.775516f, 0.000000f, 255.000000f },
+{ 183.688324f, 21.091309f, -82.331909f, 0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 183.688324f, 21.091311f, -89.641495f, 0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 188.369019f, 21.091311f, -89.641495f, 0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 188.369019f, 21.091311f, -94.001587f, 0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 183.688324f, 21.091311f, -94.001587f, 0.448748f, 0.000001f, -0.893658f, 0.000000f, 255.000000f },
+{ 183.847443f, 21.091312f, -112.446503f, 0.993879f, -0.002630f, 0.110439f, 0.000000f, 255.000000f },
+{ 184.081055f, 21.091312f, -113.181198f, 0.839241f, 0.017509f, 0.543478f, 0.000000f, 255.000000f },
+{ 184.972198f, 21.091312f, -113.977341f, 0.558370f, 0.001114f, 0.829591f, 0.000000f, 255.000000f },
+{ 186.488205f, 21.091312f, -113.985367f, -0.111941f, -0.000003f, 0.993715f, 0.000000f, 255.000000f },
+{ 192.280289f, 21.091312f, -118.046234f, -0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 192.280289f, 21.091311f, -89.641495f, -0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 197.281570f, 21.091311f, -89.641495f, 0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 197.281570f, 21.091312f, -118.046234f, 0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 209.400085f, 21.091312f, -118.687424f, -0.387639f, 0.000002f, -0.921811f, 0.000000f, 255.000000f },
+{ 200.872238f, 21.091311f, -89.641495f, -0.975084f, 0.000000f, 0.221837f, 0.000000f, 255.000000f },
+{ 205.873535f, 21.091311f, -89.641495f, 0.395561f, -0.000001f, 0.918440f, 0.000000f, 255.000000f },
+{ 210.041275f, 21.091309f, -105.863617f, 0.791121f, -0.000001f, 0.611659f, 0.000000f, 255.000000f },
+{ 210.169510f, 21.091309f, -105.863617f, -0.395561f, -0.000001f, 0.918440f, 0.000000f, 255.000000f },
+{ 214.337250f, 21.091311f, -89.641495f, -0.791121f, -0.000001f, 0.611659f, 0.000000f, 255.000000f },
+{ 219.338531f, 21.091311f, -89.641495f, 0.487542f, -0.000001f, 0.873100f, 0.000000f, 255.000000f },
+{ 210.810699f, 21.091312f, -118.687424f, 0.775278f, 0.000002f, -0.631621f, 0.000000f, 255.000000f },
+{ 196.095139f, 9.401914f, -83.842834f, 0.586264f, 0.000000f, -0.810120f, 0.000000f, 255.000000f },
+{ 197.530334f, 9.401917f, -82.099869f, 0.987392f, 0.000000f, -0.158291f, 0.000000f, 255.000000f },
+{ 197.312714f, 9.401917f, -79.852554f, 0.810120f, 0.000000f, 0.586264f, 0.000000f, 255.000000f },
+{ 195.569748f, 9.401917f, -78.417358f, 0.158291f, 0.000000f, 0.987392f, 0.000000f, 255.000000f },
+{ 193.322433f, 9.401917f, -78.634979f, -0.586264f, 0.000000f, 0.810120f, 0.000000f, 255.000000f },
+{ 191.887238f, 9.401917f, -80.377945f, -0.987392f, 0.000000f, 0.158291f, 0.000000f, 255.000000f },
+{ 192.104858f, 9.401917f, -82.625259f, -0.810120f, 0.000000f, -0.586264f, 0.000000f, 255.000000f },
+{ 193.847824f, 9.401914f, -84.060455f, -0.158291f, 0.000000f, -0.987392f, 0.000000f, 255.000000f },
+{ 196.095139f, 21.005835f, -83.842834f, 0.344805f, 0.000000f, -0.938674f, 0.000000f, 255.000000f },
+{ 197.530334f, 21.005833f, -82.099869f, 0.907558f, 0.000000f, -0.419928f, 0.000000f, 255.000000f },
+{ 197.312714f, 21.005833f, -79.852554f, 0.938674f, 0.000000f, 0.344805f, 0.000000f, 255.000000f },
+{ 195.569748f, 21.005836f, -78.417358f, 0.419928f, 0.000000f, 0.907558f, 0.000000f, 255.000000f },
+{ 193.322433f, 21.005836f, -78.634979f, -0.344805f, 0.000000f, 0.938674f, 0.000000f, 255.000000f },
+{ 191.887238f, 21.005833f, -80.377945f, -0.907558f, 0.000000f, 0.419928f, 0.000000f, 255.000000f },
+{ 192.104858f, 21.005835f, -82.625259f, -0.938674f, 0.000000f, -0.344805f, 0.000000f, 255.000000f },
+{ 193.847824f, 21.005835f, -84.060455f, -0.419928f, 0.000000f, -0.907558f, 0.000000f, 255.000000f },
+{ 57.212021f, 9.401914f, -83.842834f, 0.586264f, 0.000000f, -0.810120f, 0.000000f, 255.000000f },
+{ 58.647217f, 9.401917f, -82.099869f, 0.987392f, 0.000000f, -0.158291f, 0.000000f, 255.000000f },
+{ 58.429596f, 9.401917f, -79.852554f, 0.810120f, 0.000000f, 0.586264f, 0.000000f, 255.000000f },
+{ 56.686630f, 9.401917f, -78.417358f, 0.158291f, 0.000000f, 0.987392f, 0.000000f, 255.000000f },
+{ 54.439316f, 9.401917f, -78.634979f, -0.586264f, 0.000000f, 0.810120f, 0.000000f, 255.000000f },
+{ 53.004120f, 9.401917f, -80.377945f, -0.987392f, 0.000000f, 0.158291f, 0.000000f, 255.000000f },
+{ 53.221741f, 9.401917f, -82.625259f, -0.810120f, 0.000000f, -0.586264f, 0.000000f, 255.000000f },
+{ 54.964706f, 9.401914f, -84.060455f, -0.158291f, 0.000000f, -0.987392f, 0.000000f, 255.000000f },
+{ 57.212021f, 21.005835f, -83.842834f, 0.344805f, 0.000000f, -0.938674f, 0.000000f, 255.000000f },
+{ 58.647217f, 21.005833f, -82.099869f, 0.907558f, 0.000000f, -0.419928f, 0.000000f, 255.000000f },
+{ 58.429596f, 21.005833f, -79.852554f, 0.938674f, 0.000000f, 0.344805f, 0.000000f, 255.000000f },
+{ 56.686630f, 21.005836f, -78.417358f, 0.419928f, 0.000000f, 0.907558f, 0.000000f, 255.000000f },
+{ 54.439316f, 21.005836f, -78.634979f, -0.344805f, 0.000000f, 0.938674f, 0.000000f, 255.000000f },
+{ 53.004120f, 21.005833f, -80.377945f, -0.907558f, 0.000000f, 0.419928f, 0.000000f, 255.000000f },
+{ 53.221741f, 21.005835f, -82.625259f, -0.938674f, 0.000000f, -0.344805f, 0.000000f, 255.000000f },
+{ 54.964706f, 21.005835f, -84.060455f, -0.419928f, 0.000000f, -0.907558f, 0.000000f, 255.000000f },
+{ 98.582520f, 9.484123f, -113.301437f, 0.869996f, -0.000001f, 0.493059f, 0.000000f, 255.000000f },
+{ 98.582520f, 9.484123f, -117.725662f, 0.688899f, 0.000002f, -0.724858f, 0.000000f, 255.000000f },
+{ 95.979660f, 9.484123f, -118.792831f, 0.103299f, 0.000002f, -0.994650f, 0.000000f, 255.000000f },
+{ 92.633392f, 9.484123f, -118.666077f, -0.344449f, 0.000001f, -0.938805f, 0.000000f, 255.000000f },
+{ 90.303146f, 9.484123f, -117.373001f, -0.810154f, 0.000001f, -0.586217f, 0.000000f, 255.000000f },
+{ 89.062927f, 9.484123f, -114.541092f, -0.982148f, 0.000000f, -0.188111f, 0.000000f, 255.000000f },
+{ 88.900543f, 9.484123f, -112.467911f, -0.999661f, 0.000000f, -0.026047f, 0.000000f, 255.000000f },
+{ 88.900543f, 9.484118f, -94.001602f, -0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 85.630478f, 9.484118f, -94.001602f, -0.996832f, -0.000001f, 0.079535f, 0.000000f, 255.000000f },
+{ 88.413712f, 9.484118f, -89.945480f, -0.823749f, -0.000001f, 0.566955f, 0.000000f, 255.000000f },
+{ 90.968979f, 9.484117f, -86.238449f, -0.837145f, -0.000001f, 0.546981f, 0.000000f, 255.000000f },
+{ 93.453003f, 9.484117f, -82.331924f, -0.315664f, -0.000001f, 0.948871f, 0.000000f, 255.000000f },
+{ 93.901825f, 9.484117f, -82.331924f, 0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 93.901825f, 9.484118f, -89.641510f, 0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 98.582520f, 9.484118f, -89.641510f, 0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 98.582520f, 9.484118f, -94.001602f, 0.447214f, 0.000001f, -0.894427f, 0.000000f, 255.000000f },
+{ 93.901825f, 9.484118f, -94.001602f, 0.897364f, 0.000532f, -0.441290f, 0.000000f, 255.000000f },
+{ 94.060944f, 9.484123f, -112.446518f, 0.908382f, 0.000909f, 0.418140f, 0.000000f, 255.000000f },
+{ 95.185699f, 9.484123f, -113.977371f, 0.300433f, -0.000003f, 0.953803f, 0.000000f, 255.000000f },
+{ 96.701706f, 9.484123f, -113.985397f, -0.229252f, -0.000002f, 0.973367f, 0.000000f, 255.000000f },
+{ 98.582520f, 21.091312f, -113.301422f, 0.166049f, -0.000002f, 0.986117f, 0.000000f, 255.000000f },
+{ 98.582520f, 21.091312f, -117.725632f, 0.932011f, 0.000001f, -0.362429f, 0.000000f, 255.000000f },
+{ 95.979660f, 21.091312f, -118.792801f, 0.245227f, 0.000003f, -0.969466f, 0.000000f, 255.000000f },
+{ 92.633392f, 21.091312f, -118.666061f, -0.191620f, 0.000002f, -0.981469f, 0.000000f, 255.000000f },
+{ 90.303146f, 21.091312f, -117.372986f, -0.659538f, 0.000001f, -0.751671f, 0.000000f, 255.000000f },
+{ 89.062927f, 21.091312f, -114.541061f, -0.954830f, 0.000001f, -0.297154f, 0.000000f, 255.000000f },
+{ 88.900543f, 21.091312f, -112.467880f, -0.998642f, 0.000000f, -0.052093f, 0.000000f, 255.000000f },
+{ 88.900543f, 21.091311f, -94.001587f, -0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 85.630478f, 21.091311f, -94.001587f, -0.498416f, 0.000001f, -0.866938f, 0.000000f, 255.000000f },
+{ 88.413712f, 21.091311f, -89.945450f, -0.824150f, -0.000001f, 0.566372f, 0.000000f, 255.000000f },
+{ 90.968979f, 21.091311f, -86.238419f, -0.830310f, -0.000001f, 0.557302f, 0.000000f, 255.000000f },
+{ 93.453003f, 21.091309f, -82.331909f, -0.631328f, -0.000001f, 0.775516f, 0.000000f, 255.000000f },
+{ 93.901825f, 21.091309f, -82.331909f, 0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 93.901825f, 21.091311f, -89.641495f, 0.894427f, -0.000001f, 0.447214f, 0.000000f, 255.000000f },
+{ 98.582520f, 21.091311f, -89.641495f, 0.447214f, -0.000001f, 0.894427f, 0.000000f, 255.000000f },
+{ 98.582520f, 21.091311f, -94.001587f, 0.894427f, 0.000001f, -0.447214f, 0.000000f, 255.000000f },
+{ 93.901825f, 21.091311f, -94.001587f, 0.448616f, 0.000001f, -0.893725f, 0.000000f, 255.000000f },
+{ 94.047279f, 21.091312f, -112.455856f, 0.976683f, 0.000910f, 0.214684f, 0.000000f, 255.000000f },
+{ 95.185699f, 21.091312f, -113.977341f, 0.592555f, 0.000522f, 0.805530f, 0.000000f, 255.000000f },
+{ 96.701706f, 21.091312f, -113.985367f, -0.111941f, -0.000003f, 0.993715f, 0.000000f, 255.000000f },
+{ 236.900940f, 9.484123f, -111.377884f, 0.874270f, -0.000001f, 0.485440f, 0.000000f, 255.000000f },
+{ 236.900940f, 9.484123f, -116.315048f, 0.760144f, 0.000001f, -0.649754f, 0.000000f, 255.000000f },
+{ 233.106049f, 9.484123f, -118.552078f, 0.152177f, 0.000001f, -0.988353f, 0.000000f, 255.000000f },
+{ 228.432480f, 9.484123f, -118.394455f, -0.459334f, 0.000001f, -0.888264f, 0.000000f, 255.000000f },
+{ 224.397736f, 9.484123f, -115.040680f, -0.838627f, 0.000001f, -0.544707f, 0.000000f, 255.000000f },
+{ 223.067856f, 9.484123f, -112.118805f, -0.959193f, 0.000000f, -0.282752f, 0.000000f, 255.000000f },
+{ 222.243805f, 9.484118f, -108.374069f, -0.993577f, 0.000000f, -0.113154f, 0.000000f, 255.000000f },
+{ 221.961212f, 9.484118f, -103.811813f, -0.999878f, 0.000000f, 0.015606f, 0.000000f, 255.000000f },
+{ 222.198090f, 9.484118f, -99.454697f, -0.989803f, 0.000000f, 0.142441f, 0.000000f, 255.000000f },
+{ 222.894501f, 9.484118f, -95.777939f, -0.953092f, -0.000001f, 0.302682f, 0.000000f, 255.000000f },
+{ 224.029053f, 9.484106f, -92.831436f, -0.859240f, -0.000001f, 0.511572f, 0.000000f, 255.000000f },
+{ 225.580368f, 9.484118f, -90.665039f, -0.601898f, -0.000001f, 0.798573f, 0.000000f, 255.000000f },
+{ 228.791931f, 9.484118f, -88.927658f, -0.064729f, -0.000002f, 0.997903f, 0.000000f, 255.000000f },
+{ 232.490982f, 9.484118f, -89.470520f, 0.480740f, -0.000002f, 0.876863f, 0.000000f, 255.000000f },
+{ 234.407425f, 9.484118f, -91.009384f, 0.770418f, -0.000001f, 0.637539f, 0.000000f, 255.000000f },
+{ 235.810913f, 9.484106f, -93.103928f, 0.938897f, 0.000000f, 0.344198f, 0.000000f, 255.000000f },
+{ 237.245300f, 9.484118f, -99.154877f, 0.994578f, 0.000000f, 0.103993f, 0.000000f, 255.000000f },
+{ 237.478027f, 9.484118f, -104.965958f, 0.454185f, 0.000001f, -0.890908f, 0.000000f, 255.000000f },
+{ 226.962494f, 9.484118f, -104.965958f, 0.931736f, 0.000000f, -0.363137f, 0.000000f, 255.000000f },
+{ 227.534821f, 9.484123f, -110.009995f, 0.932111f, 0.000000f, 0.362173f, 0.000000f, 255.000000f },
+{ 229.232788f, 9.484123f, -113.130463f, 0.561655f, -0.000001f, 0.827372f, 0.000000f, 255.000000f },
+{ 232.027893f, 9.484123f, -114.199112f, -0.059664f, -0.000002f, 0.998219f, 0.000000f, 255.000000f },
+{ 234.632736f, 9.484123f, -113.485794f, -0.556105f, -0.000002f, 0.831112f, 0.000000f, 255.000000f },
+{ 226.898376f, 9.484118f, -101.247055f, 0.458115f, -0.000001f, 0.888893f, 0.000000f, 255.000000f },
+{ 232.476730f, 9.484118f, -101.247055f, -0.917640f, -0.000001f, 0.397413f, 0.000000f, 255.000000f },
+{ 232.170380f, 9.484118f, -96.746857f, -0.968412f, 0.000000f, -0.249358f, 0.000000f, 255.000000f },
+{ 231.222839f, 9.484118f, -94.098984f, -0.666434f, 0.000002f, -0.745564f, 0.000000f, 255.000000f },
+{ 229.591370f, 9.484106f, -93.232178f, 0.199198f, 0.000001f, -0.979959f, 0.000000f, 255.000000f },
+{ 228.066772f, 9.484118f, -94.113220f, 0.848531f, 0.000001f, -0.529145f, 0.000000f, 255.000000f },
+{ 227.183350f, 9.484118f, -96.775345f, 0.988917f, 0.000000f, -0.148471f, 0.000000f, 255.000000f },
+{ 236.900940f, 21.091320f, -111.377853f, -0.239566f, -0.000003f, 0.970880f, 0.000000f, 255.000000f },
+{ 236.900940f, 21.091320f, -116.315018f, 0.945756f, 0.000001f, -0.324877f, 0.000000f, 255.000000f },
+{ 233.106049f, 21.091320f, -118.552063f, 0.339296f, 0.000002f, -0.940680f, 0.000000f, 255.000000f },
+{ 228.432480f, 21.091320f, -118.394440f, -0.247366f, 0.000001f, -0.968922f, 0.000000f, 255.000000f },
+{ 224.397736f, 21.091320f, -115.040665f, -0.746247f, 0.000001f, -0.665669f, 0.000000f, 255.000000f },
+{ 223.067856f, 21.091320f, -112.118790f, -0.936926f, 0.000000f, -0.349528f, 0.000000f, 255.000000f },
+{ 222.243805f, 21.091312f, -108.374054f, -0.986407f, 0.000000f, -0.164320f, 0.000000f, 255.000000f },
+{ 221.961212f, 21.091311f, -103.811798f, -0.999732f, 0.000000f, -0.023155f, 0.000000f, 255.000000f },
+{ 222.198090f, 21.091307f, -99.454666f, -0.995145f, 0.000000f, 0.098417f, 0.000000f, 255.000000f },
+{ 222.894501f, 21.091311f, -95.777908f, -0.969592f, -0.000001f, 0.244728f, 0.000000f, 255.000000f },
+{ 224.029053f, 21.091311f, -92.831406f, -0.899585f, -0.000001f, 0.436746f, 0.000000f, 255.000000f },
+{ 225.580368f, 21.091311f, -90.665024f, -0.716920f, -0.000001f, 0.697156f, 0.000000f, 255.000000f },
+{ 228.791931f, 21.091311f, -88.927628f, -0.281538f, -0.000002f, 0.959550f, 0.000000f, 255.000000f },
+{ 232.490982f, 21.091311f, -89.470505f, 0.315299f, -0.000002f, 0.948992f, 0.000000f, 255.000000f },
+{ 234.407425f, 21.091311f, -91.009354f, 0.701501f, -0.000002f, 0.712669f, 0.000000f, 255.000000f },
+{ 235.810913f, 21.091311f, -93.103912f, 0.890786f, -0.000001f, 0.454423f, 0.000000f, 255.000000f },
+{ 237.245300f, 21.091307f, -99.154861f, 0.985820f, 0.000000f, 0.167804f, 0.000000f, 255.000000f },
+{ 237.478027f, 21.091309f, -104.965942f, 0.908369f, 0.000001f, -0.418169f, 0.000000f, 255.000000f },
+{ 226.962494f, 21.091312f, -104.965942f, 0.465868f, 0.000001f, -0.884854f, 0.000000f, 255.000000f },
+{ 227.534821f, 21.091320f, -110.009979f, 0.971167f, 0.000000f, 0.238399f, 0.000000f, 255.000000f },
+{ 229.232788f, 21.091320f, -113.130447f, 0.745484f, -0.000001f, 0.666524f, 0.000000f, 255.000000f },
+{ 232.027893f, 21.091320f, -114.199097f, 0.156935f, -0.000001f, 0.987609f, 0.000000f, 255.000000f },
+{ 234.632736f, 21.091320f, -113.485764f, -0.413582f, -0.000002f, 0.910467f, 0.000000f, 255.000000f },
+{ 226.898376f, 21.091307f, -101.247040f, 0.916229f, -0.000001f, 0.400654f, 0.000000f, 255.000000f },
+{ 232.476730f, 21.091307f, -101.247040f, -0.458820f, -0.000001f, 0.888529f, 0.000000f, 255.000000f },
+{ 232.170380f, 21.091311f, -96.746841f, -0.987291f, 0.000000f, -0.158926f, 0.000000f, 255.000000f },
+{ 231.222839f, 21.091311f, -94.098953f, -0.833881f, 0.000001f, -0.551945f, 0.000000f, 255.000000f },
+{ 229.591370f, 21.091311f, -93.232162f, -0.164166f, 0.000002f, -0.986433f, 0.000000f, 255.000000f },
+{ 228.066772f, 21.091311f, -94.113205f, 0.689776f, 0.000001f, -0.724023f, 0.000000f, 255.000000f },
+{ 227.183350f, 21.091311f, -96.775330f, 0.972507f, 0.000000f, -0.232875f, 0.000000f, 255.000000f },
+{ -227.530014f, -20.966743f, 18.889576f, -1.000000f, 0.000000f, 0.000000f, 11.312357f, 104.759467f },
+{ -227.530014f, -20.966749f, 49.094059f, -1.000000f, 0.000000f, 0.000000f, 24.483732f, 68.571409f },
+{ -259.747955f, -20.966747f, 81.060303f, -1.000000f, 0.000000f, 0.000000f, -0.177157f, 16.222941f },
+{ -259.747955f, -20.966751f, 111.264603f, -1.000000f, 0.000000f, 0.000000f, 12.994208f, -19.965071f },
+{ -264.026886f, -20.966732f, -47.559727f, -1.000000f, 0.000000f, 0.000000f, -61.391828f, 168.457698f },
+{ -264.026886f, -20.966738f, -14.334979f, -1.000000f, 0.000000f, 0.000000f, -46.903330f, 128.650867f },
+{ -148.686584f, -20.966757f, 116.550354f, -1.000000f, 0.000000f, 0.000000f, 148.362720f, 22.133174f },
+{ -148.686584f, -20.966743f, -55.110798f, -1.000000f, 0.000000f, 0.000000f, 73.505490f, 227.801797f },
+{ 53.459190f, 2.970489f, -63.834198f, -1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.459190f, 2.970482f, 19.696451f, -1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 34.431496f, 2.970485f, 19.696451f, -1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 34.431496f, 2.970482f, 37.767296f, -1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.661545f, 2.970478f, 37.767296f, 1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.661545f, 2.970482f, 19.696451f, 1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 2.970482f, 19.696451f, 1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 2.970489f, -63.834198f, 1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ -227.530014f, 20.966755f, 18.889763f, -1.000000f, 0.000000f, 0.000000f, 11.312366f, 104.759421f },
+{ -227.530014f, 20.966747f, 49.094074f, -1.000000f, 0.000000f, 0.000000f, 24.483732f, 68.571394f },
+{ -259.747955f, 20.966745f, 81.060341f, -1.000000f, 0.000000f, 0.000000f, -0.177137f, 16.222895f },
+{ -259.747955f, 20.966743f, 111.264641f, -1.000000f, 0.000000f, 0.000000f, 12.994218f, -19.965132f },
+{ -264.026886f, 20.966764f, -47.559723f, -1.000000f, 0.000000f, 0.000000f, -61.391828f, 168.457698f },
+{ -264.026886f, 20.966753f, -14.334975f, -1.000000f, 0.000000f, 0.000000f, -46.903330f, 128.650867f },
+{ -148.686584f, 20.966726f, 116.550392f, -1.000000f, 0.000000f, 0.000000f, 148.362750f, 22.133128f },
+{ -148.686584f, 20.966757f, -55.110794f, -1.000000f, 0.000000f, 0.000000f, 73.505490f, 227.801797f },
+{ 53.459190f, 21.106728f, -63.834198f, -1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.459190f, 21.106720f, 19.696632f, -1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 34.431496f, 21.106720f, 19.696632f, -1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 34.431496f, 21.106718f, 37.767292f, -1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.661545f, 21.106718f, 37.767292f, 1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.661545f, 21.106720f, 19.696632f, 1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 21.106720f, 19.696632f, 1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 21.106728f, -63.834198f, 1.000000f, 0.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ -227.530014f, -20.966743f, 18.889576f, 0.000000f, -1.000000f, 0.000000f, 11.312357f, 104.759467f },
+{ -227.530014f, -20.966749f, 49.094059f, 0.000000f, -1.000000f, 0.000000f, 24.483732f, 68.571409f },
+{ -220.271423f, -20.966749f, 49.922577f, 0.000000f, -1.000000f, 0.000000f, 33.541598f, 70.744057f },
+{ -214.348251f, -20.966755f, 52.198391f, 0.000000f, -1.000000f, 0.000000f, 41.630631f, 70.600333f },
+{ -209.753510f, -20.966747f, 55.606861f, 0.000001f, -1.000000f, 0.000000f, 48.621978f, 68.520264f },
+{ -206.480209f, -20.966747f, 59.833366f, 0.000000f, -1.000000f, 0.000000f, 54.386820f, 64.883859f },
+{ -204.521362f, -20.966749f, 64.563301f, 0.000000f, -1.000000f, 0.000000f, 58.796339f, 60.071098f },
+{ -203.869965f, -20.966747f, 69.481987f, 0.000000f, -1.000000f, 0.000000f, 61.721703f, 54.462037f },
+{ -204.699646f, -20.966759f, 74.975159f, 0.000000f, -1.000000f, 0.000000f, 63.123094f, 47.518821f },
+{ -207.067520f, -20.966751f, 79.783142f, 0.000000f, -1.000000f, 0.000000f, 62.382769f, 40.725774f },
+{ -210.791794f, -20.966751f, 83.766113f, 0.000000f, -1.000000f, 0.000000f, 59.657563f, 34.329668f },
+{ -215.690674f, -20.966751f, 86.784210f, 0.000000f, -1.000000f, 0.000000f, 55.104290f, 28.577385f },
+{ -221.582382f, -20.966751f, 88.697617f, 0.000000f, -1.000000f, 0.000000f, 48.879779f, 23.715683f },
+{ -228.285126f, -20.966751f, 89.366486f, 0.000000f, -1.000000f, 0.000000f, 41.140841f, 19.991411f },
+{ -233.272552f, -20.966751f, 89.153244f, 0.000000f, -1.000000f, 0.000000f, 35.072373f, 18.071997f },
+{ -238.232040f, -20.966751f, 88.499512f, 0.000000f, -1.000000f, 0.000000f, 28.845299f, 16.692535f },
+{ -243.261429f, -20.966751f, 87.384338f, 0.000000f, -1.000000f, 0.000000f, 22.333248f, 15.835422f },
+{ -248.458618f, -20.966747f, 85.786713f, 0.000000f, -1.000000f, 0.000000f, 15.409765f, 15.483181f },
+{ -253.921509f, -20.966747f, 83.685699f, 0.000000f, -1.000000f, 0.000000f, 7.948429f, 15.618211f },
+{ -259.747955f, -20.966747f, 81.060303f, 0.000000f, -1.000000f, 0.000000f, -0.177157f, 16.222941f },
+{ -259.747955f, -20.966751f, 111.264603f, 0.000000f, -1.000000f, 0.000000f, 12.994208f, -19.965071f },
+{ -253.885376f, -20.966755f, 113.571884f, 0.000000f, -1.000000f, 0.000000f, 21.024357f, -20.172935f },
+{ -247.666229f, -20.966757f, 115.459656f, 0.000000f, -1.000000f, 0.000000f, 29.298774f, -19.722674f },
+{ -241.153412f, -20.966763f, 116.927917f, 0.000000f, -1.000000f, 0.000000f, 37.742109f, -18.641708f },
+{ -234.409882f, -20.966763f, 117.976685f, 0.000000f, -1.000000f, 0.000000f, 46.278933f, -16.957548f },
+{ -227.498550f, -20.966763f, 118.605942f, 0.000000f, -1.000000f, 0.000000f, 54.833858f, -14.697611f },
+{ -220.482346f, -20.966763f, 118.815689f, 0.000000f, -1.000000f, 0.000000f, 63.331494f, -11.889319f },
+{ -205.143631f, -20.966763f, 117.432495f, 0.000000f, -1.000000f, 0.000000f, 81.105759f, -3.543264f },
+{ -191.825546f, -20.966755f, 113.455368f, 0.000000f, -1.000000f, 0.000000f, 95.327940f, 7.029456f },
+{ -180.870651f, -20.966755f, 107.142990f, 0.000000f, -1.000000f, 0.000000f, 105.700410f, 19.369521f },
+{ -172.621567f, -20.966755f, 98.754059f, 0.000000f, -1.000000f, 0.000000f, 111.925502f, 33.017599f },
+{ -167.420868f, -20.966753f, 88.547287f, 0.000000f, -1.000000f, 0.000000f, 113.705577f, 47.514307f },
+{ -165.611176f, -20.966751f, 76.781357f, 0.000000f, -1.000000f, 0.000000f, 110.742945f, 62.400328f },
+{ -166.340637f, -20.966751f, 68.696579f, 0.000000f, -1.000000f, -0.000001f, 106.343396f, 71.768664f },
+{ -168.510422f, -20.966749f, 61.101204f, 0.000000f, -1.000000f, 0.000000f, 100.431605f, 79.922555f },
+{ -172.092514f, -20.966755f, 54.065182f, 0.000000f, -1.000000f, 0.000000f, 93.071636f, 86.790413f },
+{ -177.058975f, -20.966747f, 47.658421f, 0.000000f, -1.000000f, -0.000001f, 84.327446f, 92.300650f },
+{ -183.381851f, -20.966743f, 41.950832f, 0.000000f, -1.000000f, 0.000000f, 74.263017f, 96.381707f },
+{ -191.033142f, -20.966743f, 37.012333f, 0.000000f, -1.000000f, 0.000000f, 62.942380f, 98.962027f },
+{ -181.454453f, -20.966751f, 32.298737f, 0.000000f, -1.000000f, 0.000000f, 72.363203f, 108.786445f },
+{ -173.805496f, -20.966743f, 26.319462f, 0.000000f, -1.000000f, 0.000000f, 78.920131f, 119.285616f },
+{ -168.002350f, -20.966745f, 19.235668f, 0.000000f, -1.000000f, 0.000000f, 82.783855f, 130.303376f },
+{ -163.961121f, -20.966740f, 11.208173f, 0.000000f, -1.000000f, 0.000000f, 84.125031f, 141.683643f },
+{ -161.597916f, -20.966740f, 2.397420f, 0.000000f, -1.000000f, 0.000000f, 83.114247f, 153.270415f },
+{ -160.828827f, -20.966740f, -7.035602f, 0.000000f, -1.000000f, 0.000000f, 79.922191f, 164.907572f },
+{ -162.772522f, -20.966736f, -21.426922f, 0.000000f, -1.000000f, 0.000000f, 71.317727f, 181.302331f },
+{ -168.407867f, -20.966743f, -33.734730f, 0.000000f, -1.000000f, 0.000000f, 59.198844f, 193.590982f },
+{ -177.441193f, -20.966736f, -43.721256f, 0.000000f, -1.000000f, 0.000000f, 44.021060f, 201.616710f },
+{ -189.578857f, -20.966732f, -51.148808f, 0.000000f, -1.000000f, 0.000000f, 26.239853f, 205.222777f },
+{ -204.527191f, -20.966740f, -55.779682f, 0.000000f, -1.000000f, 0.000000f, 6.310721f, 204.252461f },
+{ -221.992554f, -20.966740f, -57.376118f, 0.000000f, -1.000000f, 0.000000f, -15.310837f, 198.548949f },
+{ -229.371170f, -20.966740f, -57.068485f, 0.000000f, -1.000000f, 0.000000f, -24.017065f, 194.962735f },
+{ -236.805725f, -20.966740f, -56.173542f, 0.000000f, -1.000000f, 0.000000f, -32.534211f, 190.648469f },
+{ -244.142380f, -20.966740f, -54.733250f, 0.000000f, -1.000000f, 0.000000f, -40.696227f, 185.723508f },
+{ -251.227341f, -20.966732f, -52.789539f, 0.000000f, -1.000000f, 0.000000f, -48.337180f, 180.305151f },
+{ -257.906799f, -20.966732f, -50.384388f, 0.000000f, -1.000000f, 0.000000f, -55.291061f, 174.510773f },
+{ -264.026886f, -20.966732f, -47.559727f, 0.000000f, -1.000000f, 0.000000f, -61.391828f, 168.457698f },
+{ -264.026886f, -20.966738f, -14.334979f, 0.000000f, -1.000000f, 0.000000f, -46.903330f, 128.650867f },
+{ -257.339294f, -20.966736f, -18.662861f, 0.000000f, -1.000000f, 0.000000f, -40.778150f, 136.752428f },
+{ -251.050217f, -20.966736f, -22.109791f, 0.000000f, -1.000000f, 0.000000f, -34.746278f, 143.624739f },
+{ -245.054810f, -20.966736f, -24.717709f, 0.000000f, -1.000000f, 0.000000f, -28.700379f, 149.363753f },
+{ -239.248169f, -20.966736f, -26.528568f, 0.000000f, -1.000000f, 0.000000f, -22.533070f, 154.065492f },
+{ -233.525421f, -20.966736f, -27.584324f, 0.000000f, -1.000000f, 0.000000f, -16.136991f, 157.825952f },
+{ -227.781708f, -20.966736f, -27.926914f, 0.000000f, -1.000000f, 0.000000f, -9.404798f, 160.741110f },
+{ -220.280746f, -20.966736f, -27.192783f, 0.000000f, -1.000000f, 0.000000f, -0.097693f, 163.132527f },
+{ -213.751633f, -20.966736f, -25.074284f, 0.000000f, -1.000000f, 0.000000f, 8.648720f, 163.441519f },
+{ -208.369156f, -20.966736f, -21.697269f, 0.000000f, -1.000000f, 0.000000f, 16.570136f, 161.742661f },
+{ -204.308121f, -20.966736f, -17.187603f, 0.000000f, -1.000000f, -0.000001f, 23.402251f, 158.110511f },
+{ -201.743317f, -20.966747f, -11.671123f, 0.000000f, -1.000000f, 0.000000f, 28.880766f, 152.619616f },
+{ -200.849533f, -20.966740f, -5.273685f, 0.000000f, -1.000000f, 0.000000f, 32.741388f, 145.344557f },
+{ -201.724655f, -20.966740f, 1.288052f, 0.000000f, -1.000000f, 0.000000f, 34.554308f, 137.101264f },
+{ -204.242859f, -20.966745f, 7.031773f, 0.000000f, -1.000000f, 0.000000f, 34.041921f, 129.121540f },
+{ -208.243301f, -20.966740f, 11.810628f, 0.000000f, -1.000000f, 0.000000f, 31.332898f, 121.651460f },
+{ -213.565170f, -20.966740f, 15.477796f, 0.000001f, -1.000000f, 0.000000f, 26.555888f, 114.937053f },
+{ -220.047684f, -20.966743f, 17.886265f, 0.000000f, -1.000000f, 0.000000f, 19.839473f, 109.224409f },
+{ -148.686584f, -20.966757f, 116.550354f, 0.000000f, -1.000000f, 0.000000f, 148.362720f, 22.133174f },
+{ -72.924095f, -20.966761f, 116.550354f, 0.000000f, -1.000000f, 0.000000f, 239.134392f, 55.171337f },
+{ -44.133286f, -20.966759f, 113.442535f, 0.000000f, -1.000000f, 0.000000f, 272.273660f, 71.449816f },
+{ -20.467419f, -20.966759f, 104.692368f, 0.000000f, -1.000000f, 0.000000f, 296.812166f, 92.253563f },
+{ -1.975434f, -20.966759f, 91.159866f, 0.000000f, -1.000000f, 0.000000f, 313.066387f, 116.530870f },
+{ 11.293716f, -20.966763f, 73.704994f, 0.000000f, -1.000000f, 0.000000f, 321.352617f, 143.230046f },
+{ 19.291100f, -20.966763f, 53.187717f, 0.000000f, -1.000000f, 0.000000f, 321.987274f, 171.299429f },
+{ 21.967770f, -20.966759f, 30.467985f, 0.000000f, -1.000000f, 0.000000f, 315.286714f, 199.687265f },
+{ 19.338877f, -20.966749f, 6.999157f, 0.000000f, -1.000000f, 0.000000f, 301.902798f, 226.659149f },
+{ 11.340330f, -20.966751f, -13.645114f, 0.000000f, -1.000000f, 0.000000f, 283.317205f, 247.905254f },
+{ -2.195676f, -20.966743f, -30.821491f, 0.000000f, -1.000000f, 0.000000f, 259.609426f, 262.581684f },
+{ -21.436935f, -20.966740f, -43.886723f, 0.000000f, -1.000000f, 0.000000f, 230.858877f, 269.844599f },
+{ -46.551262f, -20.966736f, -52.197575f, 0.000000f, -1.000000f, 0.000000f, 197.145034f, 268.850158f },
+{ -77.706444f, -20.966743f, -55.110798f, 0.000000f, -1.000000f, 0.000000f, 158.547374f, 258.754495f },
+{ -148.686584f, -20.966743f, -55.110798f, 0.000000f, -1.000000f, 0.000000f, 73.505490f, 227.801797f },
+{ -105.897141f, -20.966753f, 85.087540f, 0.000000f, -1.000000f, 0.000000f, 185.908946f, 78.488452f },
+{ -105.897141f, -20.966742f, -23.647968f, 0.000000f, -1.000000f, 0.000000f, 138.492050f, 208.765350f },
+{ -77.958153f, -20.966742f, -23.647968f, 0.000000f, -1.000000f, 0.000000f, 171.965974f, 220.948864f },
+{ -58.874207f, -20.966740f, -21.368664f, 0.000000f, -1.000000f, 0.000000f, 195.824559f, 226.540055f },
+{ -44.341877f, -20.966745f, -15.146022f, 0.000000f, -1.000000f, 0.000000f, 215.949404f, 225.421851f },
+{ -33.878738f, -20.966743f, -5.902942f, 0.000000f, -1.000000f, 0.000000f, 232.516059f, 218.910357f },
+{ -27.002363f, -20.966749f, 5.437657f, 0.000000f, -1.000000f, 0.000000f, 245.700060f, 208.321713f },
+{ -23.230320f, -20.966747f, 17.952679f, 0.000000f, -1.000000f, 0.000000f, 255.676941f, 194.972086f },
+{ -22.080179f, -20.966755f, 30.719687f, 0.000000f, -1.000000f, 0.000000f, 262.622269f, 180.177463f },
+{ -23.442402f, -20.966751f, 44.972424f, 0.000000f, -1.000000f, 0.000000f, 267.205431f, 162.507202f },
+{ -27.692215f, -20.966751f, 57.903645f, 0.000000f, -1.000000f, 0.000000f, 267.752663f, 145.160958f },
+{ -35.074326f, -20.966751f, 68.947113f, 0.000000f, -1.000000f, 0.000000f, 263.723906f, 128.710531f },
+{ -45.833443f, -20.966755f, 77.536469f, 0.000000f, -1.000000f, 0.000000f, 254.578922f, 113.727776f },
+{ -60.214287f, -20.966755f, 83.105392f, 0.000000f, -1.000000f, 0.000000f, 239.777576f, 100.784454f },
+{ -78.461555f, -20.966755f, 85.087540f, 0.000000f, -1.000000f, 0.000000f, 218.779751f, 90.452444f },
+{ 53.459190f, 2.970489f, -63.834198f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.459190f, 2.970482f, 19.696451f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 34.431496f, 2.970485f, 19.696451f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 34.431496f, 2.970482f, 37.767296f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.459190f, 2.970482f, 37.767296f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.459190f, 2.970471f, 52.887688f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 54.761124f, 2.970478f, 61.040325f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 58.744659f, 2.970474f, 68.629539f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 65.526382f, 2.970473f, 75.245560f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 75.222885f, 2.970474f, 80.478622f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 87.950760f, 2.970474f, 83.918953f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 103.826599f, 2.970474f, 85.156792f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 107.486267f, 2.970474f, 85.094475f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.371353f, 2.970474f, 84.904106f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 115.334160f, 2.970474f, 84.580559f, 0.000001f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 119.227013f, 2.970474f, 84.118721f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 122.902229f, 2.970474f, 83.513466f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 126.212128f, 2.970474f, 82.759666f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 114.179916f, 2.970478f, 65.426537f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 112.235428f, 2.970474f, 65.933624f, 0.000001f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 110.283180f, 2.970474f, 66.348511f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 108.268738f, 2.970474f, 66.671196f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 106.137703f, 2.970474f, 66.901688f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 103.835670f, 2.970474f, 67.039986f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 101.308228f, 2.970474f, 67.086082f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 95.838806f, 2.970474f, 66.577293f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 91.224388f, 2.970478f, 65.167015f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 87.527145f, 2.970478f, 63.029404f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 84.809280f, 2.970478f, 60.338612f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 83.132957f, 2.970478f, 57.268784f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 2.970479f, 53.994072f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 2.970478f, 37.767296f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.661545f, 2.970478f, 37.767296f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.661545f, 2.970482f, 19.696451f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 2.970482f, 19.696451f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 2.970489f, -63.834198f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 109.261765f, 2.970490f, -33.040283f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 158.509918f, 2.970482f, 10.661288f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 110.660858f, 2.970478f, 56.206810f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.037323f, 2.970478f, 56.206810f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 175.299042f, 2.970477f, 25.597071f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 203.001129f, 2.970478f, 56.206810f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 237.139038f, 2.970478f, 56.206810f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 189.569809f, 2.970482f, 11.767657f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 239.097778f, 2.970486f, -33.040283f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 202.161682f, 2.970486f, -33.040283f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 173.620132f, 2.970482f, -3.168332f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 143.679504f, 2.970490f, -33.040283f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 246.695496f, 2.970477f, 44.635109f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 246.695496f, 2.970479f, 54.095207f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 243.335144f, 2.970479f, 54.095207f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 243.335144f, 2.970478f, 56.104118f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 252.174316f, 2.970478f, 56.104118f, -0.000001f, -1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 252.174316f, 2.970475f, 54.095207f, -0.000001f, -1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 248.813965f, 2.970479f, 54.095207f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 248.813965f, 2.970477f, 44.635109f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 253.836212f, 2.970477f, 44.635109f, -0.000002f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 253.836212f, 2.970478f, 56.341530f, -0.000001f, -1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 258.931549f, 2.970471f, 51.191429f, -0.000001f, -1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 264.026886f, 2.970478f, 56.341530f, 0.000002f, -1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 264.026886f, 2.970477f, 44.635109f, 0.000003f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 261.908356f, 2.970477f, 44.635109f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 261.908356f, 2.970467f, 51.721062f, 0.000000f, -1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 258.931549f, 2.970471f, 48.634651f, -0.000001f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 255.954681f, 2.970471f, 51.721062f, -0.000001f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 255.954681f, 2.970477f, 44.635109f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 53.398365f, 9.484123f, -118.046249f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.398365f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 58.399651f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 58.399651f, 9.484123f, -118.046249f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 64.683319f, 9.484123f, -118.046249f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 64.683319f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 69.684608f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 69.684608f, 9.484118f, -92.719223f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 71.361206f, 9.484118f, -90.693527f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 75.070610f, 9.484118f, -89.192673f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 78.221947f, 9.484118f, -90.116470f, -0.000001f, -1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 80.447113f, 9.484106f, -92.906830f, -0.000001f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 81.069901f, 9.484118f, -95.010895f, 0.000000f, -1.000000f, -0.000002f, 0.000000f, 255.000000f },
+{ 81.290161f, 9.484118f, -97.592270f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 81.290161f, 9.484123f, -118.046249f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 76.288872f, 9.484123f, -118.046249f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 76.288872f, 9.484118f, -97.720505f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 76.046646f, 9.484118f, -95.573715f, 0.000000f, -1.000000f, -0.000002f, 0.000000f, 255.000000f },
+{ 74.507790f, 9.484118f, -93.751663f, -0.000001f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 72.154381f, 9.484118f, -93.999222f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 70.869621f, 9.484118f, -95.136749f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 69.684608f, 9.484118f, -97.015213f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 69.684608f, 9.484123f, -118.046249f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 116.042702f, 9.484123f, -111.377884f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 116.042702f, 9.484123f, -116.315048f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 112.247803f, 9.484123f, -118.552078f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 107.574234f, 9.484123f, -118.394455f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 103.539482f, 9.484123f, -115.040680f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 102.209610f, 9.484123f, -112.118805f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 101.385559f, 9.484118f, -108.374069f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 101.102959f, 9.484118f, -103.811813f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 101.339844f, 9.484118f, -99.454697f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 102.036247f, 9.484118f, -95.777939f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 103.170799f, 9.484106f, -92.831436f, 0.000002f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 104.722122f, 9.484118f, -90.665039f, -0.000001f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 107.933678f, 9.484118f, -88.927658f, 0.000000f, -1.000000f, 0.000003f, 0.000000f, 255.000000f },
+{ 111.632736f, 9.484118f, -89.470520f, 0.000001f, -1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 113.549179f, 9.484118f, -91.009384f, 0.000001f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 114.952675f, 9.484106f, -93.103928f, -0.000002f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 116.387047f, 9.484118f, -99.154877f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 116.619774f, 9.484118f, -104.965958f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 106.104248f, 9.484118f, -104.965958f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 106.676575f, 9.484123f, -110.009995f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 108.374535f, 9.484123f, -113.130463f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.169655f, 9.484123f, -114.199112f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 113.774490f, 9.484123f, -113.485794f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 106.040123f, 9.484118f, -101.247055f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.618484f, 9.484118f, -101.247055f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.312141f, 9.484118f, -96.746857f, -0.000001f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 110.364601f, 9.484118f, -94.098984f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 108.733131f, 9.484106f, -93.232178f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 107.208519f, 9.484118f, -94.113220f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 106.325096f, 9.484118f, -96.775345f, 0.000001f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 122.262253f, 9.484123f, -118.046249f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 122.262253f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 127.263535f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 127.391785f, 9.484118f, -97.335800f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 128.306671f, 9.484118f, -94.372665f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 129.111130f, 9.484118f, -92.203903f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 129.876404f, 9.484118f, -90.715500f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 131.574371f, 9.484118f, -89.323883f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 133.556717f, 9.484118f, -89.280533f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 135.214310f, 9.484118f, -90.026230f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 134.829590f, 9.484118f, -95.155746f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 132.649551f, 9.484118f, -94.450439f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 130.914764f, 9.484118f, -95.135269f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 129.543335f, 9.484118f, -96.915451f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 128.513855f, 9.484118f, -99.379593f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 127.804985f, 9.484118f, -102.116226f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 127.395340f, 9.484118f, -104.713943f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 127.263535f, 9.484123f, -118.046249f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 155.668289f, 9.484123f, -112.788498f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 155.668289f, 9.484123f, -116.571518f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 154.127060f, 9.484123f, -117.804031f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 152.305023f, 9.484123f, -118.637589f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 150.903000f, 9.484123f, -118.586227f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 149.472794f, 9.484123f, -117.781754f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 148.448669f, 9.484123f, -116.186508f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 148.102249f, 9.484123f, -115.096786f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 146.276031f, 9.484123f, -117.172348f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 142.652115f, 9.484123f, -118.815689f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 139.866501f, 9.484123f, -117.808792f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 137.850311f, 9.484123f, -115.206024f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 137.073761f, 9.484123f, -111.634354f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 138.144791f, 9.484118f, -107.571106f, 0.000001f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 141.623840f, 9.484118f, -104.049301f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 144.391052f, 9.484118f, -102.166397f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.909882f, 9.484118f, -100.028793f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.909882f, 9.484118f, -97.335800f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.180527f, 9.484118f, -94.538605f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 145.869064f, 9.484118f, -93.718704f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 143.898575f, 9.484118f, -93.732071f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 141.682312f, 9.484118f, -94.706924f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 137.779068f, 9.484118f, -98.297592f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 137.779068f, 9.484118f, -92.526871f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 141.658264f, 9.484118f, -89.665543f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 144.054428f, 9.484118f, -88.951340f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.152328f, 9.484118f, -89.072159f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 150.474655f, 9.484118f, -90.715500f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 152.600082f, 9.484118f, -94.111435f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 152.911179f, 9.484118f, -96.502243f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 152.932556f, 9.484123f, -113.100784f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 153.103531f, 9.484123f, -113.846451f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 153.680603f, 9.484123f, -114.199112f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 154.124680f, 9.484123f, -114.032883f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 154.796753f, 9.484123f, -113.553177f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.909882f, 9.484123f, -110.800797f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.909882f, 9.484118f, -103.491226f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 146.048050f, 9.484118f, -104.727600f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 144.556686f, 9.484118f, -105.944382f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 143.421539f, 9.484118f, -107.154037f, -0.000001f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 142.162918f, 9.484122f, -109.601837f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 142.329147f, 9.484123f, -112.551010f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 143.188812f, 9.484123f, -113.667160f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 144.447449f, 9.484123f, -114.070877f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 145.715591f, 9.484123f, -113.693283f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 146.898224f, 9.484123f, -112.589005f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.430771f, 9.484123f, -111.777725f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 173.749878f, 9.484123f, -112.467911f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 173.749878f, 9.484123f, -117.276840f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 172.085159f, 9.484123f, -118.160263f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 168.812698f, 9.484123f, -118.815689f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 166.009262f, 9.484123f, -118.315506f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 163.547806f, 9.484123f, -116.887375f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 161.503128f, 9.484123f, -114.639938f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 159.950012f, 9.484123f, -111.681854f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 158.963303f, 9.484118f, -108.121765f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 158.617767f, 9.484118f, -104.068314f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 159.531387f, 9.484118f, -96.903595f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 163.822617f, 9.484118f, -90.542221f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 169.115997f, 9.484118f, -88.872086f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 173.301041f, 9.484118f, -89.897995f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 173.301041f, 9.484118f, -95.027512f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 169.582138f, 9.484118f, -93.616898f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 166.473557f, 9.484118f, -94.882645f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 164.462112f, 9.484118f, -98.442444f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 163.747299f, 9.484118f, -103.940063f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 164.523849f, 9.484122f, -109.302322f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 166.711029f, 9.484123f, -112.812241f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 171.313354f, 9.484123f, -113.911758f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 188.369019f, 9.484123f, -113.301437f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 188.369019f, 9.484123f, -117.725662f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 186.637802f, 9.484123f, -118.378738f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 184.602036f, 9.484123f, -118.792831f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 182.419891f, 9.484123f, -118.666077f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 181.128311f, 9.484123f, -118.195877f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 180.089645f, 9.484123f, -117.373001f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 179.323486f, 9.484123f, -116.165436f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 178.849426f, 9.484123f, -114.541092f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 178.687042f, 9.484123f, -112.467911f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 178.687042f, 9.484118f, -94.001602f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 175.416977f, 9.484118f, -94.001602f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 178.200211f, 9.484118f, -89.945480f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 180.755478f, 9.484117f, -86.238449f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 183.239502f, 9.484117f, -82.331924f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 183.688324f, 9.484117f, -82.331924f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 183.688324f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 188.369019f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 188.369019f, 9.484118f, -94.001602f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 183.688324f, 9.484118f, -94.001602f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 183.724243f, 9.484123f, -111.466034f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 183.847443f, 9.484123f, -112.446518f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 184.448257f, 9.484123f, -113.686172f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 184.972198f, 9.484123f, -113.977371f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 186.488205f, 9.484123f, -113.985397f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 192.280289f, 9.484123f, -118.046249f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 192.280289f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 197.281570f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 197.281570f, 9.484123f, -118.046249f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 209.400085f, 9.484123f, -118.687454f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 200.872238f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 205.873535f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 210.041275f, 9.484118f, -105.863632f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 210.169510f, 9.484118f, -105.863632f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 214.337250f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 219.338531f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 210.810699f, 9.484123f, -118.687454f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ -227.530014f, 20.966755f, 18.889763f, 0.000000f, 1.000000f, 0.000000f, 11.312366f, 104.759421f },
+{ -227.530014f, 20.966747f, 49.094074f, 0.000000f, 1.000000f, 0.000000f, 24.483732f, 68.571394f },
+{ -220.271423f, 20.966747f, 49.922592f, 0.000000f, 1.000000f, 0.000000f, 33.541610f, 70.744042f },
+{ -214.348251f, 20.966747f, 52.198406f, 0.000000f, 1.000000f, 0.000000f, 41.630631f, 70.600318f },
+{ -209.753510f, 20.966751f, 55.606876f, 0.000000f, 1.000000f, 0.000000f, 48.621982f, 68.520264f },
+{ -206.480209f, 20.966751f, 59.833382f, 0.000000f, 1.000000f, 0.000000f, 54.386827f, 64.883844f },
+{ -204.521362f, 20.966751f, 64.563332f, 0.000000f, 1.000000f, 0.000000f, 58.796350f, 60.071068f },
+{ -203.869965f, 20.966747f, 69.482018f, 0.000000f, 1.000000f, 0.000000f, 61.721714f, 54.462006f },
+{ -204.699646f, 20.966745f, 74.975189f, 0.000000f, 1.000000f, 0.000000f, 63.123110f, 47.518791f },
+{ -207.067520f, 20.966745f, 79.783180f, 0.000000f, 1.000000f, 0.000000f, 62.382784f, 40.725728f },
+{ -210.791794f, 20.966745f, 83.766144f, 0.000000f, 1.000000f, 0.000000f, 59.657578f, 34.329638f },
+{ -215.690674f, 20.966745f, 86.784241f, 0.000000f, 1.000000f, 0.000000f, 55.104305f, 28.577339f },
+{ -221.582382f, 20.966745f, 88.697647f, 0.000000f, 1.000000f, 0.000000f, 48.879791f, 23.715652f },
+{ -228.285126f, 20.966745f, 89.366524f, 0.000000f, 1.000000f, 0.000000f, 41.140860f, 19.991366f },
+{ -233.272552f, 20.966745f, 89.153275f, 0.000000f, 1.000000f, 0.000000f, 35.072392f, 18.071967f },
+{ -238.232040f, 20.966745f, 88.499550f, 0.000000f, 1.000000f, 0.000000f, 28.845318f, 16.692474f },
+{ -243.261429f, 20.966745f, 87.384369f, 0.000000f, 1.000000f, 0.000000f, 22.333258f, 15.835392f },
+{ -248.458618f, 20.966745f, 85.786751f, 0.000000f, 1.000000f, 0.000000f, 15.409784f, 15.483151f },
+{ -253.921509f, 20.966745f, 83.685738f, 0.000000f, 1.000000f, 0.000000f, 7.948449f, 15.618150f },
+{ -259.747955f, 20.966745f, 81.060341f, 0.000000f, 1.000000f, 0.000000f, -0.177137f, 16.222895f },
+{ -259.747955f, 20.966743f, 111.264641f, 0.000000f, 1.000000f, 0.000000f, 12.994218f, -19.965132f },
+{ -253.885376f, 20.966743f, 113.571915f, 0.000000f, 1.000000f, 0.000000f, 21.024369f, -20.172966f },
+{ -247.666229f, 20.966742f, 115.459694f, 0.000000f, 1.000000f, 0.000000f, 29.298793f, -19.722705f },
+{ -241.153412f, 20.966742f, 116.927956f, 0.000000f, 1.000000f, 0.000000f, 37.742128f, -18.641769f },
+{ -234.409882f, 20.966742f, 117.976715f, 0.000000f, 1.000000f, 0.000000f, 46.278944f, -16.957608f },
+{ -227.498550f, 20.966742f, 118.605980f, 0.000000f, 1.000000f, 0.000000f, 54.833877f, -14.697672f },
+{ -220.482346f, 20.966742f, 118.815727f, 0.000000f, 1.000000f, 0.000000f, 63.331513f, -11.889380f },
+{ -205.143631f, 20.966742f, 117.432526f, 0.000000f, 1.000000f, 0.000000f, 81.105774f, -3.543295f },
+{ -191.825546f, 20.966743f, 113.455399f, 0.000000f, 1.000000f, 0.000000f, 95.327947f, 7.029410f },
+{ -180.870651f, 20.966740f, 107.143021f, 0.000000f, 1.000000f, 0.000000f, 105.700425f, 19.369491f },
+{ -172.621567f, 20.966740f, 98.754097f, 0.000000f, 1.000000f, 0.000000f, 111.925517f, 33.017553f },
+{ -167.420868f, 20.966738f, 88.547325f, 0.000000f, 1.000000f, 0.000000f, 113.705593f, 47.514262f },
+{ -165.611176f, 20.966738f, 76.781395f, 0.000000f, 1.000000f, 0.000000f, 110.742960f, 62.400282f },
+{ -166.340637f, 20.966747f, 68.696609f, 0.000000f, 1.000000f, 0.000000f, 106.343412f, 71.768634f },
+{ -168.510422f, 20.966751f, 61.101219f, 0.000000f, 1.000000f, 0.000000f, 100.431613f, 79.922540f },
+{ -172.092514f, 20.966747f, 54.065197f, 0.000000f, 1.000000f, 0.000000f, 93.071636f, 86.790398f },
+{ -177.058975f, 20.966749f, 47.658436f, 0.000000f, 1.000000f, 0.000000f, 84.327446f, 92.300634f },
+{ -183.381851f, 20.966749f, 41.950848f, 0.000000f, 1.000000f, 0.000000f, 74.263017f, 96.381691f },
+{ -191.033142f, 20.966749f, 37.012348f, 0.000000f, 1.000000f, 0.000000f, 62.942388f, 98.962011f },
+{ -181.454453f, 20.966749f, 32.298752f, 0.000000f, 1.000000f, 0.000000f, 72.363211f, 108.786445f },
+{ -173.805496f, 20.966751f, 26.319649f, 0.000000f, 1.000000f, 0.000000f, 78.920146f, 119.285570f },
+{ -168.002350f, 20.966755f, 19.235847f, 0.000000f, 1.000000f, 0.000000f, 82.783870f, 130.303345f },
+{ -163.961121f, 20.966755f, 11.208177f, 0.000000f, 1.000000f, 0.000000f, 84.125031f, 141.683643f },
+{ -161.597916f, 20.966753f, 2.397416f, 0.000000f, 1.000000f, 0.000000f, 83.114247f, 153.270422f },
+{ -160.828827f, 20.966753f, -7.035606f, 0.000000f, 1.000000f, 0.000000f, 79.922183f, 164.907587f },
+{ -162.772522f, 20.966755f, -21.426933f, 0.000000f, 1.000000f, 0.000000f, 71.317727f, 181.302347f },
+{ -168.407867f, 20.966755f, -33.734711f, 0.000000f, 1.000000f, 0.000000f, 59.198847f, 193.590963f },
+{ -177.441193f, 20.966757f, -43.721252f, 0.000000f, 1.000000f, 0.000000f, 44.021060f, 201.616710f },
+{ -189.578857f, 20.966757f, -51.148804f, 0.000000f, 1.000000f, 0.000000f, 26.239853f, 205.222777f },
+{ -204.527191f, 20.966757f, -55.779663f, 0.000000f, 1.000000f, 0.000000f, 6.310730f, 204.252446f },
+{ -221.992554f, 20.966764f, -57.376114f, 0.000000f, 1.000000f, 0.000000f, -15.310837f, 198.548949f },
+{ -229.371170f, 20.966764f, -57.068481f, 0.000000f, 1.000000f, 0.000000f, -24.017065f, 194.962735f },
+{ -236.805725f, 20.966764f, -56.173538f, 0.000000f, 1.000000f, 0.000000f, -32.534211f, 190.648469f },
+{ -244.142380f, 20.966764f, -54.733246f, 0.000000f, 1.000000f, 0.000000f, -40.696227f, 185.723508f },
+{ -251.227341f, 20.966764f, -52.789536f, 0.000000f, 1.000000f, 0.000000f, -48.337180f, 180.305151f },
+{ -257.906799f, 20.966764f, -50.384384f, 0.000000f, 1.000000f, 0.000000f, -55.291061f, 174.510773f },
+{ -264.026886f, 20.966764f, -47.559723f, 0.000000f, 1.000000f, 0.000000f, -61.391828f, 168.457698f },
+{ -264.026886f, 20.966753f, -14.334975f, 0.000000f, 1.000000f, 0.000000f, -46.903330f, 128.650867f },
+{ -257.339294f, 20.966755f, -18.662872f, 0.000000f, 1.000000f, 0.000000f, -40.778150f, 136.752450f },
+{ -251.050217f, 20.966759f, -22.109795f, 0.000000f, 1.000000f, 0.000000f, -34.746278f, 143.624746f },
+{ -245.054810f, 20.966759f, -24.717712f, 0.000000f, 1.000000f, 0.000000f, -28.700388f, 149.363761f },
+{ -239.248169f, 20.966759f, -26.528572f, 0.000000f, 1.000000f, 0.000000f, -22.533070f, 154.065507f },
+{ -233.525421f, 20.966759f, -27.584328f, 0.000000f, 1.000000f, 0.000000f, -16.136991f, 157.825968f },
+{ -227.781708f, 20.966759f, -27.926926f, 0.000000f, 1.000000f, 0.000000f, -9.404798f, 160.741125f },
+{ -220.280746f, 20.966759f, -27.192787f, 0.000000f, 1.000000f, 0.000000f, -0.097693f, 163.132535f },
+{ -213.751633f, 20.966759f, -25.074295f, 0.000000f, 1.000000f, 0.000000f, 8.648710f, 163.441542f },
+{ -208.369156f, 20.966755f, -21.697281f, 0.000000f, 1.000000f, 0.000000f, 16.570136f, 161.742676f },
+{ -204.308121f, 20.966755f, -17.187607f, 0.000000f, 1.000000f, 0.000000f, 23.402251f, 158.110519f },
+{ -201.743317f, 20.966753f, -11.671119f, 0.000000f, 1.000000f, 0.000000f, 28.880766f, 152.619616f },
+{ -200.849533f, 20.966753f, -5.273689f, 0.000000f, 1.000000f, 0.000000f, 32.741376f, 145.344564f },
+{ -201.724655f, 20.966753f, 1.288060f, 0.000000f, 1.000000f, 0.000000f, 34.554308f, 137.101256f },
+{ -204.242859f, 20.966751f, 7.031769f, 0.000000f, 1.000000f, 0.000000f, 34.041921f, 129.121548f },
+{ -208.243301f, 20.966755f, 11.810632f, 0.000000f, 1.000000f, 0.000000f, 31.332898f, 121.651460f },
+{ -213.565170f, 20.966755f, 15.477799f, 0.000000f, 1.000000f, 0.000000f, 26.555888f, 114.937053f },
+{ -220.047684f, 20.966755f, 17.886444f, 0.000000f, 1.000000f, 0.000000f, 19.839494f, 109.224379f },
+{ -148.686584f, 20.966726f, 116.550392f, 0.000000f, 1.000000f, 0.000000f, 148.362750f, 22.133128f },
+{ -72.924095f, 20.966726f, 116.550392f, 0.000000f, 1.000000f, 0.000000f, 239.134392f, 55.171292f },
+{ -44.133286f, 20.966728f, 113.442566f, 0.000000f, 1.000000f, 0.000000f, 272.273660f, 71.449770f },
+{ -20.467419f, 20.966740f, 104.692406f, 0.000000f, 1.000000f, 0.000000f, 296.812196f, 92.253517f },
+{ -1.975434f, 20.966738f, 91.159897f, 0.000000f, 1.000000f, 0.000000f, 313.066387f, 116.530840f },
+{ 11.293716f, 20.966730f, 73.705025f, 0.000000f, 1.000000f, 0.000000f, 321.352617f, 143.230008f },
+{ 19.291100f, 20.966740f, 53.187733f, 0.000000f, 1.000000f, 0.000000f, 321.987274f, 171.299414f },
+{ 21.967770f, 20.966734f, 30.467978f, 0.000000f, 1.000000f, 0.000000f, 315.286714f, 199.687280f },
+{ 19.338877f, 20.966743f, 6.999154f, 0.000000f, 1.000000f, 0.000000f, 301.902798f, 226.659158f },
+{ 11.340330f, 20.966745f, -13.645118f, 0.000000f, 1.000000f, 0.000000f, 283.317205f, 247.905264f },
+{ -2.195676f, 20.966759f, -30.821503f, 0.000000f, 1.000000f, 0.000000f, 259.609396f, 262.581703f },
+{ -21.436935f, 20.966757f, -43.886719f, 0.000000f, 1.000000f, 0.000000f, 230.858877f, 269.844599f },
+{ -46.551262f, 20.966757f, -52.197571f, 0.000000f, 1.000000f, 0.000000f, 197.145034f, 268.850158f },
+{ -77.706444f, 20.966757f, -55.110794f, 0.000000f, 1.000000f, 0.000000f, 158.547374f, 258.754495f },
+{ -148.686584f, 20.966757f, -55.110794f, 0.000000f, 1.000000f, 0.000000f, 73.505490f, 227.801797f },
+{ -105.897141f, 20.966738f, 85.087578f, 0.000000f, 1.000000f, 0.000000f, 185.908961f, 78.488406f },
+{ -105.897141f, 20.966759f, -23.647980f, 0.000000f, 1.000000f, 0.000000f, 138.492035f, 208.765369f },
+{ -77.958153f, 20.966759f, -23.647980f, 0.000000f, 1.000000f, 0.000000f, 171.965959f, 220.948887f },
+{ -58.874207f, 20.966755f, -21.368675f, 0.000000f, 1.000000f, 0.000000f, 195.824544f, 226.540074f },
+{ -44.341877f, 20.966753f, -15.146018f, 0.000000f, 1.000000f, 0.000000f, 215.949404f, 225.421851f },
+{ -33.878738f, 20.966745f, -5.902946f, 0.000000f, 1.000000f, 0.000000f, 232.516059f, 218.910365f },
+{ -27.002363f, 20.966743f, 5.437653f, 0.000000f, 1.000000f, 0.000000f, 245.700045f, 208.321724f },
+{ -23.230320f, 20.966747f, 17.952866f, 0.000000f, 1.000000f, 0.000000f, 255.676941f, 194.972041f },
+{ -22.080179f, 20.966734f, 30.719679f, 0.000000f, 1.000000f, 0.000000f, 262.622269f, 180.177478f },
+{ -23.442402f, 20.966742f, 44.972439f, 0.000000f, 1.000000f, 0.000000f, 267.205431f, 162.507187f },
+{ -27.692215f, 20.966743f, 57.903660f, 0.000000f, 1.000000f, 0.000000f, 267.752663f, 145.160943f },
+{ -35.074326f, 20.966740f, 68.947144f, 0.000000f, 1.000000f, 0.000000f, 263.723906f, 128.710501f },
+{ -45.833443f, 20.966738f, 77.536499f, 0.000000f, 1.000000f, 0.000000f, 254.578922f, 113.727730f },
+{ -60.214287f, 20.966738f, 83.105423f, 0.000000f, 1.000000f, 0.000000f, 239.777591f, 100.784424f },
+{ -78.461555f, 20.966738f, 85.087578f, 0.000000f, 1.000000f, 0.000000f, 218.779751f, 90.452398f },
+{ 53.459190f, 21.106728f, -63.834198f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.459190f, 21.106720f, 19.696632f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 34.431496f, 21.106720f, 19.696632f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 34.431496f, 21.106718f, 37.767292f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.459190f, 21.106718f, 37.767292f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.459190f, 21.106716f, 52.887684f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 54.761124f, 21.106716f, 61.040321f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 58.744659f, 21.106709f, 68.629570f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 65.526382f, 21.106707f, 75.245590f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 75.222885f, 21.106714f, 80.478653f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 87.950760f, 21.106714f, 83.918983f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 103.826599f, 21.106714f, 85.156822f, 0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 107.486267f, 21.106707f, 85.094505f, 0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.371353f, 21.106707f, 84.904137f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 115.334160f, 21.106707f, 84.580589f, -0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 119.227013f, 21.106707f, 84.118752f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 122.902229f, 21.106707f, 83.513496f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 126.212128f, 21.106707f, 82.759697f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 114.179916f, 21.106716f, 65.426567f, -0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 112.235428f, 21.106709f, 65.933655f, -0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 110.283180f, 21.106709f, 66.348541f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 108.268738f, 21.106709f, 66.671227f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 106.137703f, 21.106709f, 66.901718f, 0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 103.835670f, 21.106709f, 67.040016f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 101.308228f, 21.106709f, 67.086113f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 95.838806f, 21.106709f, 66.577324f, 0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 91.224388f, 21.106716f, 65.167046f, 0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 87.527145f, 21.106716f, 63.029400f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 84.809280f, 21.106716f, 60.338608f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 83.132957f, 21.106716f, 57.268780f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 21.106716f, 53.994068f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 21.106718f, 37.767292f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.661545f, 21.106718f, 37.767292f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.661545f, 21.106720f, 19.696632f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 21.106720f, 19.696632f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 82.560364f, 21.106728f, -63.834198f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 109.261765f, 21.106724f, -33.040283f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 158.509918f, 21.106720f, 10.661286f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 110.660858f, 21.106716f, 56.206806f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.037323f, 21.106716f, 56.206806f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 175.299042f, 21.106712f, 25.597252f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 203.001129f, 21.106716f, 56.206806f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 237.139038f, 21.106712f, 56.206806f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 189.569809f, 21.106720f, 11.767655f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 239.097778f, 21.106724f, -33.040283f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 202.161682f, 21.106724f, -33.040283f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 173.620132f, 21.106722f, -3.168342f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 143.679504f, 21.106724f, -33.040283f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 246.695496f, 21.106710f, 44.635105f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 246.695496f, 21.106709f, 54.095203f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 243.335144f, 21.106709f, 54.095203f, 0.000000f, 1.000000f, -0.000002f, 0.000000f, 255.000000f },
+{ 243.335144f, 21.106712f, 56.104115f, 0.000000f, 1.000000f, -0.000002f, 0.000000f, 255.000000f },
+{ 252.174316f, 21.106712f, 56.104115f, 0.000000f, 1.000000f, -0.000002f, 0.000000f, 255.000000f },
+{ 252.174316f, 21.106709f, 54.095203f, 0.000000f, 1.000000f, -0.000002f, 0.000000f, 255.000000f },
+{ 248.813965f, 21.106709f, 54.095203f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 248.813965f, 21.106710f, 44.635105f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 253.836212f, 21.106710f, 44.635105f, 0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 253.836212f, 21.106712f, 56.341526f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 258.931549f, 21.106709f, 51.191425f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 264.026886f, 21.106712f, 56.341526f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 264.026886f, 21.106710f, 44.635105f, -0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 261.908356f, 21.106710f, 44.635105f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 261.908356f, 21.106709f, 51.721058f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 258.931549f, 21.106709f, 48.634647f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 255.954681f, 21.106709f, 51.721058f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 255.954681f, 21.106710f, 44.635105f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.398365f, 21.091320f, -118.046234f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.398365f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 58.399651f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 58.399651f, 21.091320f, -118.046234f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 64.683319f, 21.091320f, -118.046234f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 64.683319f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 69.684608f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 69.684608f, 21.091311f, -92.719193f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 71.361206f, 21.091311f, -90.693512f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 75.070610f, 21.091311f, -89.192642f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 78.221947f, 21.091311f, -90.116440f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 80.447113f, 21.091311f, -92.906815f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 81.069901f, 21.091311f, -95.010880f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 81.290161f, 21.091311f, -97.592255f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 81.290161f, 21.091320f, -118.046234f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 76.288872f, 21.091320f, -118.046234f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 76.288872f, 21.091311f, -97.720490f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 76.046646f, 21.091311f, -95.573685f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 74.507790f, 21.091311f, -93.751633f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 72.154381f, 21.091311f, -93.999207f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 70.869621f, 21.091311f, -95.136734f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 69.684608f, 21.091311f, -97.015182f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 69.684608f, 21.091320f, -118.046234f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 116.042702f, 21.091320f, -111.377853f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 116.042702f, 21.091320f, -116.315018f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 112.247803f, 21.091320f, -118.552063f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 107.574234f, 21.091320f, -118.394440f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 103.539482f, 21.091320f, -115.040665f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 102.209610f, 21.091320f, -112.118790f, -0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 101.385559f, 21.091312f, -108.374054f, -0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 101.102959f, 21.091311f, -103.811798f, 0.000000f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 101.339844f, 21.091307f, -99.454666f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 102.036247f, 21.091311f, -95.777908f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 103.170799f, 21.091311f, -92.831406f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 104.722122f, 21.091311f, -90.665024f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 107.933678f, 21.091311f, -88.927628f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.632736f, 21.091311f, -89.470505f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 113.549179f, 21.091311f, -91.009354f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 114.952675f, 21.091311f, -93.103912f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 116.387047f, 21.091307f, -99.154861f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 116.619774f, 21.091309f, -104.965942f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 106.104248f, 21.091312f, -104.965942f, 0.000000f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 106.676575f, 21.091320f, -110.009979f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 108.374535f, 21.091320f, -113.130447f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.169655f, 21.091320f, -114.199097f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 113.774490f, 21.091320f, -113.485764f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 106.040123f, 21.091307f, -101.247040f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.618484f, 21.091307f, -101.247040f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 111.312141f, 21.091311f, -96.746841f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 110.364601f, 21.091311f, -94.098953f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 108.733131f, 21.091311f, -93.232162f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 107.208519f, 21.091311f, -94.113205f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 106.325096f, 21.091311f, -96.775330f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 122.262253f, 21.091320f, -118.046234f, 0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 122.262253f, 21.091311f, -89.641495f, -0.000003f, 1.000000f, -0.000002f, 0.000000f, 255.000000f },
+{ 127.263535f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 127.391785f, 21.091311f, -97.335770f, -0.000004f, 1.000000f, -0.000003f, 0.000000f, 255.000000f },
+{ 128.306671f, 21.091311f, -94.372635f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 129.111130f, 21.091311f, -92.203873f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 129.876404f, 21.091311f, -90.715469f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 131.574371f, 21.091311f, -89.323868f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 133.556717f, 21.091311f, -89.280518f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 135.214310f, 21.091311f, -90.026199f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 134.829590f, 21.091311f, -95.155716f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 132.649551f, 21.091311f, -94.450424f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 130.914764f, 21.091311f, -95.135239f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 129.543335f, 21.091311f, -96.915436f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 128.513855f, 21.091307f, -99.379562f, -0.000005f, 1.000000f, -0.000004f, 0.000000f, 255.000000f },
+{ 127.804985f, 21.091307f, -102.116196f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 127.395340f, 21.091309f, -104.713913f, 0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 127.263535f, 21.091320f, -118.046234f, 0.000000f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 155.668289f, 21.091312f, -112.788467f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 155.668289f, 21.091312f, -116.571503f, 0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 154.127060f, 21.091320f, -117.804016f, 0.000001f, 1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 152.305023f, 21.091320f, -118.637558f, 0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 150.903000f, 21.091320f, -118.586197f, 0.000000f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 149.472794f, 21.091320f, -117.781738f, 0.000003f, 1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 148.448669f, 21.091320f, -116.186478f, 0.000012f, 1.000000f, 0.000005f, 0.000000f, 255.000000f },
+{ 148.102249f, 21.091320f, -115.096756f, 0.000003f, 1.000000f, 0.000003f, 0.000000f, 255.000000f },
+{ 146.276031f, 21.091320f, -117.172318f, 0.000001f, 1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 142.652115f, 21.091320f, -118.815659f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 139.866501f, 21.091320f, -117.808762f, -0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 137.850311f, 21.091320f, -115.206009f, 0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 137.073761f, 21.091320f, -111.634323f, 0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 138.144791f, 21.091309f, -107.571091f, 0.000000f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 141.623840f, 21.091307f, -104.049286f, 0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 144.391052f, 21.091307f, -102.166382f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.909882f, 21.091307f, -100.028778f, -0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.909882f, 21.091311f, -97.335770f, -0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.180527f, 21.091311f, -94.538589f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 145.869064f, 21.091311f, -93.718689f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 143.898575f, 21.091311f, -93.732040f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 141.682312f, 21.091311f, -94.706894f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 137.779068f, 21.091307f, -98.297562f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 137.779068f, 21.091311f, -92.526840f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 141.658264f, 21.091311f, -89.665527f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 144.054428f, 21.091311f, -88.951309f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.152328f, 21.091311f, -89.072128f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 150.474655f, 21.091311f, -90.715469f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 152.600082f, 21.091311f, -94.111420f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 152.911179f, 21.091311f, -96.502228f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 152.932556f, 21.091312f, -113.100754f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 153.103531f, 21.091312f, -113.846436f, 0.000002f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 153.680603f, 21.091312f, -114.199097f, 0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 154.124680f, 21.091312f, -114.032852f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 154.796753f, 21.091312f, -113.553146f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 147.909882f, 21.091312f, -110.800781f, 0.000000f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 147.909882f, 21.091307f, -103.491211f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 146.048050f, 21.091309f, -104.727585f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 144.556686f, 21.091309f, -105.944351f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 143.421539f, 21.091309f, -107.154007f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 142.628372f, 21.091309f, -108.369003f, 0.000003f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 142.162918f, 21.091312f, -109.601822f, 0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 142.010925f, 21.091312f, -110.864899f, 0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 142.329147f, 21.091312f, -112.550995f, 0.000000f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 143.188812f, 21.091320f, -113.667130f, -0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 144.447449f, 21.091320f, -114.070847f, 0.000002f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 145.715591f, 21.091312f, -113.693268f, 0.000000f, 1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 146.898224f, 21.091312f, -112.588989f, -0.000002f, 1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 147.430771f, 21.091312f, -111.777710f, 0.000004f, 1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 173.749878f, 21.091312f, -112.467880f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 173.749878f, 21.091312f, -117.276810f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 172.085159f, 21.091312f, -118.160233f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 168.812698f, 21.091312f, -118.815659f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 166.009262f, 21.091312f, -118.315475f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 163.547806f, 21.091312f, -116.887344f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 161.503128f, 21.091312f, -114.639908f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 159.950012f, 21.091312f, -111.681839f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 158.963303f, 21.091309f, -108.121750f, 0.000000f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 158.617767f, 21.091307f, -104.068283f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 159.531387f, 21.091311f, -96.903564f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 163.822617f, 21.091311f, -90.542206f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 169.115997f, 21.091311f, -88.872055f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 173.301041f, 21.091311f, -89.897964f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 173.301041f, 21.091311f, -95.027481f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 169.582138f, 21.091311f, -93.616867f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 166.473557f, 21.091311f, -94.882629f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 164.462112f, 21.091307f, -98.442429f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 163.747299f, 21.091307f, -103.940048f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 164.523849f, 21.091312f, -109.302292f, 0.000000f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 166.711029f, 21.091312f, -112.812210f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 171.313354f, 21.091312f, -113.911743f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 188.369019f, 21.091312f, -113.301422f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 188.369019f, 21.091312f, -117.725632f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 186.637802f, 21.091312f, -118.378708f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 184.602036f, 21.091312f, -118.792801f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 182.419891f, 21.091312f, -118.666061f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 181.128311f, 21.091312f, -118.195847f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 180.089645f, 21.091312f, -117.372986f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 179.323486f, 21.091312f, -116.165421f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 178.849426f, 21.091312f, -114.541061f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 178.687042f, 21.091312f, -112.467880f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 178.687042f, 21.091311f, -94.001587f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 175.416977f, 21.091311f, -94.001587f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 178.200211f, 21.091311f, -89.945450f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 180.755478f, 21.091311f, -86.238419f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 183.239502f, 21.091309f, -82.331909f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 183.688324f, 21.091309f, -82.331909f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 183.688324f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 188.369019f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 188.369019f, 21.091311f, -94.001587f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 183.688324f, 21.091311f, -94.001587f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 183.847443f, 21.091312f, -112.446503f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 184.081055f, 21.091312f, -113.181198f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 184.972198f, 21.091312f, -113.977341f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 186.488205f, 21.091312f, -113.985367f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 192.280289f, 21.091312f, -118.046234f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 192.280289f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 197.281570f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 197.281570f, 21.091312f, -118.046234f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 209.400085f, 21.091312f, -118.687424f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 200.872238f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 205.873535f, 21.091311f, -89.641495f, 0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 210.041275f, 21.091309f, -105.863617f, 0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 210.169510f, 21.091309f, -105.863617f, -0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 214.337250f, 21.091311f, -89.641495f, -0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 219.338531f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 210.810699f, 21.091312f, -118.687424f, -0.000001f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 196.095139f, 9.401914f, -83.842834f, 0.000000f, -1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 197.530334f, 9.401917f, -82.099869f, 0.000000f, -1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 197.312714f, 9.401917f, -79.852554f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 195.569748f, 9.401917f, -78.417358f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 193.322433f, 9.401917f, -78.634979f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 191.887238f, 9.401917f, -80.377945f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 192.104858f, 9.401917f, -82.625259f, 0.000000f, -1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 193.847824f, 9.401914f, -84.060455f, 0.000000f, -1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 196.095139f, 21.005835f, -83.842834f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 197.530334f, 21.005833f, -82.099869f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 197.312714f, 21.005833f, -79.852554f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 195.569748f, 21.005836f, -78.417358f, 0.000000f, 1.000000f, -0.000002f, 0.000000f, 255.000000f },
+{ 193.322433f, 21.005836f, -78.634979f, 0.000000f, 1.000000f, -0.000002f, 0.000000f, 255.000000f },
+{ 191.887238f, 21.005833f, -80.377945f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 192.104858f, 21.005835f, -82.625259f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 193.847824f, 21.005835f, -84.060455f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 194.708786f, 21.005833f, -81.238907f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 194.708786f, 9.401917f, -81.238907f, 0.000000f, -1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 57.212021f, 9.401914f, -83.842834f, 0.000000f, -1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 58.647217f, 9.401917f, -82.099869f, 0.000000f, -1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 58.429596f, 9.401917f, -79.852554f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 56.686630f, 9.401917f, -78.417358f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 54.439316f, 9.401917f, -78.634979f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.004120f, 9.401917f, -80.377945f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 53.221741f, 9.401917f, -82.625259f, 0.000000f, -1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 54.964706f, 9.401914f, -84.060455f, 0.000000f, -1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 57.212021f, 21.005835f, -83.842834f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 58.647217f, 21.005833f, -82.099869f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 58.429596f, 21.005833f, -79.852554f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 56.686630f, 21.005836f, -78.417358f, 0.000000f, 1.000000f, -0.000002f, 0.000000f, 255.000000f },
+{ 54.439316f, 21.005836f, -78.634979f, 0.000000f, 1.000000f, -0.000002f, 0.000000f, 255.000000f },
+{ 53.004120f, 21.005833f, -80.377945f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 53.221741f, 21.005835f, -82.625259f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 54.964706f, 21.005835f, -84.060455f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 55.825668f, 21.005833f, -81.238907f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 55.825668f, 9.401917f, -81.238907f, 0.000000f, -1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 98.582520f, 9.484123f, -113.301437f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 98.582520f, 9.484123f, -117.725662f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 95.979660f, 9.484123f, -118.792831f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 92.633392f, 9.484123f, -118.666077f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 90.303146f, 9.484123f, -117.373001f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 89.062927f, 9.484123f, -114.541092f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 88.900543f, 9.484123f, -112.467911f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 88.900543f, 9.484118f, -94.001602f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 85.630478f, 9.484118f, -94.001602f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 88.413712f, 9.484118f, -89.945480f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 90.968979f, 9.484117f, -86.238449f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 93.453003f, 9.484117f, -82.331924f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 93.901825f, 9.484117f, -82.331924f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 93.901825f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 98.582520f, 9.484118f, -89.641510f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 98.582520f, 9.484118f, -94.001602f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 93.901825f, 9.484118f, -94.001602f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 94.060944f, 9.484123f, -112.446518f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 95.185699f, 9.484123f, -113.977371f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 96.701706f, 9.484123f, -113.985397f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 98.582520f, 21.091312f, -113.301422f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 98.582520f, 21.091312f, -117.725632f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 95.979660f, 21.091312f, -118.792801f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 92.633392f, 21.091312f, -118.666061f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 90.303146f, 21.091312f, -117.372986f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 89.062927f, 21.091312f, -114.541061f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 88.900543f, 21.091312f, -112.467880f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 88.900543f, 21.091311f, -94.001587f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 85.630478f, 21.091311f, -94.001587f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 88.413712f, 21.091311f, -89.945450f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 90.968979f, 21.091311f, -86.238419f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 93.453003f, 21.091309f, -82.331909f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 93.901825f, 21.091309f, -82.331909f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 93.901825f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 98.582520f, 21.091311f, -89.641495f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 98.582520f, 21.091311f, -94.001587f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 93.901825f, 21.091311f, -94.001587f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 94.047279f, 21.091312f, -112.455856f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 95.185699f, 21.091312f, -113.977341f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 96.701706f, 21.091312f, -113.985367f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 236.900940f, 9.484123f, -111.377884f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 236.900940f, 9.484123f, -116.315048f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 233.106049f, 9.484123f, -118.552078f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 228.432480f, 9.484123f, -118.394455f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 224.397736f, 9.484123f, -115.040680f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 223.067856f, 9.484123f, -112.118805f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 222.243805f, 9.484118f, -108.374069f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 221.961212f, 9.484118f, -103.811813f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 222.198090f, 9.484118f, -99.454697f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 222.894501f, 9.484118f, -95.777939f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 224.029053f, 9.484106f, -92.831436f, 0.000002f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 225.580368f, 9.484118f, -90.665039f, -0.000001f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 228.791931f, 9.484118f, -88.927658f, 0.000000f, -1.000000f, 0.000003f, 0.000000f, 255.000000f },
+{ 232.490982f, 9.484118f, -89.470520f, 0.000001f, -1.000000f, 0.000002f, 0.000000f, 255.000000f },
+{ 234.407425f, 9.484118f, -91.009384f, 0.000001f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 235.810913f, 9.484106f, -93.103928f, -0.000002f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 237.245300f, 9.484118f, -99.154877f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 237.478027f, 9.484118f, -104.965958f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 226.962494f, 9.484118f, -104.965958f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 227.534821f, 9.484123f, -110.009995f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 229.232788f, 9.484123f, -113.130463f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 232.027893f, 9.484123f, -114.199112f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 234.632736f, 9.484123f, -113.485794f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 226.898376f, 9.484118f, -101.247055f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 232.476730f, 9.484118f, -101.247055f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 232.170380f, 9.484118f, -96.746857f, -0.000001f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 231.222839f, 9.484118f, -94.098984f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 229.591370f, 9.484106f, -93.232178f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 228.066772f, 9.484118f, -94.113220f, 0.000000f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 227.183350f, 9.484118f, -96.775345f, 0.000001f, -1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 236.900940f, 21.091320f, -111.377853f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 236.900940f, 21.091320f, -116.315018f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 233.106049f, 21.091320f, -118.552063f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 228.432480f, 21.091320f, -118.394440f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 224.397736f, 21.091320f, -115.040665f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 223.067856f, 21.091320f, -112.118790f, -0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 222.243805f, 21.091312f, -108.374054f, -0.000001f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 221.961212f, 21.091311f, -103.811798f, 0.000000f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 222.198090f, 21.091307f, -99.454666f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 222.894501f, 21.091311f, -95.777908f, 0.000000f, 1.000000f, -0.000001f, 0.000000f, 255.000000f },
+{ 224.029053f, 21.091311f, -92.831406f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 225.580368f, 21.091311f, -90.665024f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 228.791931f, 21.091311f, -88.927628f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 232.490982f, 21.091311f, -89.470505f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 234.407425f, 21.091311f, -91.009354f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 235.810913f, 21.091311f, -93.103912f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 237.245300f, 21.091307f, -99.154861f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 237.478027f, 21.091309f, -104.965942f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 226.962494f, 21.091312f, -104.965942f, 0.000000f, 1.000000f, 0.000001f, 0.000000f, 255.000000f },
+{ 227.534821f, 21.091320f, -110.009979f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 229.232788f, 21.091320f, -113.130447f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 232.027893f, 21.091320f, -114.199097f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 234.632736f, 21.091320f, -113.485764f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 226.898376f, 21.091307f, -101.247040f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 232.476730f, 21.091307f, -101.247040f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 232.170380f, 21.091311f, -96.746841f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 231.222839f, 21.091311f, -94.098953f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 229.591370f, 21.091311f, -93.232162f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 228.066772f, 21.091311f, -94.113205f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f },
+{ 227.183350f, 21.091311f, -96.775330f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 255.000000f }
+};
+
+static Face face_1[] = {
+{ 1, 2, 350, 0, 4 },
+{ 1, 350, 349, 0, 3 },
+{ 2, 3, 351, 0, 4 },
+{ 2, 351, 350, 0, 2 },
+{ 3, 4, 352, 0, 4 },
+{ 3, 352, 351, 0, 2 },
+{ 4, 5, 353, 0, 4 },
+{ 4, 353, 352, 0, 2 },
+{ 5, 6, 354, 0, 4 },
+{ 5, 354, 353, 0, 2 },
+{ 6, 7, 355, 0, 4 },
+{ 6, 355, 354, 0, 2 },
+{ 7, 8, 356, 0, 4 },
+{ 7, 356, 355, 0, 2 },
+{ 8, 9, 357, 0, 4 },
+{ 8, 357, 356, 0, 2 },
+{ 9, 10, 358, 0, 4 },
+{ 9, 358, 357, 0, 2 },
+{ 10, 11, 359, 0, 4 },
+{ 10, 359, 358, 0, 2 },
+{ 11, 12, 360, 0, 4 },
+{ 11, 360, 359, 0, 2 },
+{ 12, 13, 361, 0, 4 },
+{ 12, 361, 360, 0, 2 },
+{ 13, 14, 362, 0, 4 },
+{ 13, 362, 361, 0, 2 },
+{ 14, 15, 363, 0, 4 },
+{ 14, 363, 362, 0, 2 },
+{ 15, 16, 364, 0, 4 },
+{ 15, 364, 363, 0, 2 },
+{ 16, 17, 365, 0, 4 },
+{ 16, 365, 364, 0, 2 },
+{ 17, 18, 366, 0, 4 },
+{ 17, 366, 365, 0, 2 },
+{ 18, 19, 367, 0, 6 },
+{ 18, 367, 366, 0, 2 },
+{ 20, 21, 369, 0, 4 },
+{ 20, 369, 368, 0, 3 },
+{ 21, 22, 370, 0, 4 },
+{ 21, 370, 369, 0, 2 },
+{ 22, 23, 371, 0, 4 },
+{ 22, 371, 370, 0, 2 },
+{ 23, 24, 372, 0, 4 },
+{ 23, 372, 371, 0, 2 },
+{ 24, 25, 373, 0, 4 },
+{ 24, 373, 372, 0, 2 },
+{ 25, 26, 374, 0, 4 },
+{ 25, 374, 373, 0, 2 },
+{ 26, 27, 375, 0, 4 },
+{ 26, 375, 374, 0, 2 },
+{ 27, 28, 376, 0, 4 },
+{ 27, 376, 375, 0, 2 },
+{ 28, 29, 377, 0, 4 },
+{ 28, 377, 376, 0, 2 },
+{ 29, 30, 378, 0, 4 },
+{ 29, 378, 377, 0, 2 },
+{ 30, 31, 379, 0, 4 },
+{ 30, 379, 378, 0, 2 },
+{ 31, 32, 380, 0, 4 },
+{ 31, 380, 379, 0, 2 },
+{ 32, 33, 381, 0, 4 },
+{ 32, 381, 380, 0, 2 },
+{ 33, 34, 382, 0, 4 },
+{ 33, 382, 381, 0, 2 },
+{ 34, 35, 383, 0, 4 },
+{ 34, 383, 382, 0, 2 },
+{ 35, 36, 384, 0, 4 },
+{ 35, 384, 383, 0, 2 },
+{ 36, 37, 385, 0, 4 },
+{ 36, 385, 384, 0, 2 },
+{ 37, 38, 386, 0, 4 },
+{ 37, 386, 385, 0, 2 },
+{ 38, 39, 387, 0, 4 },
+{ 38, 387, 386, 0, 2 },
+{ 39, 40, 388, 0, 4 },
+{ 39, 388, 387, 0, 2 },
+{ 40, 41, 389, 0, 4 },
+{ 40, 389, 388, 0, 2 },
+{ 41, 42, 390, 0, 4 },
+{ 41, 390, 389, 0, 2 },
+{ 42, 43, 391, 0, 4 },
+{ 42, 391, 390, 0, 2 },
+{ 43, 44, 392, 0, 4 },
+{ 43, 392, 391, 0, 2 },
+{ 44, 45, 393, 0, 4 },
+{ 44, 393, 392, 0, 2 },
+{ 45, 46, 394, 0, 4 },
+{ 45, 394, 393, 0, 2 },
+{ 46, 47, 395, 0, 4 },
+{ 46, 395, 394, 0, 2 },
+{ 47, 48, 396, 0, 4 },
+{ 47, 396, 395, 0, 2 },
+{ 48, 49, 397, 0, 4 },
+{ 48, 397, 396, 0, 2 },
+{ 49, 50, 398, 0, 4 },
+{ 49, 398, 397, 0, 2 },
+{ 50, 51, 399, 0, 4 },
+{ 50, 399, 398, 0, 2 },
+{ 51, 52, 400, 0, 4 },
+{ 51, 400, 399, 0, 2 },
+{ 52, 53, 401, 0, 4 },
+{ 52, 401, 400, 0, 2 },
+{ 53, 54, 402, 0, 4 },
+{ 53, 402, 401, 0, 2 },
+{ 54, 55, 403, 0, 4 },
+{ 54, 403, 402, 0, 2 },
+{ 55, 56, 404, 0, 6 },
+{ 55, 404, 403, 0, 2 },
+{ 57, 58, 406, 0, 4 },
+{ 57, 406, 405, 0, 3 },
+{ 58, 59, 407, 0, 4 },
+{ 58, 407, 406, 0, 2 },
+{ 59, 60, 408, 0, 4 },
+{ 59, 408, 407, 0, 2 },
+{ 60, 61, 409, 0, 4 },
+{ 60, 409, 408, 0, 2 },
+{ 61, 62, 410, 0, 4 },
+{ 61, 410, 409, 0, 2 },
+{ 62, 63, 411, 0, 4 },
+{ 62, 411, 410, 0, 2 },
+{ 63, 64, 412, 0, 4 },
+{ 63, 412, 411, 0, 2 },
+{ 64, 65, 413, 0, 4 },
+{ 64, 413, 412, 0, 2 },
+{ 65, 66, 414, 0, 4 },
+{ 65, 414, 413, 0, 2 },
+{ 66, 67, 415, 0, 4 },
+{ 66, 415, 414, 0, 2 },
+{ 67, 68, 416, 0, 4 },
+{ 67, 416, 415, 0, 2 },
+{ 68, 69, 417, 0, 4 },
+{ 68, 417, 416, 0, 2 },
+{ 69, 70, 418, 0, 4 },
+{ 69, 418, 417, 0, 2 },
+{ 70, 71, 419, 0, 4 },
+{ 70, 419, 418, 0, 2 },
+{ 71, 72, 420, 0, 4 },
+{ 71, 420, 419, 0, 2 },
+{ 72, 73, 421, 0, 4 },
+{ 72, 421, 420, 0, 2 },
+{ 73, 74, 422, 0, 4 },
+{ 73, 422, 421, 0, 2 },
+{ 74, 0, 348, 0, 6 },
+{ 74, 348, 422, 0, 2 },
+{ 75, 76, 424, 0, 4 },
+{ 75, 424, 423, 0, 3 },
+{ 76, 77, 425, 0, 4 },
+{ 76, 425, 424, 0, 2 },
+{ 77, 78, 426, 0, 4 },
+{ 77, 426, 425, 0, 2 },
+{ 78, 79, 427, 0, 4 },
+{ 78, 427, 426, 0, 2 },
+{ 79, 80, 428, 0, 4 },
+{ 79, 428, 427, 0, 2 },
+{ 80, 81, 429, 0, 4 },
+{ 80, 429, 428, 0, 2 },
+{ 81, 82, 430, 0, 4 },
+{ 81, 430, 429, 0, 2 },
+{ 82, 83, 431, 0, 4 },
+{ 82, 431, 430, 0, 2 },
+{ 83, 84, 432, 0, 4 },
+{ 83, 432, 431, 0, 2 },
+{ 84, 85, 433, 0, 4 },
+{ 84, 433, 432, 0, 2 },
+{ 85, 86, 434, 0, 4 },
+{ 85, 434, 433, 0, 2 },
+{ 86, 87, 435, 0, 4 },
+{ 86, 435, 434, 0, 2 },
+{ 87, 88, 436, 0, 4 },
+{ 87, 436, 435, 0, 2 },
+{ 88, 89, 437, 0, 6 },
+{ 88, 437, 436, 0, 2 },
+{ 90, 91, 439, 0, 4 },
+{ 90, 439, 438, 0, 2 },
+{ 91, 92, 440, 0, 4 },
+{ 91, 440, 439, 0, 2 },
+{ 92, 93, 441, 0, 4 },
+{ 92, 441, 440, 0, 2 },
+{ 93, 94, 442, 0, 4 },
+{ 93, 442, 441, 0, 2 },
+{ 94, 95, 443, 0, 4 },
+{ 94, 443, 442, 0, 2 },
+{ 95, 96, 444, 0, 4 },
+{ 95, 444, 443, 0, 2 },
+{ 96, 97, 445, 0, 4 },
+{ 96, 445, 444, 0, 2 },
+{ 97, 98, 446, 0, 4 },
+{ 97, 446, 445, 0, 2 },
+{ 98, 99, 447, 0, 4 },
+{ 98, 447, 446, 0, 2 },
+{ 99, 100, 448, 0, 4 },
+{ 99, 448, 447, 0, 2 },
+{ 100, 101, 449, 0, 4 },
+{ 100, 449, 448, 0, 2 },
+{ 101, 102, 450, 0, 4 },
+{ 101, 450, 449, 0, 2 },
+{ 102, 103, 451, 0, 4 },
+{ 102, 451, 450, 0, 2 },
+{ 103, 104, 452, 0, 4 },
+{ 103, 452, 451, 0, 2 },
+{ 104, 90, 438, 0, 4 },
+{ 104, 438, 452, 0, 2 },
+{ 106, 107, 455, 1, 6 },
+{ 106, 455, 454, 1, 3 },
+{ 108, 109, 457, 1, 4 },
+{ 108, 457, 456, 1, 3 },
+{ 109, 110, 458, 1, 4 },
+{ 109, 458, 457, 1, 2 },
+{ 110, 111, 459, 1, 4 },
+{ 110, 459, 458, 1, 2 },
+{ 111, 112, 460, 1, 4 },
+{ 111, 460, 459, 1, 2 },
+{ 112, 113, 461, 1, 4 },
+{ 112, 461, 460, 1, 2 },
+{ 113, 114, 462, 1, 4 },
+{ 113, 462, 461, 1, 2 },
+{ 114, 115, 463, 1, 4 },
+{ 114, 463, 462, 1, 2 },
+{ 115, 116, 464, 1, 4 },
+{ 115, 464, 463, 1, 2 },
+{ 116, 117, 465, 1, 4 },
+{ 116, 465, 464, 1, 2 },
+{ 117, 118, 466, 1, 4 },
+{ 117, 466, 465, 1, 2 },
+{ 118, 119, 467, 1, 4 },
+{ 118, 467, 466, 1, 2 },
+{ 119, 120, 468, 1, 4 },
+{ 119, 468, 467, 1, 2 },
+{ 120, 121, 469, 1, 4 },
+{ 120, 469, 468, 1, 2 },
+{ 121, 122, 470, 1, 4 },
+{ 121, 470, 469, 1, 2 },
+{ 122, 123, 471, 1, 4 },
+{ 122, 471, 470, 1, 2 },
+{ 123, 124, 472, 1, 4 },
+{ 123, 472, 471, 1, 2 },
+{ 124, 125, 473, 1, 4 },
+{ 124, 473, 472, 1, 2 },
+{ 125, 126, 474, 1, 4 },
+{ 125, 474, 473, 1, 2 },
+{ 126, 127, 475, 1, 4 },
+{ 126, 475, 474, 1, 2 },
+{ 127, 128, 476, 1, 4 },
+{ 127, 476, 475, 1, 2 },
+{ 128, 129, 477, 1, 4 },
+{ 128, 477, 476, 1, 2 },
+{ 129, 130, 478, 1, 4 },
+{ 129, 478, 477, 1, 2 },
+{ 130, 131, 479, 1, 4 },
+{ 130, 479, 478, 1, 2 },
+{ 131, 132, 480, 1, 4 },
+{ 131, 480, 479, 1, 2 },
+{ 132, 133, 481, 1, 4 },
+{ 132, 481, 480, 1, 2 },
+{ 133, 134, 482, 1, 4 },
+{ 133, 482, 481, 1, 2 },
+{ 134, 135, 483, 1, 4 },
+{ 134, 483, 482, 1, 2 },
+{ 135, 136, 484, 1, 4 },
+{ 135, 484, 483, 1, 2 },
+{ 136, 137, 485, 1, 6 },
+{ 136, 485, 484, 1, 2 },
+{ 138, 139, 487, 1, 6 },
+{ 138, 487, 486, 1, 3 },
+{ 140, 105, 453, 1, 6 },
+{ 140, 453, 488, 1, 3 },
+{ 141, 142, 490, 1, 4 },
+{ 141, 490, 489, 1, 2 },
+{ 142, 143, 491, 1, 4 },
+{ 142, 491, 490, 1, 2 },
+{ 143, 144, 492, 1, 4 },
+{ 143, 492, 491, 1, 2 },
+{ 144, 145, 493, 1, 4 },
+{ 144, 493, 492, 1, 2 },
+{ 145, 146, 494, 1, 4 },
+{ 145, 494, 493, 1, 2 },
+{ 146, 147, 495, 1, 4 },
+{ 146, 495, 494, 1, 2 },
+{ 147, 148, 496, 1, 4 },
+{ 147, 496, 495, 1, 2 },
+{ 148, 149, 497, 1, 4 },
+{ 148, 497, 496, 1, 2 },
+{ 149, 150, 498, 1, 4 },
+{ 149, 498, 497, 1, 2 },
+{ 150, 151, 499, 1, 4 },
+{ 150, 499, 498, 1, 2 },
+{ 151, 152, 500, 1, 4 },
+{ 151, 500, 499, 1, 2 },
+{ 152, 141, 489, 1, 4 },
+{ 152, 489, 500, 1, 2 },
+{ 153, 154, 502, 1, 4 },
+{ 153, 502, 501, 1, 2 },
+{ 154, 155, 503, 1, 4 },
+{ 154, 503, 502, 1, 2 },
+{ 155, 156, 504, 1, 4 },
+{ 155, 504, 503, 1, 2 },
+{ 156, 157, 505, 1, 4 },
+{ 156, 505, 504, 1, 2 },
+{ 157, 158, 506, 1, 4 },
+{ 157, 506, 505, 1, 2 },
+{ 158, 159, 507, 1, 4 },
+{ 158, 507, 506, 1, 2 },
+{ 159, 160, 508, 1, 4 },
+{ 159, 508, 507, 1, 2 },
+{ 160, 153, 501, 1, 4 },
+{ 160, 501, 508, 1, 2 },
+{ 161, 162, 510, 1, 4 },
+{ 161, 510, 509, 1, 2 },
+{ 162, 163, 511, 1, 4 },
+{ 162, 511, 510, 1, 2 },
+{ 163, 164, 512, 1, 4 },
+{ 163, 512, 511, 1, 2 },
+{ 164, 165, 513, 1, 4 },
+{ 164, 513, 512, 1, 2 },
+{ 165, 166, 514, 1, 4 },
+{ 165, 514, 513, 1, 2 },
+{ 166, 167, 515, 1, 4 },
+{ 166, 515, 514, 1, 2 },
+{ 167, 168, 516, 1, 4 },
+{ 167, 516, 515, 1, 2 },
+{ 168, 169, 517, 1, 4 },
+{ 168, 517, 516, 1, 2 },
+{ 169, 170, 518, 1, 4 },
+{ 169, 518, 517, 1, 2 },
+{ 170, 161, 509, 1, 4 },
+{ 170, 509, 518, 1, 2 },
+{ 171, 172, 520, 1, 4 },
+{ 171, 520, 519, 1, 2 },
+{ 172, 173, 521, 1, 4 },
+{ 172, 521, 520, 1, 2 },
+{ 173, 174, 522, 1, 4 },
+{ 173, 522, 521, 1, 2 },
+{ 174, 171, 519, 1, 4 },
+{ 174, 519, 522, 1, 2 },
+{ 175, 176, 524, 1, 4 },
+{ 175, 524, 523, 1, 2 },
+{ 176, 177, 525, 1, 4 },
+{ 176, 525, 524, 1, 2 },
+{ 177, 178, 526, 1, 4 },
+{ 177, 526, 525, 1, 2 },
+{ 178, 179, 527, 1, 4 },
+{ 178, 527, 526, 1, 2 },
+{ 179, 180, 528, 1, 4 },
+{ 179, 528, 527, 1, 2 },
+{ 180, 181, 529, 1, 4 },
+{ 180, 529, 528, 1, 2 },
+{ 181, 182, 530, 1, 4 },
+{ 181, 530, 529, 1, 2 },
+{ 182, 183, 531, 1, 4 },
+{ 182, 531, 530, 1, 2 },
+{ 183, 184, 532, 1, 4 },
+{ 183, 532, 531, 1, 2 },
+{ 184, 185, 533, 1, 4 },
+{ 184, 533, 532, 1, 2 },
+{ 185, 186, 534, 1, 4 },
+{ 185, 534, 533, 1, 2 },
+{ 186, 187, 535, 1, 4 },
+{ 186, 535, 534, 1, 2 },
+{ 187, 188, 536, 1, 4 },
+{ 187, 536, 535, 1, 2 },
+{ 188, 189, 537, 1, 4 },
+{ 188, 537, 536, 1, 2 },
+{ 189, 190, 538, 1, 4 },
+{ 189, 538, 537, 1, 2 },
+{ 190, 191, 539, 1, 4 },
+{ 190, 539, 538, 1, 2 },
+{ 191, 192, 540, 1, 4 },
+{ 191, 540, 539, 1, 2 },
+{ 192, 193, 541, 1, 4 },
+{ 192, 541, 540, 1, 2 },
+{ 193, 175, 523, 1, 4 },
+{ 193, 523, 541, 1, 2 },
+{ 194, 195, 543, 1, 4 },
+{ 194, 543, 542, 1, 2 },
+{ 195, 196, 544, 1, 4 },
+{ 195, 544, 543, 1, 2 },
+{ 196, 197, 545, 1, 4 },
+{ 196, 545, 544, 1, 2 },
+{ 197, 198, 546, 1, 4 },
+{ 197, 546, 545, 1, 2 },
+{ 198, 199, 547, 1, 4 },
+{ 198, 547, 546, 1, 2 },
+{ 199, 200, 548, 1, 4 },
+{ 199, 548, 547, 1, 2 },
+{ 200, 201, 549, 1, 4 },
+{ 200, 549, 548, 1, 2 },
+{ 201, 202, 550, 1, 4 },
+{ 201, 550, 549, 1, 2 },
+{ 202, 203, 551, 1, 4 },
+{ 202, 551, 550, 1, 2 },
+{ 203, 204, 552, 1, 4 },
+{ 203, 552, 551, 1, 2 },
+{ 204, 205, 553, 1, 4 },
+{ 204, 553, 552, 1, 2 },
+{ 205, 206, 554, 1, 4 },
+{ 205, 554, 553, 1, 2 },
+{ 206, 207, 555, 1, 4 },
+{ 206, 555, 554, 1, 2 },
+{ 207, 208, 556, 1, 4 },
+{ 207, 556, 555, 1, 2 },
+{ 208, 209, 557, 1, 4 },
+{ 208, 557, 556, 1, 2 },
+{ 209, 210, 558, 1, 4 },
+{ 209, 558, 557, 1, 2 },
+{ 210, 211, 559, 1, 4 },
+{ 210, 559, 558, 1, 2 },
+{ 211, 212, 560, 1, 4 },
+{ 211, 560, 559, 1, 2 },
+{ 212, 213, 561, 1, 4 },
+{ 212, 561, 560, 1, 2 },
+{ 213, 214, 562, 1, 4 },
+{ 213, 562, 561, 1, 2 },
+{ 214, 215, 563, 1, 4 },
+{ 214, 563, 562, 1, 2 },
+{ 215, 216, 564, 1, 4 },
+{ 215, 564, 563, 1, 2 },
+{ 216, 194, 542, 1, 4 },
+{ 216, 542, 564, 1, 2 },
+{ 217, 218, 566, 1, 4 },
+{ 217, 566, 565, 1, 2 },
+{ 218, 219, 567, 1, 4 },
+{ 218, 567, 566, 1, 2 },
+{ 219, 220, 568, 1, 4 },
+{ 219, 568, 567, 1, 2 },
+{ 220, 221, 569, 1, 4 },
+{ 220, 569, 568, 1, 2 },
+{ 221, 222, 570, 1, 4 },
+{ 221, 570, 569, 1, 2 },
+{ 222, 223, 571, 1, 4 },
+{ 222, 571, 570, 1, 2 },
+{ 223, 217, 565, 1, 4 },
+{ 223, 565, 571, 1, 2 },
+{ 224, 225, 573, 1, 4 },
+{ 224, 573, 572, 1, 2 },
+{ 225, 226, 574, 1, 4 },
+{ 225, 574, 573, 1, 2 },
+{ 226, 227, 575, 1, 4 },
+{ 226, 575, 574, 1, 2 },
+{ 227, 228, 576, 1, 4 },
+{ 227, 576, 575, 1, 2 },
+{ 228, 229, 577, 1, 4 },
+{ 228, 577, 576, 1, 2 },
+{ 229, 230, 578, 1, 4 },
+{ 229, 578, 577, 1, 2 },
+{ 230, 231, 579, 1, 4 },
+{ 230, 579, 578, 1, 2 },
+{ 231, 232, 580, 1, 4 },
+{ 231, 580, 579, 1, 2 },
+{ 232, 233, 581, 1, 4 },
+{ 232, 581, 580, 1, 2 },
+{ 233, 234, 582, 1, 4 },
+{ 233, 582, 581, 1, 2 },
+{ 234, 235, 583, 1, 4 },
+{ 234, 583, 582, 1, 2 },
+{ 235, 236, 584, 1, 4 },
+{ 235, 584, 583, 1, 2 },
+{ 236, 237, 585, 1, 4 },
+{ 236, 585, 584, 1, 2 },
+{ 237, 238, 586, 1, 4 },
+{ 237, 586, 585, 1, 2 },
+{ 238, 239, 587, 1, 4 },
+{ 238, 587, 586, 1, 2 },
+{ 239, 240, 588, 1, 4 },
+{ 239, 588, 587, 1, 2 },
+{ 240, 241, 589, 1, 4 },
+{ 240, 589, 588, 1, 2 },
+{ 241, 224, 572, 1, 4 },
+{ 241, 572, 589, 1, 2 },
+{ 242, 243, 591, 1, 4 },
+{ 242, 591, 590, 1, 2 },
+{ 243, 244, 592, 1, 4 },
+{ 243, 592, 591, 1, 2 },
+{ 244, 245, 593, 1, 4 },
+{ 244, 593, 592, 1, 2 },
+{ 245, 246, 594, 1, 4 },
+{ 245, 594, 593, 1, 2 },
+{ 246, 247, 595, 1, 4 },
+{ 246, 595, 594, 1, 2 },
+{ 247, 248, 596, 1, 4 },
+{ 247, 596, 595, 1, 2 },
+{ 248, 249, 597, 1, 4 },
+{ 248, 597, 596, 1, 2 },
+{ 249, 250, 598, 1, 4 },
+{ 249, 598, 597, 1, 2 },
+{ 250, 251, 599, 1, 4 },
+{ 250, 599, 598, 1, 2 },
+{ 251, 252, 600, 1, 4 },
+{ 251, 600, 599, 1, 2 },
+{ 252, 253, 601, 1, 4 },
+{ 252, 601, 600, 1, 2 },
+{ 253, 254, 602, 1, 4 },
+{ 253, 602, 601, 1, 2 },
+{ 254, 255, 603, 1, 4 },
+{ 254, 603, 602, 1, 2 },
+{ 255, 256, 604, 1, 4 },
+{ 255, 604, 603, 1, 2 },
+{ 256, 257, 605, 1, 4 },
+{ 256, 605, 604, 1, 2 },
+{ 257, 258, 606, 1, 4 },
+{ 257, 606, 605, 1, 2 },
+{ 258, 259, 607, 1, 4 },
+{ 258, 607, 606, 1, 2 },
+{ 259, 260, 608, 1, 4 },
+{ 259, 608, 607, 1, 2 },
+{ 260, 261, 609, 1, 4 },
+{ 260, 609, 608, 1, 2 },
+{ 261, 262, 610, 1, 4 },
+{ 261, 610, 609, 1, 2 },
+{ 262, 263, 611, 1, 4 },
+{ 262, 611, 610, 1, 2 },
+{ 263, 264, 611, 1, 4 },
+{ 264, 612, 611, 1, 2 },
+{ 264, 265, 613, 1, 4 },
+{ 264, 613, 612, 1, 2 },
+{ 265, 266, 614, 1, 4 },
+{ 265, 614, 613, 1, 2 },
+{ 266, 267, 615, 1, 4 },
+{ 266, 615, 614, 1, 2 },
+{ 267, 268, 616, 1, 4 },
+{ 267, 616, 615, 1, 2 },
+{ 268, 269, 617, 1, 4 },
+{ 268, 617, 616, 1, 2 },
+{ 269, 270, 618, 1, 4 },
+{ 269, 618, 617, 1, 2 },
+{ 270, 271, 619, 1, 4 },
+{ 270, 619, 618, 1, 2 },
+{ 271, 272, 620, 1, 4 },
+{ 271, 620, 619, 1, 2 },
+{ 272, 273, 621, 1, 4 },
+{ 272, 621, 620, 1, 2 },
+{ 273, 274, 622, 1, 4 },
+{ 273, 622, 621, 1, 2 },
+{ 274, 275, 623, 1, 4 },
+{ 274, 623, 622, 1, 2 },
+{ 275, 276, 624, 1, 4 },
+{ 275, 624, 623, 1, 2 },
+{ 276, 242, 590, 1, 4 },
+{ 276, 590, 624, 1, 2 },
+{ 277, 278, 626, 1, 4 },
+{ 277, 626, 625, 1, 2 },
+{ 278, 279, 627, 1, 4 },
+{ 278, 627, 626, 1, 2 },
+{ 279, 280, 628, 1, 4 },
+{ 279, 628, 627, 1, 2 },
+{ 280, 281, 629, 1, 4 },
+{ 280, 629, 628, 1, 2 },
+{ 281, 630, 629, 1, 2 },
+{ 281, 282, 631, 1, 4 },
+{ 281, 631, 630, 1, 2 },
+{ 282, 632, 631, 1, 2 },
+{ 282, 283, 633, 1, 4 },
+{ 282, 633, 632, 1, 2 },
+{ 283, 284, 634, 1, 4 },
+{ 283, 634, 633, 1, 2 },
+{ 284, 285, 635, 1, 4 },
+{ 284, 635, 634, 1, 2 },
+{ 285, 286, 636, 1, 4 },
+{ 285, 636, 635, 1, 2 },
+{ 286, 287, 637, 1, 4 },
+{ 286, 637, 636, 1, 2 },
+{ 287, 288, 638, 1, 4 },
+{ 287, 638, 637, 1, 2 },
+{ 288, 277, 625, 1, 4 },
+{ 288, 625, 638, 1, 2 },
+{ 289, 290, 640, 1, 4 },
+{ 289, 640, 639, 1, 2 },
+{ 290, 291, 641, 1, 4 },
+{ 290, 641, 640, 1, 2 },
+{ 291, 292, 642, 1, 4 },
+{ 291, 642, 641, 1, 2 },
+{ 292, 293, 643, 1, 4 },
+{ 292, 643, 642, 1, 2 },
+{ 293, 294, 644, 1, 4 },
+{ 293, 644, 643, 1, 2 },
+{ 294, 295, 645, 1, 4 },
+{ 294, 645, 644, 1, 2 },
+{ 295, 296, 646, 1, 4 },
+{ 295, 646, 645, 1, 2 },
+{ 296, 297, 647, 1, 4 },
+{ 296, 647, 646, 1, 2 },
+{ 297, 298, 648, 1, 4 },
+{ 297, 648, 647, 1, 2 },
+{ 298, 299, 649, 1, 4 },
+{ 298, 649, 648, 1, 2 },
+{ 299, 300, 650, 1, 4 },
+{ 299, 650, 649, 1, 2 },
+{ 300, 301, 651, 1, 4 },
+{ 300, 651, 650, 1, 2 },
+{ 301, 302, 652, 1, 4 },
+{ 301, 652, 651, 1, 2 },
+{ 302, 303, 653, 1, 4 },
+{ 302, 653, 652, 1, 2 },
+{ 303, 304, 654, 1, 4 },
+{ 303, 654, 653, 1, 2 },
+{ 304, 305, 655, 1, 4 },
+{ 304, 655, 654, 1, 2 },
+{ 305, 306, 656, 1, 4 },
+{ 305, 656, 655, 1, 2 },
+{ 306, 307, 657, 1, 4 },
+{ 306, 657, 656, 1, 2 },
+{ 307, 308, 658, 1, 4 },
+{ 307, 658, 657, 1, 2 },
+{ 308, 309, 659, 1, 4 },
+{ 308, 659, 658, 1, 2 },
+{ 309, 310, 660, 1, 4 },
+{ 309, 660, 659, 1, 2 },
+{ 310, 289, 639, 1, 4 },
+{ 310, 639, 660, 1, 2 },
+{ 311, 312, 662, 1, 4 },
+{ 311, 662, 661, 1, 2 },
+{ 312, 313, 663, 1, 4 },
+{ 312, 663, 662, 1, 2 },
+{ 313, 314, 664, 1, 4 },
+{ 313, 664, 663, 1, 2 },
+{ 314, 315, 665, 1, 4 },
+{ 314, 665, 664, 1, 2 },
+{ 315, 316, 666, 1, 4 },
+{ 315, 666, 665, 1, 2 },
+{ 316, 317, 667, 1, 4 },
+{ 316, 667, 666, 1, 2 },
+{ 317, 318, 668, 1, 4 },
+{ 317, 668, 667, 1, 2 },
+{ 318, 319, 669, 1, 4 },
+{ 318, 669, 668, 1, 2 },
+{ 319, 320, 670, 1, 4 },
+{ 319, 670, 669, 1, 2 },
+{ 320, 321, 671, 1, 4 },
+{ 320, 671, 670, 1, 2 },
+{ 321, 322, 672, 1, 4 },
+{ 321, 672, 671, 1, 2 },
+{ 322, 323, 673, 1, 4 },
+{ 322, 673, 672, 1, 2 },
+{ 323, 324, 674, 1, 4 },
+{ 323, 674, 673, 1, 2 },
+{ 324, 325, 675, 1, 4 },
+{ 324, 675, 674, 1, 2 },
+{ 325, 326, 676, 1, 4 },
+{ 325, 676, 675, 1, 2 },
+{ 326, 327, 677, 1, 4 },
+{ 326, 677, 676, 1, 2 },
+{ 327, 328, 678, 1, 4 },
+{ 327, 678, 677, 1, 2 },
+{ 328, 329, 679, 1, 4 },
+{ 328, 679, 678, 1, 2 },
+{ 329, 330, 680, 1, 4 },
+{ 329, 680, 679, 1, 2 },
+{ 330, 331, 681, 1, 4 },
+{ 330, 681, 680, 1, 2 },
+{ 331, 332, 681, 1, 4 },
+{ 332, 682, 681, 1, 2 },
+{ 332, 333, 683, 1, 4 },
+{ 332, 683, 682, 1, 2 },
+{ 333, 334, 683, 1, 4 },
+{ 334, 335, 684, 1, 4 },
+{ 334, 684, 683, 1, 2 },
+{ 335, 311, 661, 1, 4 },
+{ 335, 661, 684, 1, 2 },
+{ 336, 337, 686, 1, 4 },
+{ 336, 686, 685, 1, 2 },
+{ 337, 338, 687, 1, 4 },
+{ 337, 687, 686, 1, 2 },
+{ 338, 339, 688, 1, 4 },
+{ 338, 688, 687, 1, 2 },
+{ 339, 336, 685, 1, 4 },
+{ 339, 685, 688, 1, 2 },
+{ 340, 341, 690, 1, 4 },
+{ 340, 690, 689, 1, 2 },
+{ 341, 342, 691, 1, 4 },
+{ 341, 691, 690, 1, 2 },
+{ 342, 343, 692, 1, 4 },
+{ 342, 692, 691, 1, 2 },
+{ 343, 344, 693, 1, 4 },
+{ 343, 693, 692, 1, 2 },
+{ 344, 345, 694, 1, 4 },
+{ 344, 694, 693, 1, 2 },
+{ 345, 346, 695, 1, 4 },
+{ 345, 695, 694, 1, 2 },
+{ 346, 347, 696, 1, 4 },
+{ 346, 696, 695, 1, 2 },
+{ 347, 340, 689, 1, 4 },
+{ 347, 689, 696, 1, 2 },
+{ 706, 698, 697, 1, 2 },
+{ 705, 706, 697, 1, 4 },
+{ 707, 699, 698, 1, 2 },
+{ 706, 707, 698, 1, 4 },
+{ 708, 700, 699, 1, 2 },
+{ 707, 708, 699, 1, 4 },
+{ 709, 701, 700, 1, 2 },
+{ 708, 709, 700, 1, 4 },
+{ 710, 702, 701, 1, 2 },
+{ 709, 710, 701, 1, 4 },
+{ 711, 703, 702, 1, 2 },
+{ 710, 711, 702, 1, 4 },
+{ 712, 704, 703, 1, 2 },
+{ 711, 712, 703, 1, 4 },
+{ 705, 697, 704, 1, 2 },
+{ 712, 705, 704, 1, 4 },
+{ 722, 714, 713, 1, 2 },
+{ 721, 722, 713, 1, 4 },
+{ 723, 715, 714, 1, 2 },
+{ 722, 723, 714, 1, 4 },
+{ 724, 716, 715, 1, 2 },
+{ 723, 724, 715, 1, 4 },
+{ 725, 717, 716, 1, 2 },
+{ 724, 725, 716, 1, 4 },
+{ 726, 718, 717, 1, 2 },
+{ 725, 726, 717, 1, 4 },
+{ 727, 719, 718, 1, 2 },
+{ 726, 727, 718, 1, 4 },
+{ 728, 720, 719, 1, 2 },
+{ 727, 728, 719, 1, 4 },
+{ 721, 713, 720, 1, 2 },
+{ 728, 721, 720, 1, 4 },
+{ 729, 730, 750, 1, 4 },
+{ 729, 750, 749, 1, 2 },
+{ 730, 731, 751, 1, 4 },
+{ 730, 751, 750, 1, 2 },
+{ 731, 732, 752, 1, 4 },
+{ 731, 752, 751, 1, 2 },
+{ 732, 733, 753, 1, 4 },
+{ 732, 753, 752, 1, 2 },
+{ 733, 734, 754, 1, 4 },
+{ 733, 754, 753, 1, 2 },
+{ 734, 735, 755, 1, 4 },
+{ 734, 755, 754, 1, 2 },
+{ 735, 736, 756, 1, 4 },
+{ 735, 756, 755, 1, 2 },
+{ 736, 737, 757, 1, 4 },
+{ 736, 757, 756, 1, 2 },
+{ 737, 738, 758, 1, 4 },
+{ 737, 758, 757, 1, 2 },
+{ 738, 739, 759, 1, 4 },
+{ 738, 759, 758, 1, 2 },
+{ 739, 740, 760, 1, 4 },
+{ 739, 760, 759, 1, 2 },
+{ 740, 741, 761, 1, 4 },
+{ 740, 761, 760, 1, 2 },
+{ 741, 742, 762, 1, 4 },
+{ 741, 762, 761, 1, 2 },
+{ 742, 743, 763, 1, 4 },
+{ 742, 763, 762, 1, 2 },
+{ 743, 744, 764, 1, 4 },
+{ 743, 764, 763, 1, 2 },
+{ 744, 745, 765, 1, 4 },
+{ 744, 765, 764, 1, 2 },
+{ 745, 746, 766, 1, 4 },
+{ 745, 766, 765, 1, 2 },
+{ 746, 747, 767, 1, 4 },
+{ 746, 767, 766, 1, 2 },
+{ 747, 748, 768, 1, 4 },
+{ 747, 768, 767, 1, 2 },
+{ 748, 729, 749, 1, 4 },
+{ 748, 749, 768, 1, 2 },
+{ 769, 770, 800, 1, 4 },
+{ 769, 800, 799, 1, 2 },
+{ 770, 771, 801, 1, 4 },
+{ 770, 801, 800, 1, 2 },
+{ 771, 772, 802, 1, 4 },
+{ 771, 802, 801, 1, 2 },
+{ 772, 773, 803, 1, 4 },
+{ 772, 803, 802, 1, 2 },
+{ 773, 774, 804, 1, 4 },
+{ 773, 804, 803, 1, 2 },
+{ 774, 775, 805, 1, 4 },
+{ 774, 805, 804, 1, 2 },
+{ 775, 776, 806, 1, 4 },
+{ 775, 806, 805, 1, 2 },
+{ 776, 777, 807, 1, 4 },
+{ 776, 807, 806, 1, 2 },
+{ 777, 778, 808, 1, 4 },
+{ 777, 808, 807, 1, 2 },
+{ 778, 779, 809, 1, 4 },
+{ 778, 809, 808, 1, 2 },
+{ 779, 780, 810, 1, 4 },
+{ 779, 810, 809, 1, 2 },
+{ 780, 781, 811, 1, 4 },
+{ 780, 811, 810, 1, 2 },
+{ 781, 782, 812, 1, 4 },
+{ 781, 812, 811, 1, 2 },
+{ 782, 783, 813, 1, 4 },
+{ 782, 813, 812, 1, 2 },
+{ 783, 784, 814, 1, 4 },
+{ 783, 814, 813, 1, 2 },
+{ 784, 785, 815, 1, 4 },
+{ 784, 815, 814, 1, 2 },
+{ 785, 786, 816, 1, 4 },
+{ 785, 816, 815, 1, 2 },
+{ 786, 787, 817, 1, 4 },
+{ 786, 817, 816, 1, 2 },
+{ 787, 788, 818, 1, 4 },
+{ 787, 818, 817, 1, 2 },
+{ 788, 789, 819, 1, 4 },
+{ 788, 819, 818, 1, 2 },
+{ 789, 790, 820, 1, 4 },
+{ 789, 820, 819, 1, 2 },
+{ 790, 791, 821, 1, 4 },
+{ 790, 821, 820, 1, 2 },
+{ 791, 769, 799, 1, 4 },
+{ 791, 799, 821, 1, 2 },
+{ 792, 793, 823, 1, 4 },
+{ 792, 823, 822, 1, 2 },
+{ 793, 794, 824, 1, 4 },
+{ 793, 824, 823, 1, 2 },
+{ 794, 795, 825, 1, 4 },
+{ 794, 825, 824, 1, 2 },
+{ 795, 796, 826, 1, 4 },
+{ 795, 826, 825, 1, 2 },
+{ 796, 797, 827, 1, 4 },
+{ 796, 827, 826, 1, 2 },
+{ 797, 798, 828, 1, 4 },
+{ 797, 828, 827, 1, 2 },
+{ 798, 792, 822, 1, 4 },
+{ 798, 822, 828, 1, 2 },
+{ 829, 830, 846, 0, 6 },
+{ 829, 846, 845, 0, 3 },
+{ 831, 832, 848, 0, 6 },
+{ 831, 848, 847, 0, 3 },
+{ 833, 834, 850, 0, 6 },
+{ 833, 850, 849, 0, 3 },
+{ 836, 835, 851, 0, 6 },
+{ 836, 851, 852, 0, 3 },
+{ 837, 838, 854, 1, 6 },
+{ 837, 854, 853, 1, 3 },
+{ 839, 840, 856, 1, 6 },
+{ 839, 856, 855, 1, 3 },
+{ 841, 842, 858, 1, 6 },
+{ 841, 858, 857, 1, 3 },
+{ 843, 844, 860, 1, 6 },
+{ 843, 860, 859, 1, 3 },
+{ 919, 918, 917, 0, 6 },
+{ 881, 880, 879, 0, 6 },
+{ 920, 919, 917, 0, 4 },
+{ 881, 879, 878, 0, 2 },
+{ 882, 881, 878, 0, 4 },
+{ 882, 878, 877, 0, 2 },
+{ 883, 882, 877, 0, 4 },
+{ 883, 877, 876, 0, 2 },
+{ 884, 883, 876, 0, 4 },
+{ 920, 917, 916, 0, 2 },
+{ 921, 920, 916, 0, 4 },
+{ 921, 916, 915, 0, 2 },
+{ 922, 921, 915, 0, 4 },
+{ 922, 915, 914, 0, 2 },
+{ 884, 876, 875, 0, 2 },
+{ 885, 884, 875, 0, 4 },
+{ 923, 922, 914, 0, 4 },
+{ 923, 914, 913, 0, 2 },
+{ 885, 875, 874, 0, 2 },
+{ 886, 885, 874, 0, 4 },
+{ 923, 913, 912, 0, 2 },
+{ 924, 923, 912, 0, 4 },
+{ 924, 912, 911, 0, 2 },
+{ 925, 924, 911, 0, 4 },
+{ 925, 911, 910, 0, 2 },
+{ 926, 925, 910, 0, 4 },
+{ 926, 910, 909, 0, 2 },
+{ 927, 926, 909, 0, 4 },
+{ 927, 909, 908, 0, 2 },
+{ 928, 927, 908, 0, 4 },
+{ 928, 908, 907, 0, 2 },
+{ 929, 928, 907, 0, 4 },
+{ 929, 907, 906, 0, 2 },
+{ 929, 906, 905, 0, 2 },
+{ 930, 929, 905, 0, 4 },
+{ 930, 905, 904, 0, 2 },
+{ 930, 904, 903, 0, 2 },
+{ 931, 930, 903, 0, 4 },
+{ 931, 903, 902, 0, 2 },
+{ 931, 902, 901, 0, 2 },
+{ 932, 931, 901, 0, 4 },
+{ 932, 901, 900, 0, 2 },
+{ 932, 900, 899, 0, 2 },
+{ 933, 932, 899, 0, 4 },
+{ 934, 933, 899, 0, 4 },
+{ 887, 886, 874, 0, 4 },
+{ 887, 874, 873, 0, 2 },
+{ 888, 887, 873, 0, 4 },
+{ 888, 873, 872, 0, 2 },
+{ 889, 888, 872, 0, 4 },
+{ 889, 872, 871, 0, 2 },
+{ 890, 889, 871, 0, 4 },
+{ 890, 871, 870, 0, 2 },
+{ 891, 890, 870, 0, 4 },
+{ 892, 891, 870, 0, 4 },
+{ 892, 870, 869, 0, 2 },
+{ 893, 892, 869, 0, 4 },
+{ 894, 893, 869, 0, 4 },
+{ 894, 869, 868, 0, 2 },
+{ 895, 894, 868, 0, 4 },
+{ 896, 895, 868, 0, 4 },
+{ 896, 868, 867, 0, 2 },
+{ 897, 896, 867, 0, 4 },
+{ 898, 897, 867, 0, 4 },
+{ 898, 867, 866, 0, 2 },
+{ 899, 898, 866, 0, 4 },
+{ 899, 866, 865, 0, 2 },
+{ 934, 899, 865, 0, 0 },
+{ 934, 865, 864, 0, 2 },
+{ 935, 934, 864, 0, 4 },
+{ 935, 864, 863, 0, 2 },
+{ 861, 935, 863, 0, 4 },
+{ 862, 861, 863, 0, 5 },
+{ 959, 943, 942, 0, 2 },
+{ 960, 959, 942, 0, 4 },
+{ 960, 942, 941, 0, 2 },
+{ 961, 960, 941, 0, 4 },
+{ 961, 941, 940, 0, 2 },
+{ 962, 961, 940, 0, 4 },
+{ 962, 940, 939, 0, 2 },
+{ 963, 962, 939, 0, 4 },
+{ 963, 939, 938, 0, 2 },
+{ 964, 963, 938, 0, 4 },
+{ 964, 938, 937, 0, 2 },
+{ 965, 964, 937, 0, 4 },
+{ 937, 936, 951, 0, 4 },
+{ 951, 965, 937, 0, 4 },
+{ 951, 936, 950, 0, 2 },
+{ 952, 951, 950, 0, 4 },
+{ 952, 950, 949, 0, 2 },
+{ 953, 952, 949, 0, 4 },
+{ 944, 943, 959, 0, 4 },
+{ 944, 959, 958, 0, 2 },
+{ 945, 944, 958, 0, 4 },
+{ 945, 958, 957, 0, 2 },
+{ 946, 945, 957, 0, 4 },
+{ 946, 957, 956, 0, 2 },
+{ 947, 946, 956, 0, 4 },
+{ 947, 956, 955, 0, 2 },
+{ 948, 947, 955, 0, 4 },
+{ 948, 955, 954, 0, 2 },
+{ 949, 948, 954, 0, 4 },
+{ 953, 949, 954, 0, 1 },
+{ 984, 983, 982, 1, 6 },
+{ 984, 982, 981, 1, 2 },
+{ 984, 981, 980, 1, 2 },
+{ 985, 984, 980, 1, 4 },
+{ 985, 980, 979, 1, 2 },
+{ 986, 985, 979, 1, 4 },
+{ 987, 986, 979, 1, 4 },
+{ 987, 979, 978, 1, 2 },
+{ 988, 987, 978, 1, 4 },
+{ 988, 978, 977, 1, 2 },
+{ 989, 988, 977, 1, 4 },
+{ 989, 977, 976, 1, 2 },
+{ 990, 989, 976, 1, 4 },
+{ 991, 990, 976, 1, 4 },
+{ 992, 991, 976, 1, 4 },
+{ 992, 976, 975, 1, 2 },
+{ 993, 992, 975, 1, 4 },
+{ 966, 1001, 1000, 1, 6 },
+{ 967, 966, 1000, 1, 4 },
+{ 1000, 999, 998, 1, 6 },
+{ 1000, 998, 997, 1, 2 },
+{ 967, 1000, 997, 1, 0 },
+{ 970, 969, 968, 1, 6 },
+{ 970, 968, 967, 1, 2 },
+{ 970, 967, 997, 1, 0 },
+{ 970, 997, 996, 1, 2 },
+{ 971, 970, 996, 1, 4 },
+{ 972, 971, 996, 1, 4 },
+{ 973, 972, 996, 1, 4 },
+{ 973, 996, 995, 1, 2 },
+{ 974, 973, 995, 1, 4 },
+{ 974, 995, 994, 1, 2 },
+{ 975, 974, 994, 1, 4 },
+{ 993, 975, 994, 1, 1 },
+{ 1003, 1002, 1013, 1, 6 },
+{ 1003, 1013, 1012, 1, 2 },
+{ 1011, 1010, 1009, 1, 6 },
+{ 1012, 1011, 1009, 1, 4 },
+{ 1009, 1008, 1007, 1, 6 },
+{ 1009, 1007, 1006, 1, 2 },
+{ 1005, 1004, 1003, 1, 6 },
+{ 1006, 1005, 1003, 1, 4 },
+{ 1006, 1003, 1012, 1, 0 },
+{ 1006, 1012, 1009, 1, 0 },
+{ 1014, 1021, 1020, 1, 6 },
+{ 1015, 1014, 1020, 1, 4 },
+{ 1020, 1019, 1018, 1, 6 },
+{ 1020, 1018, 1017, 1, 2 },
+{ 1015, 1020, 1017, 1, 0 },
+{ 1016, 1015, 1017, 1, 5 },
+{ 1022, 1031, 1030, 1, 6 },
+{ 1023, 1022, 1030, 1, 4 },
+{ 1024, 1023, 1030, 1, 4 },
+{ 1024, 1030, 1029, 1, 2 },
+{ 1024, 1029, 1028, 1, 2 },
+{ 1025, 1024, 1028, 1, 4 },
+{ 1026, 1025, 1028, 1, 4 },
+{ 1026, 1028, 1027, 1, 3 },
+{ 1032, 1035, 1034, 1, 6 },
+{ 1033, 1032, 1034, 1, 5 },
+{ 1036, 1054, 1053, 1, 6 },
+{ 1037, 1036, 1053, 1, 4 },
+{ 1053, 1052, 1039, 1, 4 },
+{ 1048, 1047, 1046, 1, 6 },
+{ 1048, 1046, 1045, 1, 2 },
+{ 1048, 1045, 1044, 1, 2 },
+{ 1049, 1048, 1044, 1, 4 },
+{ 1049, 1044, 1043, 1, 2 },
+{ 1050, 1049, 1043, 1, 4 },
+{ 1050, 1043, 1042, 1, 2 },
+{ 1050, 1042, 1041, 1, 2 },
+{ 1050, 1041, 1040, 1, 2 },
+{ 1051, 1050, 1040, 1, 4 },
+{ 1051, 1040, 1039, 1, 2 },
+{ 1039, 1038, 1037, 1, 6 },
+{ 1039, 1037, 1053, 1, 0 },
+{ 1051, 1039, 1052, 1, 1 },
+{ 1063, 1062, 1078, 1, 4 },
+{ 1064, 1063, 1078, 1, 4 },
+{ 1064, 1078, 1084, 1, 2 },
+{ 1056, 1055, 1077, 1, 6 },
+{ 1065, 1064, 1084, 1, 4 },
+{ 1065, 1084, 1083, 1, 2 },
+{ 1066, 1065, 1083, 1, 4 },
+{ 1066, 1083, 1082, 1, 2 },
+{ 1067, 1066, 1082, 1, 4 },
+{ 1068, 1067, 1082, 1, 4 },
+{ 1069, 1068, 1082, 1, 4 },
+{ 1069, 1082, 1081, 1, 2 },
+{ 1070, 1069, 1081, 1, 4 },
+{ 1070, 1081, 1080, 1, 2 },
+{ 1071, 1070, 1080, 1, 4 },
+{ 1071, 1080, 1079, 1, 2 },
+{ 1072, 1071, 1079, 1, 4 },
+{ 1073, 1072, 1079, 1, 4 },
+{ 1073, 1079, 1078, 1, 2 },
+{ 1073, 1078, 1062, 1, 0 },
+{ 1073, 1062, 1061, 1, 2 },
+{ 1073, 1061, 1060, 1, 2 },
+{ 1074, 1073, 1060, 1, 4 },
+{ 1074, 1060, 1059, 1, 2 },
+{ 1075, 1074, 1059, 1, 4 },
+{ 1075, 1059, 1058, 1, 2 },
+{ 1076, 1075, 1058, 1, 4 },
+{ 1076, 1058, 1057, 1, 2 },
+{ 1076, 1057, 1056, 1, 2 },
+{ 1077, 1076, 1056, 1, 4 },
+{ 1085, 1102, 1101, 1, 6 },
+{ 1086, 1085, 1101, 1, 4 },
+{ 1086, 1101, 1100, 1, 2 },
+{ 1100, 1099, 1088, 1, 4 },
+{ 1088, 1087, 1086, 1, 6 },
+{ 1088, 1086, 1100, 1, 0 },
+{ 1088, 1099, 1098, 1, 2 },
+{ 1089, 1088, 1098, 1, 4 },
+{ 1089, 1098, 1097, 1, 2 },
+{ 1090, 1089, 1097, 1, 4 },
+{ 1096, 1095, 1094, 1, 6 },
+{ 1090, 1097, 1096, 1, 2 },
+{ 1091, 1090, 1096, 1, 4 },
+{ 1096, 1094, 1093, 1, 2 },
+{ 1092, 1091, 1096, 1, 4 },
+{ 1093, 1092, 1096, 1, 4 },
+{ 1133, 1149, 1148, 1, 2 },
+{ 1107, 1106, 1133, 1, 4 },
+{ 1108, 1107, 1133, 1, 4 },
+{ 1109, 1108, 1133, 1, 4 },
+{ 1110, 1109, 1133, 1, 4 },
+{ 1148, 1110, 1133, 1, 0 },
+{ 1104, 1103, 1137, 1, 6 },
+{ 1104, 1137, 1136, 1, 2 },
+{ 1126, 1125, 1124, 1, 6 },
+{ 1127, 1126, 1124, 1, 4 },
+{ 1127, 1124, 1123, 1, 2 },
+{ 1128, 1127, 1123, 1, 4 },
+{ 1128, 1123, 1122, 1, 2 },
+{ 1129, 1128, 1122, 1, 4 },
+{ 1130, 1129, 1122, 1, 4 },
+{ 1130, 1122, 1121, 1, 2 },
+{ 1131, 1130, 1121, 1, 4 },
+{ 1132, 1131, 1121, 1, 4 },
+{ 1132, 1121, 1120, 1, 2 },
+{ 1132, 1120, 1119, 1, 2 },
+{ 1132, 1119, 1139, 1, 0 },
+{ 1104, 1136, 1135, 1, 2 },
+{ 1110, 1148, 1147, 1, 2 },
+{ 1111, 1110, 1147, 1, 4 },
+{ 1111, 1147, 1146, 1, 2 },
+{ 1105, 1104, 1135, 1, 4 },
+{ 1112, 1111, 1146, 1, 4 },
+{ 1112, 1146, 1145, 1, 2 },
+{ 1113, 1112, 1145, 1, 4 },
+{ 1113, 1145, 1144, 1, 2 },
+{ 1114, 1113, 1144, 1, 4 },
+{ 1115, 1114, 1144, 1, 4 },
+{ 1115, 1144, 1143, 1, 2 },
+{ 1116, 1115, 1143, 1, 4 },
+{ 1117, 1116, 1143, 1, 4 },
+{ 1117, 1143, 1142, 1, 2 },
+{ 1117, 1142, 1141, 1, 2 },
+{ 1118, 1117, 1141, 1, 4 },
+{ 1118, 1141, 1140, 1, 2 },
+{ 1119, 1118, 1140, 1, 4 },
+{ 1119, 1140, 1139, 1, 2 },
+{ 1132, 1139, 1138, 1, 2 },
+{ 1138, 1133, 1132, 1, 2 },
+{ 1133, 1138, 1149, 1, 2 },
+{ 1134, 1133, 1106, 1, 4 },
+{ 1135, 1134, 1106, 1, 4 },
+{ 1135, 1106, 1105, 1, 2 },
+{ 1163, 1165, 1164, 1, 3 },
+{ 1165, 1163, 1162, 1, 2 },
+{ 1151, 1150, 1171, 1, 6 },
+{ 1165, 1162, 1161, 1, 2 },
+{ 1166, 1165, 1161, 1, 4 },
+{ 1166, 1161, 1160, 1, 2 },
+{ 1167, 1166, 1160, 1, 4 },
+{ 1167, 1160, 1159, 1, 2 },
+{ 1168, 1167, 1159, 1, 4 },
+{ 1168, 1159, 1158, 1, 2 },
+{ 1169, 1168, 1158, 1, 4 },
+{ 1169, 1158, 1157, 1, 2 },
+{ 1170, 1169, 1157, 1, 4 },
+{ 1170, 1157, 1156, 1, 2 },
+{ 1170, 1156, 1155, 1, 2 },
+{ 1170, 1155, 1154, 1, 2 },
+{ 1170, 1154, 1153, 1, 2 },
+{ 1171, 1170, 1153, 1, 4 },
+{ 1171, 1153, 1152, 1, 2 },
+{ 1171, 1152, 1151, 1, 2 },
+{ 1191, 1190, 1189, 1, 6 },
+{ 1191, 1189, 1188, 1, 2 },
+{ 1188, 1187, 1186, 1, 6 },
+{ 1188, 1186, 1185, 1, 2 },
+{ 1184, 1183, 1182, 1, 6 },
+{ 1173, 1172, 1196, 1, 6 },
+{ 1174, 1173, 1196, 1, 4 },
+{ 1175, 1174, 1196, 1, 4 },
+{ 1175, 1196, 1195, 1, 2 },
+{ 1176, 1175, 1195, 1, 4 },
+{ 1176, 1195, 1194, 1, 2 },
+{ 1177, 1176, 1194, 1, 4 },
+{ 1178, 1177, 1194, 1, 4 },
+{ 1179, 1178, 1194, 1, 4 },
+{ 1179, 1194, 1193, 1, 2 },
+{ 1180, 1179, 1193, 1, 4 },
+{ 1181, 1180, 1193, 1, 4 },
+{ 1181, 1193, 1192, 1, 2 },
+{ 1182, 1181, 1192, 1, 4 },
+{ 1182, 1192, 1191, 1, 2 },
+{ 1182, 1191, 1188, 1, 0 },
+{ 1182, 1188, 1185, 1, 0 },
+{ 1182, 1185, 1184, 1, 2 },
+{ 1197, 1200, 1199, 1, 6 },
+{ 1198, 1197, 1199, 1, 5 },
+{ 1203, 1202, 1201, 1, 6 },
+{ 1204, 1203, 1201, 1, 4 },
+{ 1208, 1207, 1206, 1, 6 },
+{ 1208, 1206, 1205, 1, 2 },
+{ 1201, 1208, 1205, 1, 4 },
+{ 1204, 1201, 1205, 1, 1 },
+{ 1265, 1266, 1267, 0, 6 },
+{ 1227, 1228, 1229, 0, 6 },
+{ 1265, 1267, 1268, 0, 2 },
+{ 1226, 1227, 1229, 0, 4 },
+{ 1226, 1229, 1230, 0, 2 },
+{ 1225, 1226, 1230, 0, 4 },
+{ 1225, 1230, 1231, 0, 2 },
+{ 1224, 1225, 1231, 0, 4 },
+{ 1224, 1231, 1232, 0, 2 },
+{ 1264, 1265, 1268, 0, 4 },
+{ 1264, 1268, 1269, 0, 2 },
+{ 1263, 1264, 1269, 0, 4 },
+{ 1263, 1269, 1270, 0, 2 },
+{ 1262, 1263, 1270, 0, 4 },
+{ 1223, 1224, 1232, 0, 4 },
+{ 1223, 1232, 1233, 0, 2 },
+{ 1262, 1270, 1271, 0, 2 },
+{ 1261, 1262, 1271, 0, 4 },
+{ 1222, 1223, 1233, 0, 4 },
+{ 1222, 1233, 1234, 0, 2 },
+{ 1260, 1261, 1271, 0, 4 },
+{ 1260, 1271, 1272, 0, 2 },
+{ 1259, 1260, 1272, 0, 4 },
+{ 1259, 1272, 1273, 0, 2 },
+{ 1258, 1259, 1273, 0, 4 },
+{ 1258, 1273, 1274, 0, 2 },
+{ 1257, 1258, 1274, 0, 4 },
+{ 1257, 1274, 1275, 0, 2 },
+{ 1256, 1257, 1275, 0, 4 },
+{ 1256, 1275, 1276, 0, 2 },
+{ 1255, 1256, 1276, 0, 4 },
+{ 1255, 1276, 1277, 0, 2 },
+{ 1254, 1255, 1277, 0, 4 },
+{ 1253, 1254, 1277, 0, 4 },
+{ 1253, 1277, 1278, 0, 2 },
+{ 1252, 1253, 1278, 0, 4 },
+{ 1251, 1252, 1278, 0, 4 },
+{ 1251, 1278, 1279, 0, 2 },
+{ 1250, 1251, 1279, 0, 4 },
+{ 1249, 1250, 1279, 0, 4 },
+{ 1249, 1279, 1280, 0, 2 },
+{ 1248, 1249, 1280, 0, 4 },
+{ 1247, 1248, 1280, 0, 4 },
+{ 1247, 1280, 1281, 0, 2 },
+{ 1247, 1281, 1282, 0, 2 },
+{ 1222, 1234, 1235, 0, 2 },
+{ 1221, 1222, 1235, 0, 4 },
+{ 1221, 1235, 1236, 0, 2 },
+{ 1220, 1221, 1236, 0, 4 },
+{ 1220, 1236, 1237, 0, 2 },
+{ 1219, 1220, 1237, 0, 4 },
+{ 1219, 1237, 1238, 0, 2 },
+{ 1218, 1219, 1238, 0, 4 },
+{ 1218, 1238, 1239, 0, 2 },
+{ 1218, 1239, 1240, 0, 2 },
+{ 1217, 1218, 1240, 0, 4 },
+{ 1217, 1240, 1241, 0, 2 },
+{ 1217, 1241, 1242, 0, 2 },
+{ 1216, 1217, 1242, 0, 4 },
+{ 1216, 1242, 1243, 0, 2 },
+{ 1216, 1243, 1244, 0, 2 },
+{ 1215, 1216, 1244, 0, 4 },
+{ 1215, 1244, 1245, 0, 2 },
+{ 1215, 1245, 1246, 0, 2 },
+{ 1214, 1215, 1246, 0, 4 },
+{ 1214, 1246, 1247, 0, 2 },
+{ 1213, 1214, 1247, 0, 4 },
+{ 1213, 1247, 1282, 0, 0 },
+{ 1212, 1213, 1282, 0, 4 },
+{ 1212, 1282, 1283, 0, 2 },
+{ 1211, 1212, 1283, 0, 4 },
+{ 1211, 1283, 1209, 0, 2 },
+{ 1211, 1209, 1210, 0, 3 },
+{ 1290, 1291, 1307, 0, 4 },
+{ 1290, 1307, 1308, 0, 2 },
+{ 1289, 1290, 1308, 0, 4 },
+{ 1289, 1308, 1309, 0, 2 },
+{ 1288, 1289, 1309, 0, 4 },
+{ 1288, 1309, 1310, 0, 2 },
+{ 1287, 1288, 1310, 0, 4 },
+{ 1287, 1310, 1311, 0, 2 },
+{ 1286, 1287, 1311, 0, 4 },
+{ 1286, 1311, 1312, 0, 2 },
+{ 1285, 1286, 1312, 0, 4 },
+{ 1285, 1312, 1313, 0, 2 },
+{ 1284, 1285, 1313, 0, 4 },
+{ 1284, 1313, 1299, 0, 2 },
+{ 1298, 1284, 1299, 0, 4 },
+{ 1298, 1299, 1300, 0, 2 },
+{ 1297, 1298, 1300, 0, 4 },
+{ 1297, 1300, 1301, 0, 2 },
+{ 1307, 1291, 1292, 0, 2 },
+{ 1306, 1307, 1292, 0, 4 },
+{ 1306, 1292, 1293, 0, 2 },
+{ 1305, 1306, 1293, 0, 4 },
+{ 1305, 1293, 1294, 0, 2 },
+{ 1304, 1305, 1294, 0, 4 },
+{ 1304, 1294, 1295, 0, 2 },
+{ 1303, 1304, 1295, 0, 4 },
+{ 1303, 1295, 1296, 0, 2 },
+{ 1302, 1303, 1296, 0, 4 },
+{ 1302, 1296, 1297, 0, 2 },
+{ 1302, 1297, 1301, 0, 1 },
+{ 1330, 1331, 1332, 1, 6 },
+{ 1329, 1330, 1332, 1, 4 },
+{ 1328, 1329, 1332, 1, 4 },
+{ 1328, 1332, 1333, 1, 2 },
+{ 1327, 1328, 1333, 1, 4 },
+{ 1327, 1333, 1334, 1, 2 },
+{ 1327, 1334, 1335, 1, 2 },
+{ 1326, 1327, 1335, 1, 4 },
+{ 1326, 1335, 1336, 1, 2 },
+{ 1325, 1326, 1336, 1, 4 },
+{ 1325, 1336, 1337, 1, 2 },
+{ 1324, 1325, 1337, 1, 4 },
+{ 1324, 1337, 1338, 1, 2 },
+{ 1324, 1338, 1339, 1, 2 },
+{ 1324, 1339, 1340, 1, 2 },
+{ 1323, 1324, 1340, 1, 4 },
+{ 1323, 1340, 1341, 1, 2 },
+{ 1348, 1349, 1314, 1, 6 },
+{ 1348, 1314, 1315, 1, 2 },
+{ 1346, 1347, 1348, 1, 6 },
+{ 1345, 1346, 1348, 1, 4 },
+{ 1345, 1348, 1315, 1, 0 },
+{ 1316, 1317, 1318, 1, 6 },
+{ 1315, 1316, 1318, 1, 4 },
+{ 1345, 1315, 1318, 1, 0 },
+{ 1344, 1345, 1318, 1, 4 },
+{ 1344, 1318, 1319, 1, 2 },
+{ 1344, 1319, 1320, 1, 2 },
+{ 1344, 1320, 1321, 1, 2 },
+{ 1343, 1344, 1321, 1, 4 },
+{ 1343, 1321, 1322, 1, 2 },
+{ 1342, 1343, 1322, 1, 4 },
+{ 1342, 1322, 1323, 1, 2 },
+{ 1342, 1323, 1341, 1, 1 },
+{ 1361, 1350, 1351, 1, 6 },
+{ 1360, 1361, 1351, 1, 4 },
+{ 1357, 1358, 1359, 1, 6 },
+{ 1357, 1359, 1360, 1, 2 },
+{ 1355, 1356, 1357, 1, 6 },
+{ 1354, 1355, 1357, 1, 4 },
+{ 1351, 1352, 1353, 1, 6 },
+{ 1351, 1353, 1354, 1, 2 },
+{ 1360, 1351, 1354, 1, 0 },
+{ 1357, 1360, 1354, 1, 0 },
+{ 1368, 1369, 1362, 1, 6 },
+{ 1368, 1362, 1363, 1, 2 },
+{ 1366, 1367, 1368, 1, 6 },
+{ 1365, 1366, 1368, 1, 4 },
+{ 1365, 1368, 1363, 1, 0 },
+{ 1365, 1363, 1364, 1, 3 },
+{ 1378, 1379, 1370, 1, 6 },
+{ 1378, 1370, 1371, 1, 2 },
+{ 1378, 1371, 1372, 1, 2 },
+{ 1377, 1378, 1372, 1, 4 },
+{ 1376, 1377, 1372, 1, 4 },
+{ 1376, 1372, 1373, 1, 2 },
+{ 1376, 1373, 1374, 1, 2 },
+{ 1375, 1376, 1374, 1, 5 },
+{ 1382, 1383, 1380, 1, 6 },
+{ 1382, 1380, 1381, 1, 3 },
+{ 1401, 1402, 1384, 1, 6 },
+{ 1401, 1384, 1385, 1, 2 },
+{ 1400, 1401, 1385, 1, 4 },
+{ 1394, 1395, 1396, 1, 6 },
+{ 1393, 1394, 1396, 1, 4 },
+{ 1392, 1393, 1396, 1, 4 },
+{ 1392, 1396, 1397, 1, 2 },
+{ 1391, 1392, 1397, 1, 4 },
+{ 1391, 1397, 1398, 1, 2 },
+{ 1390, 1391, 1398, 1, 4 },
+{ 1389, 1390, 1398, 1, 4 },
+{ 1388, 1389, 1398, 1, 4 },
+{ 1388, 1398, 1399, 1, 2 },
+{ 1387, 1388, 1399, 1, 4 },
+{ 1385, 1386, 1387, 1, 6 },
+{ 1400, 1385, 1387, 1, 0 },
+{ 1400, 1387, 1399, 1, 1 },
+{ 1426, 1410, 1411, 1, 2 },
+{ 1426, 1411, 1412, 1, 2 },
+{ 1432, 1426, 1412, 1, 4 },
+{ 1425, 1403, 1404, 1, 6 },
+{ 1432, 1412, 1413, 1, 2 },
+{ 1431, 1432, 1413, 1, 4 },
+{ 1431, 1413, 1414, 1, 2 },
+{ 1430, 1431, 1414, 1, 4 },
+{ 1430, 1414, 1415, 1, 2 },
+{ 1430, 1415, 1416, 1, 2 },
+{ 1430, 1416, 1417, 1, 2 },
+{ 1429, 1430, 1417, 1, 4 },
+{ 1429, 1417, 1418, 1, 2 },
+{ 1428, 1429, 1418, 1, 4 },
+{ 1428, 1418, 1419, 1, 2 },
+{ 1427, 1428, 1419, 1, 4 },
+{ 1427, 1419, 1420, 1, 2 },
+{ 1427, 1420, 1421, 1, 2 },
+{ 1426, 1427, 1421, 1, 4 },
+{ 1410, 1426, 1421, 1, 0 },
+{ 1409, 1410, 1421, 1, 4 },
+{ 1408, 1409, 1421, 1, 4 },
+{ 1408, 1421, 1422, 1, 2 },
+{ 1407, 1408, 1422, 1, 4 },
+{ 1407, 1422, 1423, 1, 2 },
+{ 1406, 1407, 1423, 1, 4 },
+{ 1406, 1423, 1424, 1, 2 },
+{ 1405, 1406, 1424, 1, 4 },
+{ 1404, 1405, 1424, 1, 4 },
+{ 1404, 1424, 1425, 1, 2 },
+{ 1449, 1450, 1433, 1, 6 },
+{ 1449, 1433, 1434, 1, 2 },
+{ 1448, 1449, 1434, 1, 4 },
+{ 1447, 1448, 1434, 1, 4 },
+{ 1434, 1435, 1436, 1, 6 },
+{ 1447, 1434, 1436, 1, 0 },
+{ 1446, 1447, 1436, 1, 4 },
+{ 1446, 1436, 1437, 1, 2 },
+{ 1445, 1446, 1437, 1, 4 },
+{ 1445, 1437, 1438, 1, 2 },
+{ 1442, 1443, 1444, 1, 6 },
+{ 1444, 1445, 1438, 1, 4 },
+{ 1444, 1438, 1439, 1, 2 },
+{ 1441, 1442, 1444, 1, 4 },
+{ 1444, 1439, 1440, 1, 2 },
+{ 1444, 1440, 1441, 1, 2 },
+{ 1499, 1486, 1454, 1, 4 },
+{ 1499, 1454, 1455, 1, 2 },
+{ 1499, 1455, 1456, 1, 2 },
+{ 1499, 1456, 1457, 1, 2 },
+{ 1499, 1457, 1458, 1, 2 },
+{ 1498, 1499, 1458, 1, 4 },
+{ 1485, 1451, 1452, 1, 6 },
+{ 1472, 1473, 1474, 1, 6 },
+{ 1484, 1485, 1452, 1, 4 },
+{ 1472, 1474, 1475, 1, 2 },
+{ 1471, 1472, 1475, 1, 4 },
+{ 1471, 1475, 1476, 1, 2 },
+{ 1470, 1471, 1476, 1, 4 },
+{ 1470, 1476, 1477, 1, 2 },
+{ 1470, 1477, 1478, 1, 2 },
+{ 1469, 1470, 1478, 1, 4 },
+{ 1469, 1478, 1479, 1, 2 },
+{ 1469, 1479, 1480, 1, 2 },
+{ 1468, 1469, 1480, 1, 4 },
+{ 1468, 1480, 1481, 1, 2 },
+{ 1467, 1468, 1481, 1, 4 },
+{ 1483, 1484, 1452, 1, 4 },
+{ 1497, 1498, 1458, 1, 4 },
+{ 1497, 1458, 1459, 1, 2 },
+{ 1496, 1497, 1459, 1, 4 },
+{ 1483, 1452, 1453, 1, 2 },
+{ 1496, 1459, 1460, 1, 2 },
+{ 1495, 1496, 1460, 1, 4 },
+{ 1495, 1460, 1461, 1, 2 },
+{ 1494, 1495, 1461, 1, 4 },
+{ 1494, 1461, 1462, 1, 2 },
+{ 1494, 1462, 1463, 1, 2 },
+{ 1493, 1494, 1463, 1, 4 },
+{ 1493, 1463, 1464, 1, 2 },
+{ 1492, 1493, 1464, 1, 4 },
+{ 1492, 1464, 1465, 1, 2 },
+{ 1491, 1492, 1465, 1, 4 },
+{ 1490, 1491, 1465, 1, 4 },
+{ 1489, 1490, 1465, 1, 4 },
+{ 1489, 1465, 1466, 1, 2 },
+{ 1488, 1489, 1466, 1, 4 },
+{ 1488, 1466, 1467, 1, 2 },
+{ 1487, 1488, 1467, 1, 4 },
+{ 1487, 1467, 1481, 1, 0 },
+{ 1486, 1487, 1481, 1, 4 },
+{ 1454, 1486, 1481, 1, 0 },
+{ 1454, 1481, 1482, 1, 2 },
+{ 1454, 1482, 1483, 1, 2 },
+{ 1453, 1454, 1483, 1, 4 },
+{ 1513, 1514, 1515, 1, 6 },
+{ 1512, 1513, 1515, 1, 4 },
+{ 1521, 1500, 1501, 1, 6 },
+{ 1511, 1512, 1515, 1, 4 },
+{ 1511, 1515, 1516, 1, 2 },
+{ 1510, 1511, 1516, 1, 4 },
+{ 1510, 1516, 1517, 1, 2 },
+{ 1509, 1510, 1517, 1, 4 },
+{ 1509, 1517, 1518, 1, 2 },
+{ 1508, 1509, 1518, 1, 4 },
+{ 1508, 1518, 1519, 1, 2 },
+{ 1507, 1508, 1519, 1, 4 },
+{ 1507, 1519, 1520, 1, 2 },
+{ 1506, 1507, 1520, 1, 4 },
+{ 1505, 1506, 1520, 1, 4 },
+{ 1504, 1505, 1520, 1, 4 },
+{ 1503, 1504, 1520, 1, 4 },
+{ 1503, 1520, 1521, 1, 2 },
+{ 1502, 1503, 1521, 1, 4 },
+{ 1501, 1502, 1521, 1, 4 },
+{ 1539, 1540, 1541, 1, 6 },
+{ 1538, 1539, 1541, 1, 4 },
+{ 1536, 1537, 1538, 1, 6 },
+{ 1535, 1536, 1538, 1, 4 },
+{ 1532, 1533, 1534, 1, 6 },
+{ 1545, 1522, 1523, 1, 6 },
+{ 1545, 1523, 1524, 1, 2 },
+{ 1545, 1524, 1525, 1, 2 },
+{ 1544, 1545, 1525, 1, 4 },
+{ 1544, 1525, 1526, 1, 2 },
+{ 1544, 1526, 1527, 1, 2 },
+{ 1544, 1527, 1528, 1, 2 },
+{ 1544, 1528, 1529, 1, 2 },
+{ 1543, 1544, 1529, 1, 4 },
+{ 1543, 1529, 1530, 1, 2 },
+{ 1543, 1530, 1531, 1, 2 },
+{ 1542, 1543, 1531, 1, 4 },
+{ 1542, 1531, 1532, 1, 2 },
+{ 1541, 1542, 1532, 1, 4 },
+{ 1538, 1541, 1532, 1, 0 },
+{ 1535, 1538, 1532, 1, 0 },
+{ 1534, 1535, 1532, 1, 4 },
+{ 1548, 1549, 1546, 1, 6 },
+{ 1548, 1546, 1547, 1, 3 },
+{ 1550, 1551, 1552, 1, 6 },
+{ 1550, 1552, 1553, 1, 2 },
+{ 1555, 1556, 1557, 1, 6 },
+{ 1554, 1555, 1557, 1, 4 },
+{ 1554, 1557, 1550, 1, 2 },
+{ 1554, 1550, 1553, 1, 1 },
+{ 1575, 1558, 1559, 0, 2 },
+{ 1575, 1559, 1560, 0, 2 },
+{ 1575, 1560, 1561, 0, 2 },
+{ 1575, 1561, 1562, 0, 2 },
+{ 1575, 1562, 1563, 0, 2 },
+{ 1575, 1563, 1564, 0, 2 },
+{ 1575, 1564, 1565, 0, 2 },
+{ 1575, 1565, 1558, 0, 2 },
+{ 1574, 1567, 1566, 0, 2 },
+{ 1574, 1568, 1567, 0, 2 },
+{ 1574, 1569, 1568, 0, 2 },
+{ 1574, 1570, 1569, 0, 2 },
+{ 1574, 1571, 1570, 0, 2 },
+{ 1574, 1572, 1571, 0, 2 },
+{ 1574, 1573, 1572, 0, 2 },
+{ 1574, 1566, 1573, 0, 2 },
+{ 1593, 1576, 1577, 0, 2 },
+{ 1593, 1577, 1578, 0, 2 },
+{ 1593, 1578, 1579, 0, 2 },
+{ 1593, 1579, 1580, 0, 2 },
+{ 1593, 1580, 1581, 0, 2 },
+{ 1593, 1581, 1582, 0, 2 },
+{ 1593, 1582, 1583, 0, 2 },
+{ 1593, 1583, 1576, 0, 2 },
+{ 1592, 1585, 1584, 0, 2 },
+{ 1592, 1586, 1585, 0, 2 },
+{ 1592, 1587, 1586, 0, 2 },
+{ 1592, 1588, 1587, 0, 2 },
+{ 1592, 1589, 1588, 0, 2 },
+{ 1592, 1590, 1589, 0, 2 },
+{ 1592, 1591, 1590, 0, 2 },
+{ 1592, 1584, 1591, 0, 2 },
+{ 1610, 1609, 1608, 1, 6 },
+{ 1610, 1608, 1607, 1, 2 },
+{ 1607, 1606, 1605, 1, 6 },
+{ 1607, 1605, 1604, 1, 2 },
+{ 1603, 1602, 1601, 1, 6 },
+{ 1595, 1594, 1613, 1, 6 },
+{ 1596, 1595, 1613, 1, 4 },
+{ 1596, 1613, 1612, 1, 2 },
+{ 1597, 1596, 1612, 1, 4 },
+{ 1598, 1597, 1612, 1, 4 },
+{ 1599, 1598, 1612, 1, 4 },
+{ 1599, 1612, 1611, 1, 2 },
+{ 1600, 1599, 1611, 1, 4 },
+{ 1601, 1600, 1611, 1, 4 },
+{ 1601, 1611, 1610, 1, 2 },
+{ 1601, 1610, 1607, 1, 0 },
+{ 1601, 1607, 1604, 1, 0 },
+{ 1601, 1604, 1603, 1, 2 },
+{ 1628, 1629, 1630, 1, 6 },
+{ 1627, 1628, 1630, 1, 4 },
+{ 1625, 1626, 1627, 1, 6 },
+{ 1624, 1625, 1627, 1, 4 },
+{ 1621, 1622, 1623, 1, 6 },
+{ 1633, 1614, 1615, 1, 6 },
+{ 1633, 1615, 1616, 1, 2 },
+{ 1632, 1633, 1616, 1, 4 },
+{ 1632, 1616, 1617, 1, 2 },
+{ 1632, 1617, 1618, 1, 2 },
+{ 1632, 1618, 1619, 1, 2 },
+{ 1631, 1632, 1619, 1, 4 },
+{ 1631, 1619, 1620, 1, 2 },
+{ 1631, 1620, 1621, 1, 2 },
+{ 1630, 1631, 1621, 1, 4 },
+{ 1627, 1630, 1621, 1, 0 },
+{ 1624, 1627, 1621, 1, 0 },
+{ 1623, 1624, 1621, 1, 4 },
+{ 1642, 1641, 1657, 1, 4 },
+{ 1643, 1642, 1657, 1, 4 },
+{ 1643, 1657, 1663, 1, 2 },
+{ 1635, 1634, 1656, 1, 6 },
+{ 1644, 1643, 1663, 1, 4 },
+{ 1644, 1663, 1662, 1, 2 },
+{ 1645, 1644, 1662, 1, 4 },
+{ 1645, 1662, 1661, 1, 2 },
+{ 1646, 1645, 1661, 1, 4 },
+{ 1647, 1646, 1661, 1, 4 },
+{ 1648, 1647, 1661, 1, 4 },
+{ 1648, 1661, 1660, 1, 2 },
+{ 1649, 1648, 1660, 1, 4 },
+{ 1649, 1660, 1659, 1, 2 },
+{ 1650, 1649, 1659, 1, 4 },
+{ 1650, 1659, 1658, 1, 2 },
+{ 1651, 1650, 1658, 1, 4 },
+{ 1652, 1651, 1658, 1, 4 },
+{ 1652, 1658, 1657, 1, 2 },
+{ 1652, 1657, 1641, 1, 0 },
+{ 1652, 1641, 1640, 1, 2 },
+{ 1652, 1640, 1639, 1, 2 },
+{ 1653, 1652, 1639, 1, 4 },
+{ 1653, 1639, 1638, 1, 2 },
+{ 1654, 1653, 1638, 1, 4 },
+{ 1654, 1638, 1637, 1, 2 },
+{ 1655, 1654, 1637, 1, 4 },
+{ 1655, 1637, 1636, 1, 2 },
+{ 1655, 1636, 1635, 1, 2 },
+{ 1656, 1655, 1635, 1, 4 },
+{ 1687, 1671, 1672, 1, 2 },
+{ 1687, 1672, 1673, 1, 2 },
+{ 1693, 1687, 1673, 1, 4 },
+{ 1686, 1664, 1665, 1, 6 },
+{ 1693, 1673, 1674, 1, 2 },
+{ 1692, 1693, 1674, 1, 4 },
+{ 1692, 1674, 1675, 1, 2 },
+{ 1691, 1692, 1675, 1, 4 },
+{ 1691, 1675, 1676, 1, 2 },
+{ 1691, 1676, 1677, 1, 2 },
+{ 1691, 1677, 1678, 1, 2 },
+{ 1690, 1691, 1678, 1, 4 },
+{ 1690, 1678, 1679, 1, 2 },
+{ 1689, 1690, 1679, 1, 4 },
+{ 1689, 1679, 1680, 1, 2 },
+{ 1688, 1689, 1680, 1, 4 },
+{ 1688, 1680, 1681, 1, 2 },
+{ 1688, 1681, 1682, 1, 2 },
+{ 1687, 1688, 1682, 1, 4 },
+{ 1671, 1687, 1682, 1, 0 },
+{ 1670, 1671, 1682, 1, 4 },
+{ 1669, 1670, 1682, 1, 4 },
+{ 1669, 1682, 1683, 1, 2 },
+{ 1668, 1669, 1683, 1, 4 },
+{ 1668, 1683, 1684, 1, 2 },
+{ 1667, 1668, 1684, 1, 4 },
+{ 1667, 1684, 1685, 1, 2 },
+{ 1666, 1667, 1685, 1, 4 },
+{ 1665, 1666, 1685, 1, 4 },
+{ 1665, 1685, 1686, 1, 2 }
+};
+
+static Vert vert_2[] = {
+{ 171.834137f, -24.549576f, 161.761139f, 0.000000f, -1.000000f, 0.000000f, 167.258984f, 73.910260f },
+{ 385.145508f, -24.549585f, 281.452515f, 0.000000f, -1.000000f, 0.000000f, 214.952915f, 32.905991f },
+{ 336.557922f, -24.549572f, 123.839111f, 0.000000f, -1.000000f, 0.000000f, 204.089298f, 86.901717f },
+{ 526.168030f, -24.549603f, 127.394318f, 0.000000f, -1.000000f, 0.000000f, 246.483912f, 85.683761f },
+{ 387.515625f, -24.549564f, 39.699638f, 0.000000f, -1.000000f, 0.000000f, 215.482850f, 115.726499f },
+{ 540.388733f, -24.549561f, -4.147684f, 0.000000f, -1.000000f, 0.000000f, 249.663506f, 130.747868f },
+{ 398.181213f, -24.549526f, -46.809975f, 0.000000f, -1.000000f, 0.000000f, 217.867557f, 145.363252f },
+{ 559.349792f, -24.549519f, -146.355286f, 0.000000f, -1.000000f, 0.000000f, 253.902968f, 179.465822f },
+{ 342.483246f, -24.549520f, -126.209206f, 0.000000f, -1.000000f, 0.000000f, 205.414135f, 172.564107f },
+{ 451.509033f, -24.549507f, -264.861603f, 0.000000f, -1.000000f, 0.000000f, 229.791028f, 220.064120f },
+{ 233.457428f, -24.549515f, -184.277298f, 0.000000f, -1.000000f, 0.000000f, 181.037242f, 192.457275f },
+{ 252.418427f, -24.549503f, -317.004364f, 0.000000f, -1.000000f, 0.000000f, 185.276690f, 237.927362f },
+{ 87.694656f, -24.549515f, -183.092224f, 0.000000f, -1.000000f, 0.000000f, 148.446376f, 192.051290f },
+{ 27.256439f, -24.549471f, -341.890686f, 0.000000f, -1.000000f, 0.000000f, 134.933100f, 246.453003f },
+{ -72.288864f, -24.549515f, -178.351990f, 0.000000f, -1.000000f, 0.000000f, 112.675931f, 190.427367f },
+{ -154.058212f, -24.549473f, -325.299805f, 0.000000f, -1.000000f, 0.000000f, 94.393258f, 240.769243f },
+{ -220.421753f, -24.549486f, -172.426666f, 0.000000f, -1.000000f, 0.000000f, 79.555146f, 188.397447f },
+{ -346.038452f, -24.549469f, -367.962097f, 0.000000f, -1.000000f, 0.000000f, 51.468713f, 255.384635f },
+{ -318.781982f, -24.549488f, -146.355286f, 0.000000f, -1.000000f, 0.000000f, 57.562944f, 179.465822f },
+{ -466.914886f, -24.549479f, -242.345398f, 0.000000f, -1.000000f, 0.000000f, 24.442152f, 212.350443f },
+{ -383.960480f, -24.549492f, -96.582626f, 0.000000f, -1.000000f, 0.000000f, 42.989791f, 162.414540f },
+{ -552.239441f, -24.549492f, -101.322876f, 0.000000f, -1.000000f, 0.000000f, 5.364584f, 164.038467f },
+{ -421.882477f, -24.549498f, -27.848965f, 0.000000f, -1.000000f, 0.000000f, 34.510873f, 138.867531f },
+{ -559.349792f, -24.549505f, 49.180138f, 0.000000f, -1.000000f, 0.000000f, 3.774793f, 112.478631f },
+{ -412.401978f, -24.549538f, 71.696342f, 0.000000f, -1.000000f, 0.000000f, 36.630604f, 104.764969f },
+{ -510.762207f, -24.549515f, 174.796814f, 0.000000f, -1.000000f, 0.000000f, 14.638404f, 69.444450f },
+{ -348.408569f, -24.549543f, 140.429993f, 0.000000f, -1.000000f, 0.000000f, 50.938782f, 81.217951f },
+{ -411.216919f, -24.549555f, 264.861633f, 0.000000f, -1.000000f, 0.000000f, 36.895568f, 38.589741f },
+{ -258.343781f, -24.549547f, 187.832520f, 0.000000f, -1.000000f, 0.000000f, 71.076220f, 64.978641f },
+{ -254.788574f, -24.549561f, 338.335541f, 0.000000f, -1.000000f, 0.000000f, 71.871129f, 13.418798f },
+{ -133.912140f, -24.549547f, 193.757843f, 0.000000f, -1.000000f, 0.000000f, 98.897688f, 62.948714f },
+{ -43.847347f, -24.549593f, 367.962097f, 0.000000f, -1.000000f, 0.000000f, 119.035126f, 3.269238f },
+{ 37.922009f, -24.549547f, 183.092255f, 0.000000f, -1.000000f, 0.000000f, 137.317792f, 66.602568f },
+{ 168.278946f, -24.549589f, 315.819336f, 0.000000f, -1.000000f, 0.000000f, 166.464082f, 21.132490f }
+};
+
+static Face face_2[] = {
+{ 18, 17, 16, 2, 6 },
+{ 8, 7, 6, 2, 6 },
+{ 20, 19, 18, 2, 6 },
+{ 22, 21, 20, 2, 6 },
+{ 4, 3, 2, 2, 6 },
+{ 10, 9, 8, 2, 6 },
+{ 6, 5, 4, 2, 6 },
+{ 26, 25, 24, 2, 6 },
+{ 28, 27, 26, 2, 6 },
+{ 24, 23, 22, 2, 6 },
+{ 30, 29, 28, 2, 6 },
+{ 12, 11, 10, 2, 6 },
+{ 2, 1, 0, 2, 6 },
+{ 0, 33, 32, 2, 6 },
+{ 32, 31, 30, 2, 6 },
+{ 14, 13, 12, 2, 6 },
+{ 16, 15, 14, 2, 6 },
+{ 4, 2, 0, 2, 0 },
+{ 6, 4, 0, 2, 0 },
+{ 8, 6, 0, 2, 0 },
+{ 10, 8, 0, 2, 0 },
+{ 12, 10, 0, 2, 0 },
+{ 12, 0, 32, 2, 0 },
+{ 14, 12, 32, 2, 0 },
+{ 14, 32, 30, 2, 0 },
+{ 16, 14, 30, 2, 0 },
+{ 16, 30, 28, 2, 0 },
+{ 16, 28, 26, 2, 0 },
+{ 18, 16, 26, 2, 0 },
+{ 20, 18, 26, 2, 0 },
+{ 20, 26, 24, 2, 0 },
+{ 20, 24, 22, 2, 0 }
+};
+
+static Vert *vert[] = { 
+vert_0,
+vert_1,
+vert_2
+};
+
+static int num_verts[] = {
+68,
+1694,
+34
+};
+
+static Face *face[] = { 
+face_0,
+face_1,
+face_2
+};
+
+static int num_faces[] = {
+100,
+1606,
+32
+};
+
+static int total_num_frames = 75;
+
+static Matrix mat[76][3] = {
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 22198.351563, 1.000000},
+ {1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -32.104950, -4.568500, 21760.089844, 1.000000},
+ {1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+  -36.722248, 9.404100, 22230.794922, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 21601.316406, 1.000000},
+ {0.881000, 0.187100, 0.434500, 0.000000,
+ -0.178600, -0.718900, 0.671800, 0.000000,
+ -0.438000, 0.669500, 0.600000, 0.000000,
+ -40.679047, 57.105099, 21262.400391, 1.000000},
+ {1.008900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.008900, 0.000000,
+ 0.000000, 1.008900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 21633.759766, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 20863.496094, 1.000000},
+ {0.759600, 0.187100, 0.622900, 0.000000,
+ -0.326300, -0.718900, 0.613800, 0.000000,
+ -0.562600, 0.669500, 0.485100, 0.000000,
+ -35.966850, 57.105099, 20524.212891, 1.000000},
+ {1.017400, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.017400, 0.000000,
+ 0.000000, 1.017400, 0.000000, 0.000000,
+    -36.722248, 9.404100, 20895.939453, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 20000.533203, 1.000000},
+ {0.598200, 0.187100, 0.779200, 0.000000,
+ -0.457200, -0.718900, 0.523600, 0.000000,
+ -0.658100, 0.669500, 0.344500, 0.000000,
+ -31.281849, 57.105099, 19661.962891, 1.000000},
+ {1.025100, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.025100, 0.000000,
+ 0.000000, 1.025100, 0.000000, 0.000000,
+    -36.722248, 9.404100, 20032.976563, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 19028.070313, 1.000000},
+ {0.406500, 0.187100, 0.894300, 0.000000,
+ -0.563800, -0.718900, 0.406600, 0.000000,
+ -0.719000, 0.669500, 0.186800, 0.000000,
+ -26.903849, 57.105099, 18691.248047, 1.000000},
+ {1.031600, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.031600, 0.000000,
+ 0.000000, 1.031600, 0.000000, 0.000000,
+    -36.722248, 9.404100, 19060.513672, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 17961.750000, 1.000000},
+ {0.196700, 0.187100, 0.962400, 0.000000,
+ -0.640300, -0.718900, 0.270600, 0.000000,
+ -0.742500, 0.669500, 0.021700, 0.000000,
+ -23.081848, 57.105099, 17627.578125, 1.000000},
+ {1.036500, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.036500, 0.000000,
+ 0.000000, 1.036500, 0.000000, 0.000000,
+    -36.722248, 9.404100, 17994.193359, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 16817.216797, 1.000000},
+ {-0.018200, 0.187100, 0.982200, 0.000000,
+ -0.683900, -0.718900, 0.124300, 0.000000,
+ -0.729300, 0.669500, -0.141000, 0.000000,
+ -20.007050, 57.105099, 16486.400391, 1.000000},
+ {1.039500, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.039500, 0.000000,
+ 0.000000, 1.039500, 0.000000, 0.000000,
+    -36.722248, 9.404100, 16849.660156, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 15610.111328, 1.000000},
+ {-0.225800, 0.187100, 0.956000, 0.000000,
+ -0.694700, -0.718900, -0.023400, 0.000000,
+ -0.682900, 0.669500, -0.292300, 0.000000,
+ -17.795149, 57.105099, 15283.111328, 1.000000},
+ {1.040000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.040000, 0.000000,
+ 0.000000, 1.040000, 0.000000, 0.000000,
+    -36.722248, 9.404100, 15642.555664, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 14356.078125, 1.000000},
+ {-0.414200, 0.187100, 0.890800, 0.000000,
+ -0.675700, -0.718900, -0.163200, 0.000000,
+ -0.609900, 0.669500, -0.424100, 0.000000,
+ -16.485548, 57.105099, 14033.073242, 1.000000},
+ {1.037200, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.037200, 0.000000,
+ 0.000000, 1.037200, 0.000000, 0.000000,
+    -36.722248, 9.404100, 14388.522461, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 13070.758789, 1.000000},
+ {-0.577800, 0.187100, 0.794500, 0.000000,
+ -0.631700, -0.718900, -0.290100, 0.000000,
+ -0.516900, 0.669500, -0.533500, 0.000000,
+ -16.012848, 57.105099, 12751.730469, 1.000000},
+ {1.031000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.031000, 0.000000,
+ 0.000000, 1.031000, 0.000000, 0.000000,
+    -36.722248, 9.404100, 13103.203125, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 11769.795898, 1.000000},
+ {-0.715900, 0.187100, 0.672600, 0.000000,
+ -0.566400, -0.718900, -0.402900, 0.000000,
+ -0.408200, 0.669500, -0.620600, 0.000000,
+ -16.293648, 57.105099, 11454.640625, 1.000000},
+ {1.022700, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.022700, 0.000000,
+ 0.000000, 1.022700, 0.000000, 0.000000,
+    -36.722248, 9.404100, 11802.240234, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 10468.833984, 1.000000},
+ {-0.827900, 0.187100, 0.528800, 0.000000,
+ -0.482200, -0.718900, -0.500600, 0.000000,
+ -0.286500, 0.669500, -0.685400, 0.000000,
+ -17.278248, 57.105099, 10157.392578, 1.000000},
+ {1.013400, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.013400, 0.000000,
+ 0.000000, 1.013400, 0.000000, 0.000000,
+    -36.722248, 9.404100, 10501.278320, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 9183.513672, 1.000000},
+ {-0.912000, 0.187100, 0.365100, 0.000000,
+ -0.380400, -0.718900, -0.581800, 0.000000,
+ -0.153600, 0.669500, -0.726800, 0.000000,
+ -18.951847, 57.105099, 8875.574219, 1.000000},
+ {1.004100, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004100, 0.000000,
+ 0.000000, 1.004100, 0.000000, 0.000000,
+    -36.722248, 9.404100, 9215.958008, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 7929.480957, 1.000000},
+ {-0.965100, 0.187100, 0.183100, 0.000000,
+ -0.261500, -0.718900, -0.644000, 0.000000,
+ -0.011100, 0.669500, -0.742800, 0.000000,
+ -21.328348, 57.105099, 7624.758301, 1.000000},
+ {0.996000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.996000, 0.000000,
+ 0.000000, 0.996000, 0.000000, 0.000000,
+    -36.722248, 9.404100, 7961.925293, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 6722.375488, 1.000000},
+ {-0.982200, 0.187100, -0.015200, 0.000000,
+ -0.126300, -0.718900, -0.683500, 0.000000,
+ 0.138800, 0.669500, -0.729800, 0.000000,
+ -24.438049, 57.105099, 6420.471191, 1.000000},
+ {0.990300, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.990300, 0.000000,
+ 0.000000, 0.990300, 0.000000, 0.000000,
+    -36.722248, 9.404100, 6754.819824, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 5577.841309, 1.000000},
+ {-0.956000, 0.187100, -0.225800, 0.000000,
+ 0.023400, -0.718900, -0.694700, 0.000000,
+ 0.292300, 0.669500, -0.682900, 0.000000,
+ -28.305548, 57.105099, 5278.185547, 1.000000},
+ {0.988000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.988000, 0.000000,
+ 0.000000, 0.988000, 0.000000, 0.000000,
+    -36.722248, 9.404100, 5610.285645, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 4511.521484, 1.000000},
+ {-0.878200, 0.187100, -0.440200, 0.000000,
+ 0.183000, -0.718900, -0.670600, 0.000000,
+ 0.441900, 0.669500, -0.597100, 0.000000,
+ -32.898449, 57.105099, 4213.296387, 1.000000},
+ {0.991400, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.991400, 0.000000,
+ 0.000000, 0.991400, 0.000000, 0.000000,
+    -36.722248, 9.404100, 4543.965332, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 3539.058594, 1.000000},
+ {-0.743400, 0.187100, -0.642200, 0.000000,
+ 0.341900, -0.718900, -0.605200, 0.000000,
+ 0.574900, 0.669500, -0.470500, 0.000000,
+ -38.008450, 57.105099, 3241.149658, 1.000000},
+ {1.000100, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000100, 0.000000,
+ 0.000000, 1.000100, 0.000000, 0.000000,
+    -36.722248, 9.404100, 3571.502441, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 2676.096436, 1.000000},
+ {-0.553100, 0.187100, -0.811800, 0.000000,
+ 0.486100, -0.718900, -0.496800, 0.000000,
+ 0.676600, 0.669500, -0.306700, 0.000000,
+ -43.285347, 57.105099, 2377.160400, 1.000000},
+ {1.011600, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.011600, 0.000000,
+ 0.000000, 1.011600, 0.000000, 0.000000,
+    -36.722248, 9.404100, 2708.540283, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1938.275757, 1.000000},
+ {-0.316400, 0.187100, -0.930000, 0.000000,
+ 0.601100, -0.718900, -0.349100, 0.000000,
+ 0.733900, 0.669500, -0.115000, 0.000000,
+ -48.290947, 57.105099, 1636.875488, 1.000000},
+ {1.023400, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.023400, 0.000000,
+ 0.000000, 1.023400, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1970.719727, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.049500, 0.187100, -0.981100, 0.000000,
+ 0.673700, -0.718900, -0.171100, 0.000000,
+ 0.737300, 0.669500, 0.090500, 0.000000,
+ -52.555748, 57.105099, 1036.013794, 1.000000},
+ {1.032800, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.032800, 0.000000,
+ 0.000000, 1.032800, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.225800, 0.187100, -0.956000, 0.000000,
+ 0.694700, -0.718900, 0.023400, 0.000000,
+ 0.682900, 0.669500, 0.292300, 0.000000,
+ -55.649448, 57.105099, 1031.074585, 1.000000},
+ {1.037400, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.037400, 0.000000,
+ 0.000000, 1.037400, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.491100, 0.187100, -0.850800, 0.000000,
+ 0.658600, -0.718900, 0.222200, 0.000000,
+ 0.570100, 0.669500, 0.476300, 0.000000,
+ -57.270248, 57.105099, 1025.276733, 1.000000},
+ {1.037900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.037900, 0.000000,
+ 0.000000, 1.037900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.723400, 0.187100, -0.664600, 0.000000,
+ 0.561800, -0.718900, 0.409300, 0.000000,
+ 0.401200, 0.669500, 0.625200, 0.000000,
+ -57.111149, 57.105099, 1019.001221, 1.000000},
+ {1.036800, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.036800, 0.000000,
+ 0.000000, 1.036800, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.892600, 0.187100, -0.410300, 0.000000,
+ 0.409000, -0.718900, 0.562000, 0.000000,
+ 0.189800, 0.669500, 0.718200, 0.000000,
+ -55.002949, 57.105099, 1012.916504, 1.000000},
+ {1.034500, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.034500, 0.000000,
+ 0.000000, 1.034500, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.975800, 0.187100, -0.113200, 0.000000,
+ 0.214500, -0.718900, 0.661200, 0.000000,
+ -0.042300, 0.669500, 0.741600, 0.000000,
+ -51.079346, 57.105099, 1007.726318, 1.000000},
+ {1.031200, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.031200, 0.000000,
+ 0.000000, 1.031200, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.963000, 0.187100, 0.193800, 0.000000,
+ -0.000200, -0.718900, 0.695100, 0.000000,
+ -0.269300, 0.669500, 0.692300, 0.000000,
+ -45.765148, 57.105099, 1004.021790, 1.000000},
+ {1.027000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.027000, 0.000000,
+ 0.000000, 1.027000, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.859000, 0.187100, 0.476600, 0.000000,
+ -0.210900, -0.718900, 0.662300, 0.000000,
+ -0.466500, 0.669500, 0.578100, 0.000000,
+ -39.690350, 57.105099, 1002.157410, 1.000000},
+ {1.022400, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.022400, 0.000000,
+ 0.000000, 1.022400, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.681700, 0.187100, 0.707300, 0.000000,
+ -0.395700, -0.718900, 0.571500, 0.000000,
+ -0.615400, 0.669500, 0.416100, 0.000000,
+ -33.554749, 57.105099, 1002.187256, 1.000000},
+ {1.017400, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.017400, 0.000000,
+ 0.000000, 1.017400, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.458000, 0.187100, 0.869100, 0.000000,
+ -0.539100, -0.718900, 0.438800, 0.000000,
+ -0.706900, 0.669500, 0.228400, 0.000000,
+ -27.984049, 57.105099, 1003.876953, 1.000000},
+ {1.012300, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.012300, 0.000000,
+ 0.000000, 1.012300, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.217300, 0.187100, 0.958000, 0.000000,
+ -0.634300, -0.718900, 0.284200, 0.000000,
+ -0.741900, 0.669500, 0.037500, 0.000000,
+ -23.418049, 57.105099, 1006.781006, 1.000000},
+ {1.007400, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.007400, 0.000000,
+ 0.000000, 1.007400, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.011500, 0.187100, 0.982300, 0.000000,
+ -0.683000, -0.718900, 0.128900, 0.000000,
+ -0.730300, 0.669500, -0.136000, 0.000000,
+ -20.090649, 57.105099, 1010.310059, 1.000000},
+ {1.001600, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.001600, 0.000000,
+ 0.000000, 1.001600, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.214400, 0.187100, 0.958700, 0.000000,
+ -0.694900, -0.718900, -0.015100, 0.000000,
+ -0.686400, 0.669500, -0.284100, 0.000000,
+ -17.896347, 57.105099, 1014.017090, 1.000000},
+ {0.994300, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.994300, 0.000000,
+ 0.000000, 0.994300, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.391300, 0.187100, 0.901000, 0.000000,
+ -0.679600, -0.718900, -0.145900, 0.000000,
+ -0.620500, 0.669500, -0.408500, 0.000000,
+ -16.604847, 57.105099, 1017.721558, 1.000000},
+ {0.986100, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.986100, 0.000000,
+ 0.000000, 0.986100, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.545300, 0.187100, 0.817100, 0.000000,
+ -0.642900, -0.718900, -0.264400, 0.000000,
+ -0.538000, 0.669500, -0.512300, 0.000000,
+ -16.047749, 57.105099, 1021.376709, 1.000000},
+ {0.977700, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.977700, 0.000000,
+ 0.000000, 0.977700, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.679500, 0.187100, 0.709400, 0.000000,
+ -0.586800, -0.718900, -0.372600, 0.000000,
+ -0.440300, 0.669500, -0.598300, 0.000000,
+ -16.141548, 57.105099, 1025.005493, 1.000000},
+ {0.969900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.969900, 0.000000,
+ 0.000000, 0.969900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.795500, 0.187100, 0.576300, 0.000000,
+ -0.510700, -0.718900, -0.471600, 0.000000,
+ -0.326100, 0.669500, -0.667400, 0.000000,
+ -16.893848, 57.105099, 1028.650513, 1.000000},
+ {0.963300, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.963300, 0.000000,
+ 0.000000, 0.963300, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.890900, 0.187100, 0.413900, 0.000000,
+ -0.411300, -0.718900, -0.560400, 0.000000,
+ -0.192700, 0.669500, -0.717400, 0.000000,
+ -18.402348, 57.105099, 1032.325195, 1.000000},
+ {0.958800, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.958800, 0.000000,
+ 0.000000, 0.958800, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.958000, 0.187100, 0.217300, 0.000000,
+ -0.284200, -0.718900, -0.634300, 0.000000,
+ -0.037500, 0.669500, -0.741900, 0.000000,
+ -20.845448, 57.105099, 1035.962158, 1.000000},
+ {0.957000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.957000, 0.000000,
+ 0.000000, 0.957000, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.982300, 0.187100, -0.013000, 0.000000,
+ -0.127900, -0.718900, -0.683200, 0.000000,
+ 0.137100, 0.669500, -0.730100, 0.000000,
+ -24.399748, 57.105099, 1039.308228, 1.000000},
+ {0.958800, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.958800, 0.000000,
+ 0.000000, 0.958800, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.947100, 0.187100, -0.260700, 0.000000,
+ 0.048800, -0.718900, -0.693400, 0.000000,
+ 0.317100, 0.669500, -0.671800, 0.000000,
+ -29.005148, 57.105099, 1041.880859, 1.000000},
+ {0.963900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.963900, 0.000000,
+ 0.000000, 0.963900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.844400, 0.187100, -0.502000, 0.000000,
+ 0.230600, -0.718900, -0.655700, 0.000000,
+ 0.483600, 0.669500, -0.563900, 0.000000,
+ -34.367550, 57.105099, 1043.237793, 1.000000},
+ {0.971800, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.971800, 0.000000,
+ 0.000000, 0.971800, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.677300, 0.187100, -0.711500, 0.000000,
+ 0.399200, -0.718900, -0.569000, 0.000000,
+ 0.618000, 0.669500, -0.412200, 0.000000,
+ -40.015949, 57.105099, 1043.108643, 1.000000},
+ {0.981700, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.981700, 0.000000,
+ 0.000000, 0.981700, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.460700, 0.187100, -0.867600, 0.000000,
+ 0.537700, -0.718900, -0.440500, 0.000000,
+ 0.706200, 0.669500, -0.230600, 0.000000,
+ -45.402149, 57.105099, 1041.465820, 1.000000},
+ {0.993000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.993000, 0.000000,
+ 0.000000, 0.993000, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {-0.217300, 0.187100, -0.958000, 0.000000,
+ 0.634300, -0.718900, -0.284200, 0.000000,
+ 0.741900, 0.669500, -0.037500, 0.000000,
+ -50.026550, 57.105099, 1038.534790, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.034900, 0.187100, -0.981700, 0.000000,
+ 0.685900, -0.718900, -0.112600, 0.000000,
+ 0.726800, 0.669500, 0.153400, 0.000000,
+ -53.643948, 57.105099, 1034.605103, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.284000, 0.187100, -0.940400, 0.000000,
+ 0.692000, -0.718900, 0.066000, 0.000000,
+ 0.663700, 0.669500, 0.333600, 0.000000,
+ -56.130249, 57.105099, 1029.897339, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.513800, 0.187100, -0.837300, 0.000000,
+ 0.652400, -0.718900, 0.239800, 0.000000,
+ 0.557100, 0.669500, 0.491400, 0.000000,
+ -57.333046, 57.105099, 1024.724487, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.709500, 0.187100, -0.679400, 0.000000,
+ 0.570200, -0.718900, 0.397500, 0.000000,
+ 0.414100, 0.669500, 0.616700, 0.000000,
+ -57.182648, 57.105099, 1019.425110, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.858600, 0.187100, -0.477300, 0.000000,
+ 0.450800, -0.718900, 0.529100, 0.000000,
+ 0.244200, 0.669500, 0.701600, 0.000000,
+ -55.694046, 57.105099, 1014.342407, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.951600, 0.187100, -0.244000, 0.000000,
+ 0.301900, -0.718900, 0.626100, 0.000000,
+ 0.058300, 0.669500, 0.740600, 0.000000,
+ -52.966049, 57.105099, 1009.804321, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.982300, 0.187100, 0.005300, 0.000000,
+ 0.133200, -0.718900, 0.682200, 0.000000,
+ -0.131400, 0.669500, 0.731100, 0.000000,
+ -49.174549, 57.105099, 1006.104492, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+},
+{{1.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.000000, 0.000000,
+ 0.000000, 1.000000, 0.000000, 0.000000,
+ -41.462547, 14.736900, 1341.240845, 1.000000},
+ {0.948800, 0.187100, 0.254600, 0.000000,
+ -0.044400, -0.718900, 0.693700, 0.000000,
+ -0.312800, 0.669500, 0.673800, 0.000000,
+ -44.562447, 57.105099, 1003.484802, 1.000000},
+ {1.004900, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 1.004900, 0.000000,
+ 0.000000, 1.004900, 0.000000, 0.000000,
+    -36.722248, 9.404100, 1373.684814, 1.000000}
+}
+};
+#define RAW_NAME text_3dfinfo_raw 
+#define IMAGE_NAME text_3dfinfo_image 
+unsigned char RAW_NAME[] = {
+0x40,
+0x0,
+0x0,
+0x0,
+0x40,
+0x0,
+0x0,
+0x0,
+0x8,
+0x0,
+0x0,
+0x0,
+0x2,
+0x0,
+0x0,
+0x0,
+0x3,
+0x0,
+0x0,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0x22,
+0x22,
+0x2b,
+0x3c,
+0x44,
+0x44,
+0x66,
+0x77,
+0x88,
+0x99,
+0xaa,
+0xbb,
+0xcc,
+0xdd,
+0xee,
+0xff,
+0xcf,
+0x1,
+0x27,
+0x0,
+0x23,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0xef,
+0x1,
+0xe2,
+0x1,
+0xe,
+0x0,
+0x12,
+0x0,
+0xf4,
+0x1,
+0xff,
+0x1,
+0xfc,
+0x1,
+0xee,
+0x1,
+0x19,
+0x0,
+0x10,
+0x0,
+0xe5,
+0x1,
+0x11,
+0x0,
+0x6,
+0x0,
+0xe8,
+0x1,
+0x9,
+0x0,
+0x8,
+0x0,
+0xeb,
+0x1,
+0x1,
+0x0,
+0x4,
+0x0,
+0x22,
+0x22,
+0x2b,
+0x3c,
+0x44,
+0x44,
+0x66,
+0x77,
+0x88,
+0x99,
+0xaa,
+0xbb,
+0xcc,
+0xdd,
+0xee,
+0xff,
+0x23,
+0x4e,
+0x3c,
+0x7,
+0xef,
+0x1,
+0x4,
+0x0,
+0x12,
+0x1c,
+0x88,
+0x7,
+0xfc,
+0xff,
+0xd3,
+0x7,
+0x10,
+0x32,
+0xb8,
+0x7,
+0x6,
+0x22,
+0x94,
+0x7,
+0x8,
+0x12,
+0xa0,
+0x7,
+0x4,
+0x2,
+0xac,
+0x7,
+0x19,
+0x0,
+0x0,
+0x0,
+0x1c,
+0x0,
+0x0,
+0x0,
+0x1f,
+0x0,
+0x0,
+0x0,
+0x21,
+0x0,
+0x0,
+0x0,
+0x24,
+0x0,
+0x0,
+0x0,
+0x26,
+0x0,
+0x0,
+0x0,
+0x28,
+0x0,
+0x0,
+0x0,
+0x2a,
+0x0,
+0x0,
+0x0,
+0x2c,
+0x0,
+0x0,
+0x0,
+0x2e,
+0x0,
+0x0,
+0x0,
+0x30,
+0x0,
+0x0,
+0x0,
+0x32,
+0x0,
+0x0,
+0x0,
+0x34,
+0x0,
+0x0,
+0x0,
+0x36,
+0x0,
+0x0,
+0x0,
+0x37,
+0x0,
+0x0,
+0x0,
+0x39,
+0x0,
+0x0,
+0x0,
+0x3b,
+0x0,
+0x0,
+0x0,
+0x3c,
+0x0,
+0x0,
+0x0,
+0x3e,
+0x0,
+0x0,
+0x0,
+0x40,
+0x0,
+0x0,
+0x0,
+0x41,
+0x0,
+0x0,
+0x0,
+0x43,
+0x0,
+0x0,
+0x0,
+0x44,
+0x0,
+0x0,
+0x0,
+0x46,
+0x0,
+0x0,
+0x0,
+0x47,
+0x0,
+0x0,
+0x0,
+0x48,
+0x0,
+0x0,
+0x0,
+0x4a,
+0x0,
+0x0,
+0x0,
+0x4b,
+0x0,
+0x0,
+0x0,
+0x4d,
+0x0,
+0x0,
+0x0,
+0x4e,
+0x0,
+0x0,
+0x0,
+0x4f,
+0x0,
+0x0,
+0x0,
+0x51,
+0x0,
+0x0,
+0x0,
+0x52,
+0x0,
+0x0,
+0x0,
+0x53,
+0x0,
+0x0,
+0x0,
+0x54,
+0x0,
+0x0,
+0x0,
+0x56,
+0x0,
+0x0,
+0x0,
+0x57,
+0x0,
+0x0,
+0x0,
+0x58,
+0x0,
+0x0,
+0x0,
+0x59,
+0x0,
+0x0,
+0x0,
+0x5b,
+0x0,
+0x0,
+0x0,
+0x5c,
+0x0,
+0x0,
+0x0,
+0x5d,
+0x0,
+0x0,
+0x0,
+0x5e,
+0x0,
+0x0,
+0x0,
+0x5f,
+0x0,
+0x0,
+0x0,
+0x61,
+0x0,
+0x0,
+0x0,
+0x62,
+0x0,
+0x0,
+0x0,
+0x63,
+0x0,
+0x0,
+0x0,
+0x64,
+0x0,
+0x0,
+0x0,
+0x65,
+0x0,
+0x0,
+0x0,
+0x66,
+0x0,
+0x0,
+0x0,
+0x67,
+0x0,
+0x0,
+0x0,
+0x69,
+0x0,
+0x0,
+0x0,
+0x6a,
+0x0,
+0x0,
+0x0,
+0x6b,
+0x0,
+0x0,
+0x0,
+0x6c,
+0x0,
+0x0,
+0x0,
+0x6d,
+0x0,
+0x0,
+0x0,
+0x6e,
+0x0,
+0x0,
+0x0,
+0x6f,
+0x0,
+0x0,
+0x0,
+0x70,
+0x0,
+0x0,
+0x0,
+0x71,
+0x0,
+0x0,
+0x0,
+0x72,
+0x0,
+0x0,
+0x0,
+0x73,
+0x0,
+0x0,
+0x0,
+0x74,
+0x0,
+0x0,
+0x0,
+0x75,
+0x0,
+0x0,
+0x0,
+0x76,
+0x0,
+0x0,
+0x0,
+0x77,
+0x0,
+0x0,
+0x0,
+0x78,
+0x0,
+0x0,
+0x0,
+0x79,
+0x0,
+0x0,
+0x0,
+0x7a,
+0x0,
+0x0,
+0x0,
+0x7b,
+0x0,
+0x0,
+0x0,
+0x7c,
+0x0,
+0x0,
+0x0,
+0x7d,
+0x0,
+0x0,
+0x0,
+0x7e,
+0x0,
+0x0,
+0x0,
+0x7f,
+0x0,
+0x0,
+0x0,
+0x80,
+0x0,
+0x0,
+0x0,
+0x81,
+0x0,
+0x0,
+0x0,
+0x82,
+0x0,
+0x0,
+0x0,
+0x83,
+0x0,
+0x0,
+0x0,
+0x84,
+0x0,
+0x0,
+0x0,
+0x85,
+0x0,
+0x0,
+0x0,
+0x86,
+0x0,
+0x0,
+0x0,
+0x87,
+0x0,
+0x0,
+0x0,
+0x87,
+0x0,
+0x0,
+0x0,
+0x88,
+0x0,
+0x0,
+0x0,
+0x89,
+0x0,
+0x0,
+0x0,
+0x8a,
+0x0,
+0x0,
+0x0,
+0x8b,
+0x0,
+0x0,
+0x0,
+0x8c,
+0x0,
+0x0,
+0x0,
+0x8d,
+0x0,
+0x0,
+0x0,
+0x8e,
+0x0,
+0x0,
+0x0,
+0x8f,
+0x0,
+0x0,
+0x0,
+0x90,
+0x0,
+0x0,
+0x0,
+0x90,
+0x0,
+0x0,
+0x0,
+0x91,
+0x0,
+0x0,
+0x0,
+0x92,
+0x0,
+0x0,
+0x0,
+0x93,
+0x0,
+0x0,
+0x0,
+0x94,
+0x0,
+0x0,
+0x0,
+0x95,
+0x0,
+0x0,
+0x0,
+0x96,
+0x0,
+0x0,
+0x0,
+0x96,
+0x0,
+0x0,
+0x0,
+0x97,
+0x0,
+0x0,
+0x0,
+0x98,
+0x0,
+0x0,
+0x0,
+0x99,
+0x0,
+0x0,
+0x0,
+0x9a,
+0x0,
+0x0,
+0x0,
+0x9b,
+0x0,
+0x0,
+0x0,
+0x9c,
+0x0,
+0x0,
+0x0,
+0x9c,
+0x0,
+0x0,
+0x0,
+0x9d,
+0x0,
+0x0,
+0x0,
+0x9e,
+0x0,
+0x0,
+0x0,
+0x9f,
+0x0,
+0x0,
+0x0,
+0xa0,
+0x0,
+0x0,
+0x0,
+0xa0,
+0x0,
+0x0,
+0x0,
+0xa1,
+0x0,
+0x0,
+0x0,
+0xa2,
+0x0,
+0x0,
+0x0,
+0xa3,
+0x0,
+0x0,
+0x0,
+0xa4,
+0x0,
+0x0,
+0x0,
+0xa4,
+0x0,
+0x0,
+0x0,
+0xa5,
+0x0,
+0x0,
+0x0,
+0xa6,
+0x0,
+0x0,
+0x0,
+0xa7,
+0x0,
+0x0,
+0x0,
+0xa8,
+0x0,
+0x0,
+0x0,
+0xa8,
+0x0,
+0x0,
+0x0,
+0xa9,
+0x0,
+0x0,
+0x0,
+0xaa,
+0x0,
+0x0,
+0x0,
+0xab,
+0x0,
+0x0,
+0x0,
+0xac,
+0x0,
+0x0,
+0x0,
+0xac,
+0x0,
+0x0,
+0x0,
+0xad,
+0x0,
+0x0,
+0x0,
+0xae,
+0x0,
+0x0,
+0x0,
+0xaf,
+0x0,
+0x0,
+0x0,
+0xaf,
+0x0,
+0x0,
+0x0,
+0xb0,
+0x0,
+0x0,
+0x0,
+0xb1,
+0x0,
+0x0,
+0x0,
+0xb2,
+0x0,
+0x0,
+0x0,
+0xb2,
+0x0,
+0x0,
+0x0,
+0xb3,
+0x0,
+0x0,
+0x0,
+0xb4,
+0x0,
+0x0,
+0x0,
+0xb5,
+0x0,
+0x0,
+0x0,
+0xb5,
+0x0,
+0x0,
+0x0,
+0xb6,
+0x0,
+0x0,
+0x0,
+0xb7,
+0x0,
+0x0,
+0x0,
+0xb8,
+0x0,
+0x0,
+0x0,
+0xb8,
+0x0,
+0x0,
+0x0,
+0xb9,
+0x0,
+0x0,
+0x0,
+0xba,
+0x0,
+0x0,
+0x0,
+0xbb,
+0x0,
+0x0,
+0x0,
+0xbb,
+0x0,
+0x0,
+0x0,
+0xbc,
+0x0,
+0x0,
+0x0,
+0xbd,
+0x0,
+0x0,
+0x0,
+0xbe,
+0x0,
+0x0,
+0x0,
+0xbe,
+0x0,
+0x0,
+0x0,
+0xbf,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x0,
+0x0,
+0x0,
+0xc1,
+0x0,
+0x0,
+0x0,
+0xc2,
+0x0,
+0x0,
+0x0,
+0xc3,
+0x0,
+0x0,
+0x0,
+0xc3,
+0x0,
+0x0,
+0x0,
+0xc4,
+0x0,
+0x0,
+0x0,
+0xc5,
+0x0,
+0x0,
+0x0,
+0xc5,
+0x0,
+0x0,
+0x0,
+0xc6,
+0x0,
+0x0,
+0x0,
+0xc7,
+0x0,
+0x0,
+0x0,
+0xc7,
+0x0,
+0x0,
+0x0,
+0xc8,
+0x0,
+0x0,
+0x0,
+0xc9,
+0x0,
+0x0,
+0x0,
+0xca,
+0x0,
+0x0,
+0x0,
+0xca,
+0x0,
+0x0,
+0x0,
+0xcb,
+0x0,
+0x0,
+0x0,
+0xcc,
+0x0,
+0x0,
+0x0,
+0xcc,
+0x0,
+0x0,
+0x0,
+0xcd,
+0x0,
+0x0,
+0x0,
+0xce,
+0x0,
+0x0,
+0x0,
+0xce,
+0x0,
+0x0,
+0x0,
+0xcf,
+0x0,
+0x0,
+0x0,
+0xd0,
+0x0,
+0x0,
+0x0,
+0xd0,
+0x0,
+0x0,
+0x0,
+0xd1,
+0x0,
+0x0,
+0x0,
+0xd2,
+0x0,
+0x0,
+0x0,
+0xd2,
+0x0,
+0x0,
+0x0,
+0xe2,
+0x13,
+0xf7,
+0xbf,
+0x37,
+0x1,
+0x0,
+0x0,
+0xac,
+0xf7,
+0xf9,
+0xbf,
+0x0,
+0x0,
+0x0,
+0x0,
+0x80,
+0x1,
+0x7a,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0xcc,
+0xfa,
+0x76,
+0x0,
+0x42,
+0x52,
+0x64,
+0x81,
+0x18,
+0x52,
+0x64,
+0x81,
+0x2,
+0x0,
+0x0,
+0x0,
+0xda,
+0x0,
+0x0,
+0x0,
+0x4,
+0x0,
+0x0,
+0x0,
+0x3,
+0x0,
+0x0,
+0x0,
+0x66,
+0xc,
+0xfa,
+0xbf,
+0x18,
+0x52,
+0x64,
+0x81,
+0x7a,
+0xc,
+0xfa,
+0xbf,
+0x42,
+0x52,
+0x64,
+0x81,
+0x80,
+0x1,
+0x7a,
+0x0,
+0x4,
+0x0,
+0x0,
+0x0,
+0xf8,
+0xfa,
+0x76,
+0x0,
+0xef,
+0x5b,
+0xf7,
+0xbf,
+0xf8,
+0xfa,
+0x76,
+0x0,
+0xe8,
+0x5d,
+0xf7,
+0xbf,
+0x0,
+0x0,
+0x0,
+0x0,
+0x80,
+0x1,
+0x7a,
+0x0,
+0x4,
+0x0,
+0x0,
+0x0,
+0x2,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0xf7,
+0xbf,
+0x18,
+0x52,
+0x64,
+0x81,
+0x0,
+0x0,
+0x0,
+0x0,
+0x80,
+0x1,
+0x7a,
+0x0,
+0x8d,
+0xea,
+0x40,
+0x0,
+0x4,
+0x0,
+0x0,
+0x0,
+0x80,
+0x1,
+0x7a,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0xab,
+0xea,
+0x40,
+0x0,
+0x2,
+0x0,
+0x0,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0x38,
+0x44,
+0x41,
+0x0,
+0x28,
+0xba,
+0x40,
+0x0,
+0x2,
+0x0,
+0x0,
+0x0,
+0xb3,
+0xba,
+0x40,
+0x0,
+0x2,
+0x0,
+0x0,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0xa,
+0x31,
+0x0,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0x74,
+0x1e,
+0xa7,
+0x0,
+0x58,
+0x15,
+0x0,
+0x0
+};
+
+unsigned char IMAGE_NAME[] = {
+0xc,
+0xe,
+0xe,
+0xe,
+0xc,
+0x8,
+0x3,
+0x29,
+0x9,
+0x9,
+0xa,
+0xc,
+0xb,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0x9,
+0x8,
+0x3,
+0x9,
+0x2e,
+0xf,
+0xe,
+0xc,
+0xa,
+0x9,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x39,
+0x0,
+0x33,
+0x32,
+0x31,
+0x30,
+0x30,
+0x40,
+0x40,
+0x40,
+0x30,
+0x30,
+0x42,
+0x32,
+0x32,
+0x21,
+0x0,
+0x22,
+0x39,
+0x22,
+0x39,
+0x39,
+0x2,
+0x2,
+0x9,
+0x9,
+0xc,
+0x2e,
+0xe,
+0xe,
+0x2e,
+0x9,
+0x3,
+0x29,
+0x9,
+0xa,
+0x2e,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0x9,
+0x29,
+0x3,
+0x9,
+0xd,
+0xf,
+0xe,
+0x2e,
+0xa,
+0x9,
+0x8,
+0x3,
+0x2,
+0x2,
+0x1,
+0x22,
+0x39,
+0x22,
+0x22,
+0x22,
+0x0,
+0x21,
+0x33,
+0x32,
+0x32,
+0x31,
+0x42,
+0x42,
+0x41,
+0x42,
+0x42,
+0x31,
+0x32,
+0x31,
+0x20,
+0x20,
+0x33,
+0x21,
+0x33,
+0x21,
+0x33,
+0x0,
+0x22,
+0x1,
+0x8,
+0x29,
+0x9,
+0xc,
+0xe,
+0xe,
+0xf,
+0x2e,
+0x8,
+0x3,
+0x8,
+0x2d,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xc,
+0x9,
+0x8,
+0x3,
+0x9,
+0xe,
+0xf,
+0xd,
+0xb,
+0xa,
+0x9,
+0x29,
+0x2,
+0x39,
+0x22,
+0x0,
+0x21,
+0x33,
+0x21,
+0x33,
+0x21,
+0x33,
+0x33,
+0x20,
+0x20,
+0x32,
+0x20,
+0x20,
+0x20,
+0x20,
+0x32,
+0x20,
+0x32,
+0x20,
+0x32,
+0x32,
+0x20,
+0x32,
+0x32,
+0x32,
+0x31,
+0x20,
+0x33,
+0x0,
+0x2,
+0x8,
+0x9,
+0x2e,
+0xe,
+0xe,
+0xe,
+0x9,
+0x8,
+0x3,
+0x29,
+0x9,
+0xc,
+0x2e,
+0xd,
+0xe,
+0xe,
+0xd,
+0x2e,
+0xc,
+0x2b,
+0x8,
+0x29,
+0x2a,
+0x2e,
+0xe,
+0xe,
+0x2e,
+0xc,
+0x9,
+0x8,
+0x2,
+0x2,
+0x39,
+0x22,
+0x0,
+0x33,
+0x21,
+0x33,
+0x0,
+0x33,
+0x0,
+0x0,
+0x33,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x22,
+0x0,
+0x0,
+0x33,
+0x20,
+0x20,
+0x32,
+0x31,
+0x32,
+0x31,
+0x42,
+0x31,
+0x32,
+0x20,
+0x0,
+0x23,
+0x9,
+0x2e,
+0xe,
+0xe,
+0x9,
+0x29,
+0x3,
+0x29,
+0x29,
+0x9,
+0x2a,
+0x9,
+0x9,
+0x2a,
+0x8,
+0x9,
+0x8,
+0x29,
+0x29,
+0x8,
+0x9,
+0x2e,
+0xe,
+0xe,
+0x2e,
+0xa,
+0x9,
+0x8,
+0x3,
+0x23,
+0x1,
+0x22,
+0x0,
+0x0,
+0x0,
+0x33,
+0x21,
+0x21,
+0x33,
+0x0,
+0x22,
+0x39,
+0x1,
+0x2,
+0x2,
+0x3,
+0x2,
+0x29,
+0x3,
+0x2,
+0x2,
+0x39,
+0x0,
+0x33,
+0x20,
+0x31,
+0x42,
+0x41,
+0x42,
+0x42,
+0x31,
+0x20,
+0x0,
+0x2,
+0xc,
+0xe,
+0xe,
+0xa,
+0x2,
+0x29,
+0x8,
+0x9,
+0x9,
+0x9,
+0x8,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x29,
+0x9,
+0xc,
+0xe,
+0xf,
+0xe,
+0x2e,
+0xc,
+0x9,
+0x29,
+0x2,
+0x2,
+0x39,
+0x22,
+0x0,
+0x0,
+0x33,
+0x0,
+0x0,
+0x0,
+0x33,
+0x0,
+0x22,
+0x39,
+0x2,
+0x2,
+0x29,
+0x8,
+0x9,
+0x9,
+0x9,
+0x9,
+0x2a,
+0x29,
+0x2,
+0x1,
+0x0,
+0x20,
+0x32,
+0x41,
+0x42,
+0x30,
+0x42,
+0x31,
+0x20,
+0x22,
+0x2,
+0x2e,
+0xe,
+0xe,
+0xa,
+0x8,
+0x29,
+0x29,
+0x9,
+0x9,
+0x9,
+0x9,
+0x8,
+0x29,
+0x3,
+0x29,
+0x2,
+0x2,
+0x29,
+0x3,
+0x8,
+0x9,
+0x2e,
+0xe,
+0xe,
+0xe,
+0x2e,
+0xc,
+0x9,
+0x8,
+0x3,
+0x2,
+0x39,
+0x22,
+0x0,
+0x0,
+0x33,
+0x21,
+0x33,
+0x0,
+0x0,
+0x22,
+0x23,
+0x2,
+0x29,
+0x29,
+0x9,
+0x9,
+0x9,
+0x9,
+0x2a,
+0x29,
+0x2,
+0x2,
+0x39,
+0x0,
+0x33,
+0x20,
+0x20,
+0x20,
+0x33,
+0x21,
+0x22,
+0x2,
+0x29,
+0x2e,
+0xe,
+0xe,
+0xa,
+0x29,
+0x3,
+0x29,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x29,
+0x8,
+0x2a,
+0x8,
+0x8,
+0x29,
+0x8,
+0x3,
+0x29,
+0x29,
+0x2d,
+0x2e,
+0xe,
+0xe,
+0x2e,
+0xa,
+0x9,
+0x2,
+0x1,
+0x0,
+0x33,
+0x20,
+0x32,
+0x20,
+0x20,
+0x33,
+0x0,
+0x22,
+0x23,
+0x2,
+0x29,
+0x29,
+0x8,
+0x9,
+0x2a,
+0x29,
+0x8,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x39,
+0x23,
+0x1,
+0x2,
+0x2,
+0x3,
+0x8,
+0xc,
+0x2e,
+0xe,
+0xf,
+0xc,
+0x9,
+0x2,
+0x29,
+0x8,
+0x9,
+0x9,
+0x9,
+0x9,
+0xa,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x8,
+0x8,
+0x3,
+0x2,
+0x8,
+0xc,
+0xe,
+0xe,
+0xe,
+0xa,
+0x9,
+0x3,
+0x1,
+0x0,
+0x33,
+0x20,
+0x32,
+0x32,
+0x20,
+0x33,
+0x0,
+0x22,
+0x39,
+0x2,
+0x2,
+0x29,
+0x29,
+0x8,
+0x8,
+0x29,
+0x29,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x29,
+0x8,
+0xc,
+0xc,
+0x2e,
+0xe,
+0xe,
+0xe,
+0x9,
+0x29,
+0x3,
+0x29,
+0x9,
+0xa,
+0xc,
+0x2e,
+0x2e,
+0xd,
+0x2e,
+0xe,
+0x2e,
+0xa,
+0x9,
+0x8,
+0x29,
+0x29,
+0xa,
+0xd,
+0xe,
+0xe,
+0x2e,
+0xa,
+0x9,
+0x3,
+0x23,
+0x0,
+0x0,
+0x32,
+0x32,
+0x31,
+0x32,
+0x32,
+0x32,
+0x20,
+0x21,
+0x0,
+0x22,
+0x22,
+0x1,
+0x23,
+0x1,
+0x23,
+0x1,
+0x23,
+0x1,
+0x1,
+0x23,
+0x1,
+0x22,
+0x1,
+0x22,
+0x1,
+0x22,
+0x2,
+0x2,
+0x3,
+0x9,
+0x9,
+0xa,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xc,
+0x8,
+0x3,
+0x9,
+0xa,
+0xd,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0x9,
+0x2a,
+0x8,
+0x9,
+0xe,
+0xe,
+0x2e,
+0xc,
+0x2b,
+0x8,
+0x29,
+0x1,
+0x22,
+0x21,
+0x20,
+0x32,
+0x31,
+0x32,
+0x31,
+0x31,
+0x32,
+0x32,
+0x20,
+0x20,
+0x33,
+0x21,
+0x33,
+0x21,
+0x21,
+0x33,
+0x21,
+0x0,
+0x33,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x22,
+0x0,
+0x22,
+0x22,
+0x39,
+0x2,
+0x29,
+0x8,
+0x9,
+0xc,
+0x2e,
+0xe,
+0xf,
+0xd,
+0x9,
+0x3,
+0x29,
+0x9,
+0xc,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xc,
+0x9,
+0x3,
+0x8,
+0x2e,
+0xf,
+0xe,
+0x2e,
+0xa,
+0x9,
+0x29,
+0x2,
+0x1,
+0x0,
+0x33,
+0x20,
+0x32,
+0x31,
+0x42,
+0x31,
+0x42,
+0x31,
+0x20,
+0x20,
+0x33,
+0x21,
+0x0,
+0x0,
+0x22,
+0x22,
+0x0,
+0x22,
+0x0,
+0x0,
+0x0,
+0x33,
+0x0,
+0x33,
+0x21,
+0x20,
+0x33,
+0x20,
+0x33,
+0x0,
+0x22,
+0x2,
+0x2,
+0x29,
+0x9,
+0x2e,
+0x2e,
+0xe,
+0xf,
+0x2e,
+0x9,
+0x29,
+0x3,
+0x29,
+0x9,
+0x9,
+0xa,
+0xc,
+0xa,
+0x9,
+0x29,
+0x8,
+0x29,
+0xc,
+0xe,
+0xe,
+0x2e,
+0xc,
+0x9,
+0x8,
+0x3,
+0x1,
+0x22,
+0x21,
+0x32,
+0x31,
+0x42,
+0x42,
+0x30,
+0x30,
+0x42,
+0x31,
+0x32,
+0x33,
+0x0,
+0x39,
+0x2,
+0x2,
+0x29,
+0x3,
+0x8,
+0x2,
+0x2,
+0x39,
+0x0,
+0x33,
+0x20,
+0x31,
+0x42,
+0x42,
+0x30,
+0x42,
+0x42,
+0x31,
+0x20,
+0x22,
+0x1,
+0x3,
+0x8,
+0xc,
+0xb,
+0xe,
+0xe,
+0xf,
+0x2e,
+0x9,
+0x8,
+0x2,
+0x29,
+0x29,
+0x29,
+0x8,
+0x8,
+0x29,
+0x2,
+0x8,
+0xc,
+0xe,
+0xf,
+0xe,
+0x2e,
+0xa,
+0x9,
+0x29,
+0x2,
+0x1,
+0x22,
+0x33,
+0x20,
+0x31,
+0x42,
+0x30,
+0x30,
+0x30,
+0x42,
+0x31,
+0x20,
+0x0,
+0x22,
+0x2,
+0x8,
+0x29,
+0x9,
+0x9,
+0x9,
+0x8,
+0x3,
+0x1,
+0x22,
+0x33,
+0x31,
+0x42,
+0x30,
+0x30,
+0x30,
+0x30,
+0x30,
+0x42,
+0x32,
+0x21,
+0x1,
+0x2,
+0x8,
+0x9,
+0xa,
+0x2e,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x9,
+0x3,
+0x2,
+0x29,
+0x29,
+0x29,
+0x8,
+0x3,
+0x2,
+0x9,
+0xc,
+0xe,
+0xf,
+0xd,
+0x2e,
+0xa,
+0x9,
+0x29,
+0x2,
+0x2,
+0x39,
+0x22,
+0x21,
+0x33,
+0x33,
+0x20,
+0x20,
+0x20,
+0x33,
+0x0,
+0x22,
+0x1,
+0x2,
+0x29,
+0x2a,
+0x9,
+0x9,
+0xa,
+0x9,
+0x9,
+0x29,
+0x2,
+0x2,
+0x22,
+0x21,
+0x32,
+0x32,
+0x31,
+0x32,
+0x31,
+0x20,
+0x20,
+0x33,
+0x0,
+0x2,
+0x2,
+0x2,
+0x29,
+0x9,
+0x9,
+0xb,
+0xd,
+0xe,
+0xe,
+0x2e,
+0x9,
+0x3,
+0x2,
+0x29,
+0x8,
+0x3,
+0x2,
+0x29,
+0x9,
+0x2e,
+0xf,
+0xe,
+0xe,
+0xc,
+0x2b,
+0x9,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x8,
+0x8,
+0x29,
+0x8,
+0x9,
+0x9,
+0x9,
+0xa,
+0x2d,
+0xa,
+0xc,
+0x9,
+0x9,
+0x8,
+0x29,
+0x2,
+0x2,
+0x1,
+0x22,
+0x22,
+0x22,
+0x39,
+0x39,
+0x39,
+0x39,
+0x39,
+0x2,
+0x2,
+0x2,
+0x29,
+0x9,
+0x9,
+0x2e,
+0xd,
+0xe,
+0xe,
+0x2e,
+0x9,
+0x3,
+0x2,
+0x29,
+0x29,
+0x8,
+0x2,
+0x29,
+0x9,
+0x2e,
+0xf,
+0xe,
+0xd,
+0x2e,
+0xa,
+0x9,
+0x8,
+0x29,
+0x3,
+0x3,
+0x2,
+0x8,
+0x8,
+0x29,
+0x29,
+0x29,
+0x29,
+0x8,
+0x29,
+0x9,
+0x2a,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x8,
+0x29,
+0x3,
+0x2,
+0x2,
+0x23,
+0x1,
+0x39,
+0x1,
+0x22,
+0x23,
+0x39,
+0x23,
+0x3,
+0x29,
+0x9,
+0xa,
+0x2e,
+0xd,
+0xe,
+0xe,
+0x2e,
+0x9,
+0x8,
+0x3,
+0x29,
+0x8,
+0x9,
+0x8,
+0x2a,
+0x29,
+0x3,
+0x8,
+0x9,
+0x2e,
+0xf,
+0xe,
+0x2e,
+0xc,
+0x2b,
+0x9,
+0x8,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x23,
+0x23,
+0x1,
+0x2,
+0x1,
+0x23,
+0x1,
+0x39,
+0x1,
+0x22,
+0x22,
+0x39,
+0x22,
+0x22,
+0x22,
+0x0,
+0x22,
+0x0,
+0x0,
+0x0,
+0x33,
+0x21,
+0x33,
+0x0,
+0x0,
+0x39,
+0x23,
+0x29,
+0x9,
+0x2e,
+0xe,
+0xe,
+0xf,
+0x2e,
+0x9,
+0x8,
+0x2,
+0x29,
+0x29,
+0x9,
+0x9,
+0x9,
+0xa,
+0x9,
+0x9,
+0x8,
+0x2,
+0x8,
+0xa,
+0xe,
+0xf,
+0xe,
+0x2e,
+0xc,
+0x2b,
+0x9,
+0x29,
+0x2,
+0x2,
+0x1,
+0x22,
+0x22,
+0x0,
+0x0,
+0x0,
+0x0,
+0x33,
+0x21,
+0x20,
+0x20,
+0x32,
+0x32,
+0x31,
+0x31,
+0x42,
+0x42,
+0x31,
+0x42,
+0x31,
+0x31,
+0x43,
+0x31,
+0x32,
+0x31,
+0x32,
+0x32,
+0x32,
+0x20,
+0x33,
+0x39,
+0x2,
+0x9,
+0xc,
+0x2e,
+0xe,
+0xf,
+0x2e,
+0x9,
+0x8,
+0x2,
+0x3,
+0x29,
+0x8,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x2a,
+0x29,
+0x3,
+0x2,
+0x9,
+0x2e,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0xa,
+0x9,
+0x29,
+0x2,
+0x2,
+0x39,
+0x39,
+0x22,
+0x0,
+0x0,
+0x33,
+0x0,
+0x21,
+0x33,
+0x20,
+0x20,
+0x32,
+0x32,
+0x32,
+0x31,
+0x31,
+0x43,
+0x31,
+0x32,
+0x32,
+0x20,
+0x20,
+0x20,
+0x33,
+0x20,
+0x33,
+0x0,
+0x0,
+0x22,
+0x2,
+0x2,
+0x2e,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x9,
+0x8,
+0x2,
+0x2,
+0x29,
+0x3,
+0x3,
+0x3,
+0x2,
+0x29,
+0x2,
+0x29,
+0x2,
+0x8,
+0x2,
+0x2,
+0x2,
+0x29,
+0x8,
+0x9,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xb,
+0x2d,
+0x2a,
+0x29,
+0x2,
+0x1,
+0x22,
+0x22,
+0x22,
+0x22,
+0x22,
+0x22,
+0x22,
+0x22,
+0x22,
+0x22,
+0x22,
+0x0,
+0x22,
+0x0,
+0x22,
+0x22,
+0x39,
+0x39,
+0x1,
+0x23,
+0x2,
+0x2,
+0x2,
+0x8,
+0x2,
+0x29,
+0x29,
+0x9,
+0x9,
+0xe,
+0xe,
+0xf,
+0x2e,
+0x9,
+0x29,
+0x2,
+0x3,
+0x2,
+0x8,
+0x2,
+0x2,
+0x2,
+0x3,
+0x29,
+0x29,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x3,
+0x2,
+0x3,
+0x8,
+0xc,
+0xe,
+0xe,
+0xe,
+0x2e,
+0xa,
+0x8,
+0x8,
+0x2,
+0x1,
+0x22,
+0x39,
+0x39,
+0x1,
+0x23,
+0x1,
+0x23,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x29,
+0x29,
+0x29,
+0x8,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0xc,
+0x2e,
+0xe,
+0xe,
+0xf,
+0x2e,
+0xa,
+0x29,
+0x2,
+0x2,
+0x2,
+0x2,
+0x29,
+0x29,
+0x29,
+0x9,
+0x9,
+0xa,
+0x9,
+0x9,
+0xa,
+0x9,
+0xc,
+0x2b,
+0xc,
+0x2e,
+0x2e,
+0xe,
+0xe,
+0xe,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x8,
+0x29,
+0x29,
+0x2,
+0x2,
+0x3,
+0x2,
+0x29,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x29,
+0x29,
+0x8,
+0x9,
+0x9,
+0x9,
+0xa,
+0xa,
+0x2d,
+0xa,
+0xc,
+0x2e,
+0x2e,
+0xe,
+0xe,
+0xf,
+0xe,
+0x2e,
+0x9,
+0x8,
+0x29,
+0x29,
+0x8,
+0x9,
+0xa,
+0x2e,
+0xd,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xf,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0xa,
+0x9,
+0x9,
+0x29,
+0x29,
+0x29,
+0x8,
+0x8,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x8,
+0x29,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x29,
+0x29,
+0x2a,
+0x9,
+0xa,
+0xc,
+0xc,
+0x2e,
+0x2e,
+0xb,
+0x2e,
+0x2e,
+0x2e,
+0xd,
+0xd,
+0xe,
+0xe,
+0xe,
+0xe,
+0x2e,
+0xa,
+0x9,
+0x9,
+0xa,
+0xc,
+0x2e,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xe,
+0xf,
+0xf,
+0xe,
+0xe,
+0xd,
+0xb,
+0xc,
+0xa,
+0x9,
+0x29,
+0x29,
+0x3,
+0x3,
+0x29,
+0x29,
+0x8,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x2a,
+0x29,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x3,
+0x29,
+0x8,
+0x9,
+0x9,
+0xa,
+0x2d,
+0xa,
+0xc,
+0xa,
+0xa,
+0x2d,
+0xa,
+0xd,
+0x8,
+0x9,
+0x9,
+0x2e,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xe,
+0x2e,
+0xc,
+0x2b,
+0x9,
+0x29,
+0x29,
+0x2a,
+0x29,
+0x9,
+0x9,
+0xa,
+0xd,
+0xe,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0x2d,
+0x9,
+0x9,
+0x2a,
+0x29,
+0x29,
+0x3,
+0x3,
+0x2,
+0x2,
+0x3,
+0x2,
+0x2,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x23,
+0x23,
+0x1,
+0x22,
+0x1,
+0x22,
+0x1,
+0x22,
+0x1,
+0x39,
+0x1,
+0x23,
+0x1,
+0x23,
+0x1,
+0x39,
+0x1,
+0x23,
+0x29,
+0x22,
+0x1,
+0x2,
+0x3,
+0x8,
+0x9,
+0xc,
+0x2e,
+0xe,
+0xf,
+0xc,
+0x9,
+0x2,
+0x29,
+0x29,
+0x2a,
+0x29,
+0x8,
+0x29,
+0x2,
+0x3,
+0x8,
+0x9,
+0x2e,
+0xe,
+0xf,
+0xe,
+0xe,
+0x2e,
+0xc,
+0x9,
+0x8,
+0x3,
+0x2,
+0x39,
+0x22,
+0x0,
+0x22,
+0x0,
+0x22,
+0x22,
+0x22,
+0x22,
+0x39,
+0x39,
+0x39,
+0x39,
+0x22,
+0x0,
+0x0,
+0x0,
+0x33,
+0x20,
+0x32,
+0x32,
+0x31,
+0x31,
+0x42,
+0x31,
+0x42,
+0x31,
+0x31,
+0x32,
+0x0,
+0x22,
+0x1,
+0x2,
+0x8,
+0x8,
+0x9,
+0xa,
+0x2e,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x9,
+0x8,
+0x8,
+0x8,
+0x8,
+0x29,
+0x29,
+0x8,
+0x2a,
+0x9,
+0xc,
+0xb,
+0xd,
+0xf,
+0xf,
+0xe,
+0xe,
+0x2e,
+0xc,
+0x9,
+0x9,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x23,
+0x1,
+0x39,
+0x22,
+0x0,
+0x33,
+0x20,
+0x32,
+0x31,
+0x42,
+0x42,
+0x42,
+0x42,
+0x31,
+0x32,
+0x32,
+0x20,
+0x2,
+0x2,
+0x29,
+0x9,
+0xa,
+0xc,
+0x2e,
+0x2e,
+0xd,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0x2e,
+0xe,
+0x2e,
+0xe,
+0xf,
+0xf,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xc,
+0xa,
+0xc,
+0xa,
+0xc,
+0xa,
+0xc,
+0xa,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x8,
+0x29,
+0x2,
+0x39,
+0x0,
+0x33,
+0x20,
+0x32,
+0x31,
+0x42,
+0x31,
+0x32,
+0x20,
+0x33,
+0x0,
+0x2,
+0x29,
+0x9,
+0xa,
+0xc,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0x2e,
+0x2e,
+0xd,
+0xe,
+0xe,
+0xf,
+0xe,
+0xf,
+0xe,
+0xe,
+0xf,
+0xf,
+0xe,
+0xf,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0x2e,
+0xd,
+0xb,
+0x2e,
+0x2e,
+0xc,
+0xc,
+0xa,
+0x9,
+0x29,
+0x2,
+0x39,
+0x0,
+0x33,
+0x20,
+0x32,
+0x31,
+0x32,
+0x32,
+0x33,
+0x21,
+0x22,
+0x2,
+0x29,
+0x9,
+0xa,
+0xc,
+0xc,
+0xb,
+0x2e,
+0xd,
+0x2e,
+0xe,
+0x2e,
+0xd,
+0x2e,
+0xe,
+0x2e,
+0xd,
+0x2e,
+0xe,
+0xe,
+0xd,
+0xe,
+0xe,
+0xe,
+0xd,
+0xe,
+0x2e,
+0x2e,
+0xd,
+0x2e,
+0xd,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xd,
+0xe,
+0xe,
+0xe,
+0x2e,
+0xd,
+0xb,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x9,
+0x9,
+0x9,
+0x8,
+0x3,
+0x2,
+0x1,
+0x22,
+0x0,
+0x33,
+0x32,
+0x20,
+0x32,
+0x32,
+0x20,
+0x33,
+0x0,
+0x1,
+0x3,
+0x29,
+0x9,
+0xa,
+0xc,
+0xc,
+0x2e,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xf,
+0xf,
+0xe,
+0xe,
+0xe,
+0xf,
+0xe,
+0xf,
+0xe,
+0xd,
+0xb,
+0xc,
+0x9,
+0x9,
+0x2a,
+0x9,
+0x2a,
+0x9,
+0x9,
+0x9,
+0xa,
+0xc,
+0xc,
+0xb,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0x2b,
+0x9,
+0x8,
+0x3,
+0x2,
+0x2,
+0x1,
+0x23,
+0x39,
+0x22,
+0x0,
+0x0,
+0x33,
+0x0,
+0x20,
+0x32,
+0x32,
+0x20,
+0x20,
+0x33,
+0x21,
+0x22,
+0x1,
+0x2,
+0x29,
+0x8,
+0x9,
+0x9,
+0xa,
+0xc,
+0xc,
+0xb,
+0xd,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xd,
+0x2e,
+0xa,
+0x9,
+0x9,
+0x29,
+0x29,
+0x8,
+0x29,
+0x8,
+0x29,
+0x9,
+0x9,
+0xa,
+0xc,
+0xc,
+0xa,
+0x2e,
+0xc,
+0xc,
+0xa,
+0x9,
+0x9,
+0x8,
+0x8,
+0x2,
+0x2,
+0x1,
+0x22,
+0x39,
+0x22,
+0x22,
+0x0,
+0x0,
+0x0,
+0x33,
+0x21,
+0x33,
+0x21,
+0x33,
+0x0,
+0x0,
+0x0,
+0x22,
+0x2,
+0x1,
+0x23,
+0x1,
+0x1,
+0x23,
+0x2,
+0x2,
+0x2,
+0x29,
+0x29,
+0x8,
+0x8,
+0x9,
+0x8,
+0x9,
+0x9,
+0x2a,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0xa,
+0x9,
+0x2d,
+0xa,
+0xc,
+0xa,
+0x2d,
+0xa,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x8,
+0x9,
+0x8,
+0x9,
+0x2a,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x8,
+0x8,
+0x8,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x23,
+0x0,
+0x0,
+0x20,
+0x20,
+0x32,
+0x20,
+0x20,
+0x20,
+0x20,
+0x33,
+0x20,
+0x33,
+0x21,
+0x33,
+0x0,
+0x33,
+0x0,
+0x0,
+0x39,
+0x2,
+0x29,
+0x9,
+0x9,
+0x2e,
+0x2e,
+0xd,
+0xe,
+0x2e,
+0x2e,
+0xb,
+0xc,
+0x9,
+0x9,
+0x29,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x3,
+0x29,
+0x9,
+0xa,
+0xc,
+0x2e,
+0x2e,
+0x2e,
+0xd,
+0xb,
+0x2e,
+0xc,
+0xa,
+0x2d,
+0x9,
+0x9,
+0x9,
+0x9,
+0x2a,
+0x9,
+0x2a,
+0x29,
+0x29,
+0x2,
+0x1,
+0x22,
+0x33,
+0x20,
+0x32,
+0x32,
+0x31,
+0x32,
+0x32,
+0x32,
+0x20,
+0x32,
+0x32,
+0x20,
+0x32,
+0x32,
+0x20,
+0x32,
+0x33,
+0x0,
+0x22,
+0x23,
+0x2,
+0x8,
+0x9,
+0x9,
+0xc,
+0x2e,
+0xc,
+0xa,
+0xc,
+0xa,
+0x9,
+0x9,
+0x2a,
+0x29,
+0x29,
+0x29,
+0x29,
+0x29,
+0x9,
+0x9,
+0x9,
+0xc,
+0x2e,
+0xb,
+0xd,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0xc,
+0xa,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x29,
+0x3,
+0x1,
+0x1,
+0x22,
+0x0,
+0x0,
+0x33,
+0x20,
+0x33,
+0x20,
+0x33,
+0x20,
+0x20,
+0x20,
+0x20,
+0x32,
+0x32,
+0x20,
+0x32,
+0x20,
+0x33,
+0x21,
+0x33,
+0x0,
+0x22,
+0x22,
+0x39,
+0x23,
+0x2,
+0x2,
+0x29,
+0x8,
+0x9,
+0x9,
+0xc,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xd,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xc,
+0xa,
+0x2d,
+0x2b,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x29,
+0x8,
+0x2,
+0x2,
+0x39,
+0x39,
+0x0,
+0x0,
+0x0,
+0x33,
+0x21,
+0x21,
+0x33,
+0x33,
+0x20,
+0x20,
+0x32,
+0x32,
+0x20,
+0x32,
+0x32,
+0x20,
+0x32,
+0x32,
+0x20,
+0x32,
+0x32,
+0x20,
+0x20,
+0x21,
+0x0,
+0x1,
+0x2,
+0x8,
+0xc,
+0x2e,
+0xd,
+0xe,
+0xf,
+0xf,
+0xf,
+0xf,
+0xf,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0xc,
+0x2b,
+0x9,
+0x2a,
+0x29,
+0x8,
+0x8,
+0x8,
+0x8,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x2a,
+0x8,
+0x29,
+0x3,
+0x2,
+0x2,
+0x1,
+0x1,
+0x22,
+0x22,
+0x22,
+0x0,
+0x33,
+0x21,
+0x32,
+0x32,
+0x20,
+0x32,
+0x31,
+0x32,
+0x32,
+0x32,
+0x20,
+0x20,
+0x20,
+0x33,
+0x0,
+0x0,
+0x22,
+0x39,
+0x2,
+0x2,
+0x29,
+0x9,
+0x9,
+0xa,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0xc,
+0x9,
+0x9,
+0x9,
+0x29,
+0x29,
+0x29,
+0x8,
+0x2a,
+0x9,
+0x9,
+0x9,
+0x9,
+0xa,
+0x9,
+0xa,
+0x9,
+0x9,
+0x9,
+0x29,
+0x9,
+0x29,
+0x8,
+0x29,
+0x8,
+0x2,
+0x2,
+0x2,
+0x39,
+0x22,
+0x21,
+0x33,
+0x32,
+0x32,
+0x31,
+0x31,
+0x32,
+0x31,
+0x20,
+0x33,
+0x0,
+0x22,
+0x1,
+0x2,
+0x3,
+0x8,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x8,
+0x29,
+0x29,
+0x29,
+0x29,
+0x29,
+0x8,
+0x2a,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x2a,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0xa,
+0xa,
+0x9,
+0xa,
+0xa,
+0x9,
+0xa,
+0x9,
+0x8,
+0x8,
+0x29,
+0x3,
+0x3,
+0x2,
+0x2,
+0x1,
+0x22,
+0x0,
+0x33,
+0x32,
+0x31,
+0x32,
+0x42,
+0x42,
+0x31,
+0x31,
+0x32,
+0x33,
+0x0,
+0x39,
+0x2,
+0x3,
+0x8,
+0x9,
+0xa,
+0xc,
+0xa,
+0xc,
+0x2b,
+0x9,
+0x8,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x8,
+0x29,
+0x29,
+0x9,
+0x9,
+0x9,
+0xa,
+0xa,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x8,
+0x2a,
+0x8,
+0x8,
+0x9,
+0x0,
+0x0,
+0x33,
+0x33,
+0x20,
+0x20,
+0x32,
+0x32,
+0x31,
+0x42,
+0x30,
+0x30,
+0x30,
+0x30,
+0x40,
+0x30,
+0x30,
+0x30,
+0x42,
+0x32,
+0x33,
+0x39,
+0x2,
+0x29,
+0x9,
+0x9,
+0xc,
+0xc,
+0x2e,
+0xc,
+0xa,
+0xc,
+0x9,
+0x9,
+0x2a,
+0x8,
+0x8,
+0x29,
+0x8,
+0x9,
+0x9,
+0x9,
+0xc,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x8,
+0x29,
+0x2,
+0x1,
+0x22,
+0x22,
+0x22,
+0x22,
+0x21,
+0x33,
+0x0,
+0x33,
+0x1,
+0x30,
+0x30,
+0x30,
+0x30,
+0x40,
+0x30,
+0x40,
+0x40,
+0x40,
+0x40,
+0x63,
+0x40,
+0x40,
+0x40,
+0x63,
+0x40,
+0x40,
+0x40,
+0x30,
+0x42,
+0x20,
+0x0,
+0x2,
+0x29,
+0x9,
+0xa,
+0xc,
+0xb,
+0x2e,
+0x2e,
+0xb,
+0xc,
+0xc,
+0xa,
+0xa,
+0x9,
+0x9,
+0x9,
+0x9,
+0xa,
+0xc,
+0x2e,
+0x2e,
+0xd,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0xc,
+0x9,
+0x29,
+0x2,
+0x22,
+0x33,
+0x20,
+0x31,
+0x42,
+0x31,
+0x42,
+0x42,
+0x42,
+0x41,
+0x31,
+0x32,
+0x31,
+0x42,
+0x42,
+0x41,
+0x30,
+0x30,
+0x30,
+0x30,
+0x40,
+0x40,
+0x40,
+0x40,
+0x40,
+0x40,
+0x40,
+0x30,
+0x30,
+0x30,
+0x32,
+0x20,
+0x0,
+0x23,
+0x29,
+0x8,
+0x9,
+0xc,
+0xc,
+0x2e,
+0x2e,
+0xc,
+0xc,
+0xa,
+0x2d,
+0xa,
+0x9,
+0x9,
+0xa,
+0x9,
+0xc,
+0xc,
+0x2e,
+0x2e,
+0xd,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0x8,
+0x29,
+0x23,
+0x22,
+0x21,
+0x33,
+0x33,
+0x20,
+0x33,
+0x0,
+0x33,
+0x21,
+0x32,
+0x2,
+0x2,
+0x1,
+0x22,
+0x22,
+0x22,
+0x0,
+0x0,
+0x33,
+0x20,
+0x20,
+0x32,
+0x32,
+0x31,
+0x31,
+0x42,
+0x31,
+0x32,
+0x32,
+0x20,
+0x21,
+0x0,
+0x22,
+0x2,
+0x2,
+0x29,
+0x29,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0xa,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0xa,
+0xc,
+0xc,
+0x2e,
+0xb,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x9,
+0x9,
+0x2a,
+0x8,
+0x9,
+0x8,
+0x29,
+0x2a,
+0x9,
+0x8,
+0x8,
+0x29,
+0x9,
+0x2a,
+0x8,
+0x29,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x39,
+0x22,
+0x0,
+0x0,
+0x33,
+0x0,
+0x33,
+0x0,
+0x33,
+0x21,
+0x0,
+0x0,
+0x22,
+0x39,
+0x39,
+0x2,
+0x2,
+0x3,
+0x29,
+0x8,
+0x2a,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0xa,
+0xc,
+0xc,
+0xc,
+0xc,
+0x2e,
+0xc,
+0xc,
+0xa,
+0x2d,
+0xa,
+0xa,
+0x2d,
+0xa,
+0xc,
+0xc,
+0xa,
+0xc,
+0xc,
+0xc,
+0xa,
+0xc,
+0xa,
+0x9,
+0x3,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x23,
+0x1,
+0x39,
+0x22,
+0x0,
+0x0,
+0x0,
+0x33,
+0x21,
+0x33,
+0x21,
+0x33,
+0x0,
+0x22,
+0x39,
+0x1,
+0x2,
+0x2,
+0x29,
+0x8,
+0x9,
+0x9,
+0x9,
+0xa,
+0x2d,
+0xa,
+0xa,
+0x2d,
+0xa,
+0x9,
+0xa,
+0x9,
+0xa,
+0xa,
+0x9,
+0xa,
+0xc,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x29,
+0x8,
+0x29,
+0x8,
+0x8,
+0x29,
+0x8,
+0x8,
+0x8,
+0x29,
+0x29,
+0x3,
+0x29,
+0x8,
+0x29,
+0x8,
+0x22,
+0x0,
+0x22,
+0x22,
+0x0,
+0x0,
+0x0,
+0x0,
+0x33,
+0x0,
+0x33,
+0x0,
+0x33,
+0x33,
+0x21,
+0x20,
+0x33,
+0x0,
+0x0,
+0x22,
+0x2,
+0x2,
+0x29,
+0x9,
+0xa,
+0xc,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xc,
+0xc,
+0xc,
+0xa,
+0xa,
+0x9,
+0x9,
+0x29,
+0x3,
+0x2,
+0x2,
+0x23,
+0x1,
+0x22,
+0x22,
+0x22,
+0x22,
+0x22,
+0x0,
+0x0,
+0x0,
+0x33,
+0x21,
+0x33,
+0x0,
+0x0,
+0x0,
+0x22,
+0x33,
+0x21,
+0x33,
+0x0,
+0x33,
+0x0,
+0x33,
+0x0,
+0x21,
+0x33,
+0x21,
+0x33,
+0x0,
+0x0,
+0x33,
+0x21,
+0x0,
+0x0,
+0x22,
+0x2,
+0x3,
+0x29,
+0x9,
+0xc,
+0x2e,
+0x2e,
+0xd,
+0xe,
+0xe,
+0x2e,
+0xd,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xc,
+0xc,
+0xa,
+0xa,
+0x9,
+0x9,
+0x29,
+0x3,
+0x2,
+0x2,
+0x39,
+0x39,
+0x22,
+0x0,
+0x0,
+0x33,
+0x0,
+0x33,
+0x20,
+0x20,
+0x20,
+0x32,
+0x32,
+0x32,
+0x32,
+0x20,
+0x20,
+0x33,
+0x31,
+0x32,
+0x31,
+0x32,
+0x32,
+0x32,
+0x20,
+0x20,
+0x33,
+0x0,
+0x0,
+0x0,
+0x22,
+0x22,
+0x39,
+0x39,
+0x1,
+0x23,
+0x2,
+0x29,
+0x8,
+0x9,
+0xc,
+0xb,
+0xd,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0x2d,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x8,
+0x8,
+0x8,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x1,
+0x22,
+0x0,
+0x0,
+0x20,
+0x32,
+0x32,
+0x31,
+0x42,
+0x31,
+0x42,
+0x42,
+0x31,
+0x42,
+0x32,
+0x30,
+0x42,
+0x41,
+0x42,
+0x31,
+0x42,
+0x31,
+0x32,
+0x20,
+0x21,
+0x0,
+0x22,
+0x23,
+0x2,
+0x2,
+0x2,
+0x8,
+0x8,
+0x29,
+0x9,
+0xa,
+0xc,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0xa,
+0x9,
+0x9,
+0x29,
+0x8,
+0x8,
+0x8,
+0x8,
+0x8,
+0x8,
+0x8,
+0x8,
+0x8,
+0x8,
+0x8,
+0x8,
+0x29,
+0x2,
+0x2,
+0x22,
+0x21,
+0x32,
+0x32,
+0x42,
+0x30,
+0x30,
+0x30,
+0x30,
+0x30,
+0x30,
+0x30,
+0x30,
+0x30,
+0x42,
+0x42,
+0x31,
+0x42,
+0x31,
+0x32,
+0x20,
+0x21,
+0x22,
+0x1,
+0x2,
+0x3,
+0x29,
+0x8,
+0x9,
+0x2a,
+0x9,
+0x9,
+0x9,
+0xa,
+0xc,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x9,
+0x9,
+0x2a,
+0x29,
+0x9,
+0x8,
+0x8,
+0x8,
+0x8,
+0x8,
+0x29,
+0x8,
+0x8,
+0x8,
+0x29,
+0x3,
+0x2,
+0x23,
+0x22,
+0x21,
+0x20,
+0x32,
+0x42,
+0x41,
+0x30,
+0x30,
+0x30,
+0x30,
+0x30,
+0x30,
+0x42,
+0x42,
+0x31,
+0x42,
+0x31,
+0x32,
+0x31,
+0x33,
+0x21,
+0x22,
+0x2,
+0x2,
+0x8,
+0x9,
+0xa,
+0xc,
+0xa,
+0xc,
+0xa,
+0xa,
+0x9,
+0x9,
+0x9,
+0x8,
+0x8,
+0x29,
+0x8,
+0x8,
+0x29,
+0x29,
+0x29,
+0x29,
+0x9,
+0x9,
+0x9,
+0xa,
+0xc,
+0xa,
+0xc,
+0xa,
+0x2d,
+0x9,
+0x9,
+0x9,
+0x8,
+0x29,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x39,
+0x22,
+0x0,
+0x33,
+0x32,
+0x32,
+0x31,
+0x42,
+0x42,
+0x31,
+0x42,
+0x31,
+0x42,
+0x42,
+0x32,
+0x31,
+0x32,
+0x31,
+0x20,
+0x20,
+0x0,
+0x22,
+0x2,
+0x2,
+0x8,
+0xc,
+0xa,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x29,
+0x2,
+0x2,
+0x39,
+0x22,
+0x0,
+0x22,
+0x39,
+0x23,
+0x2,
+0x29,
+0x2a,
+0x9,
+0xc,
+0xc,
+0xb,
+0x2e,
+0xc,
+0xc,
+0xa,
+0x9,
+0x9,
+0x8,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x23,
+0x1,
+0x22,
+0x0,
+0x33,
+0x20,
+0x20,
+0x32,
+0x31,
+0x32,
+0x31,
+0x32,
+0x31,
+0x32,
+0x31,
+0x33,
+0x21,
+0x33,
+0x0,
+0x22,
+0x39,
+0x2,
+0x2,
+0x29,
+0x9,
+0x9,
+0xc,
+0xc,
+0xb,
+0xd,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x9,
+0x29,
+0x3,
+0x2,
+0x1,
+0x22,
+0x39,
+0x39,
+0x39,
+0x2,
+0x2,
+0x3,
+0x29,
+0x8,
+0x9,
+0x2a,
+0x9,
+0x8,
+0x9,
+0x9,
+0x2a,
+0x8,
+0x8,
+0x2a,
+0x8,
+0x8,
+0x8,
+0x29,
+0x3,
+0x2,
+0x2,
+0x1,
+0x22,
+0x0,
+0x0,
+0x33,
+0x33,
+0x20,
+0x33,
+0x21,
+0x33,
+0x33,
+0x20,
+0x23,
+0x2,
+0x2,
+0x3,
+0x29,
+0x29,
+0x9,
+0x9,
+0xa,
+0x2d,
+0xa,
+0xc,
+0xc,
+0xc,
+0x2e,
+0xc,
+0xc,
+0xc,
+0xc,
+0xa,
+0xa,
+0x9,
+0x9,
+0x8,
+0x8,
+0x3,
+0x2,
+0x2,
+0x23,
+0x1,
+0x22,
+0x39,
+0x39,
+0x39,
+0x1,
+0x22,
+0x39,
+0x39,
+0x1,
+0x2,
+0x2,
+0x29,
+0x8,
+0x9,
+0x9,
+0xa,
+0x2d,
+0xa,
+0x2d,
+0x9,
+0x9,
+0x8,
+0x29,
+0x3,
+0x2,
+0x23,
+0x1,
+0x22,
+0x22,
+0x39,
+0x1,
+0x22,
+0x1,
+0x22,
+0x3b,
+0x3,
+0x8,
+0x29,
+0x9,
+0x9,
+0xc,
+0xc,
+0xb,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0xa,
+0x9,
+0x9,
+0x29,
+0x3,
+0x2,
+0x2,
+0x1,
+0x22,
+0x22,
+0x22,
+0x0,
+0x0,
+0x0,
+0x0,
+0x22,
+0x39,
+0x2,
+0x2,
+0x29,
+0x9,
+0x9,
+0xa,
+0xc,
+0xc,
+0xa,
+0xa,
+0x9,
+0x9,
+0x8,
+0x3,
+0x2,
+0x2,
+0x1,
+0x22,
+0x22,
+0x22,
+0x22,
+0x39,
+0x39,
+0x2,
+0x1,
+0x2,
+0x2,
+0x29,
+0x9,
+0x9,
+0xc,
+0xb,
+0xd,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xf,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xd,
+0x2e,
+0x2e,
+0x2d,
+0x9,
+0x9,
+0x29,
+0x8,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x3,
+0x3,
+0x3,
+0x8,
+0x8,
+0x2a,
+0x2a,
+0x9,
+0x2a,
+0x9,
+0x8,
+0x8,
+0x29,
+0x2,
+0x2,
+0x22,
+0x0,
+0x0,
+0x0,
+0x33,
+0x20,
+0x20,
+0x20,
+0x20,
+0x33,
+0x39,
+0x22,
+0x1,
+0x2,
+0x29,
+0x9,
+0x9,
+0xc,
+0x2e,
+0xe,
+0xe,
+0xf,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xd,
+0xe,
+0xe,
+0xf,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x8,
+0x29,
+0x29,
+0x29,
+0x3,
+0x3,
+0x2,
+0x2,
+0x3,
+0x2,
+0x23,
+0x39,
+0x0,
+0x33,
+0x32,
+0x31,
+0x42,
+0x42,
+0x42,
+0x41,
+0x42,
+0x31,
+0x32,
+0x33,
+0x1,
+0x2,
+0x8,
+0x9,
+0xc,
+0xb,
+0xd,
+0xe,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0xc,
+0xc,
+0xa,
+0x9,
+0xa,
+0xc,
+0x2e,
+0x2e,
+0xe,
+0xe,
+0xf,
+0xe,
+0xe,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x9,
+0x9,
+0x29,
+0x2a,
+0x29,
+0x8,
+0x8,
+0x9,
+0x29,
+0x29,
+0x8,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x1,
+0x1,
+0x23,
+0x39,
+0x22,
+0x0,
+0x33,
+0x20,
+0x32,
+0x31,
+0x42,
+0x42,
+0x30,
+0x42,
+0x31,
+0x32,
+0x20,
+0x33,
+0x8,
+0x9,
+0x2e,
+0xe,
+0xe,
+0xe,
+0x2e,
+0xc,
+0x9,
+0x9,
+0x9,
+0xc,
+0x25,
+0x4,
+0x4,
+0x2b,
+0x9,
+0xc,
+0x2e,
+0xe,
+0xf,
+0xe,
+0xe,
+0x2e,
+0xc,
+0x9,
+0x29,
+0x3,
+0x2,
+0x2,
+0x23,
+0x1,
+0x1,
+0x23,
+0x1,
+0x1,
+0x23,
+0x1,
+0x23,
+0x1,
+0x22,
+0x22,
+0x22,
+0x0,
+0x0,
+0x0,
+0x33,
+0x0,
+0x0,
+0x33,
+0x21,
+0x20,
+0x20,
+0x32,
+0x32,
+0x32,
+0x31,
+0x32,
+0x31,
+0x32,
+0x32,
+0x21,
+0x0,
+0x39,
+0x9,
+0x2e,
+0xe,
+0xf,
+0xc,
+0x9,
+0x8,
+0x2,
+0x2,
+0x2,
+0x3,
+0x2,
+0x29,
+0x8,
+0x9,
+0x9,
+0x9,
+0xc,
+0x2e,
+0xe,
+0xf,
+0xe,
+0xb,
+0xc,
+0x9,
+0x3,
+0x2,
+0x39,
+0x22,
+0x0,
+0x0,
+0x33,
+0x0,
+0x0,
+0x0,
+0x22,
+0x0,
+0x22,
+0x0,
+0x0,
+0x0,
+0x33,
+0x21,
+0x32,
+0x20,
+0x32,
+0x32,
+0x32,
+0x32,
+0x20,
+0x32,
+0x32,
+0x20,
+0x32,
+0x32,
+0x20,
+0x32,
+0x32,
+0x20,
+0x20,
+0x33,
+0x0,
+0x1,
+0x3,
+0xc,
+0x2e,
+0xe,
+0xe,
+0xa,
+0x8,
+0x2,
+0x29,
+0x29,
+0x29,
+0x29,
+0x29,
+0x29,
+0x29,
+0x29,
+0x29,
+0x3,
+0x29,
+0x8,
+0xa,
+0xd,
+0xe,
+0xe,
+0x2e,
+0xa,
+0x9,
+0x2,
+0x2,
+0x1,
+0x22,
+0x22,
+0x22,
+0x22,
+0x22,
+0x22,
+0x39,
+0x22,
+0x39,
+0x39,
+0x22,
+0x0,
+0x33,
+0x20,
+0x32,
+0x31,
+0x42,
+0x42,
+0x42,
+0x42,
+0x42,
+0x31,
+0x32,
+0x31,
+0x20,
+0x20,
+0x20,
+0x33,
+0x0,
+0x33,
+0x0,
+0x0,
+0x39,
+0x2,
+0x8,
+0xc,
+0xe,
+0xe,
+0xe,
+0xa,
+0x29,
+0x2,
+0x8,
+0x9,
+0x9,
+0x9,
+0xa,
+0xc,
+0xa,
+0xc,
+0xa,
+0xc,
+0x9,
+0x8,
+0x8,
+0x29,
+0xc,
+0xe,
+0xe,
+0x2e,
+0xa,
+0x9,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x39,
+0x0,
+0x33,
+0x32,
+0x31,
+0x30,
+0x30,
+0x40,
+0x40,
+0x30,
+0x30,
+0x30,
+0x42,
+0x32,
+0x32,
+0x0,
+0x0,
+0x22,
+0x22,
+0x39,
+0x39,
+0x23,
+0x2,
+0x29,
+0x9,
+0xc,
+0xe,
+0xc,
+0x8,
+0x9,
+0xc,
+0x2e,
+0xe,
+0x2e,
+0x9,
+0x29,
+0x2e,
+0xe,
+0x9,
+0x8,
+0x2,
+0x2,
+0x2,
+0x1,
+0x22,
+0x21,
+0x32,
+0x30,
+0x30,
+0x30,
+0x42,
+0x32,
+0x33,
+0x0,
+0x0,
+0x22,
+0x8,
+0x9,
+0x2e,
+0xe,
+0x9,
+0x29,
+0xa,
+0xe,
+0xe,
+0xe,
+0xc,
+0x8,
+0x9,
+0xe,
+0x2e,
+0x9,
+0x2,
+0x39,
+0x0,
+0x33,
+0x0,
+0x33,
+0x21,
+0x33,
+0x33,
+0x20,
+0x33,
+0x20,
+0x32,
+0x31,
+0x32,
+0x20,
+0x22,
+0x2e,
+0x2e,
+0x8,
+0x29,
+0x9,
+0x29,
+0x8,
+0x29,
+0x29,
+0x9,
+0x2e,
+0xe,
+0xc,
+0x8,
+0x2,
+0x22,
+0x0,
+0x0,
+0x33,
+0x0,
+0x39,
+0x2,
+0x29,
+0x8,
+0x29,
+0x2,
+0x0,
+0x32,
+0x41,
+0x42,
+0x32,
+0x1,
+0xd,
+0x2e,
+0x3,
+0x8,
+0x9,
+0x9,
+0x29,
+0x29,
+0x29,
+0x29,
+0x9,
+0xa,
+0xd,
+0xb,
+0x9,
+0x2,
+0x22,
+0x20,
+0x20,
+0x0,
+0x22,
+0x2,
+0x29,
+0x9,
+0x2a,
+0x29,
+0x2,
+0x22,
+0x0,
+0x0,
+0x1,
+0x8,
+0x2e,
+0xe,
+0x9,
+0x29,
+0x9,
+0xa,
+0xc,
+0xc,
+0xa,
+0x9,
+0x8,
+0x8,
+0x2e,
+0xe,
+0xc,
+0x3,
+0x0,
+0x20,
+0x32,
+0x32,
+0x21,
+0x22,
+0x2,
+0x2,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x23,
+0x2,
+0x9,
+0x9,
+0x2e,
+0xe,
+0xa,
+0x29,
+0xc,
+0xe,
+0xe,
+0xe,
+0xc,
+0x8,
+0xd,
+0x2e,
+0xa,
+0x29,
+0x22,
+0x20,
+0x32,
+0x31,
+0x31,
+0x32,
+0x33,
+0x0,
+0x0,
+0x0,
+0x0,
+0x33,
+0x0,
+0x0,
+0x33,
+0x0,
+0x2,
+0x2,
+0xa,
+0xd,
+0xe,
+0x9,
+0x29,
+0x2a,
+0x9,
+0x2a,
+0x29,
+0xc,
+0xe,
+0x2e,
+0x9,
+0x23,
+0x0,
+0x32,
+0x30,
+0x30,
+0x42,
+0x33,
+0x1,
+0x3,
+0x29,
+0x29,
+0x2,
+0x21,
+0x43,
+0x30,
+0x30,
+0x42,
+0x21,
+0x2,
+0x8,
+0xa,
+0xe,
+0xe,
+0x9,
+0x3,
+0x29,
+0x3,
+0x29,
+0xe,
+0xe,
+0xa,
+0x9,
+0x2,
+0x23,
+0x39,
+0x22,
+0x22,
+0x1,
+0x2,
+0x8,
+0x9,
+0xa,
+0x9,
+0x29,
+0x2,
+0x22,
+0x20,
+0x33,
+0x0,
+0x22,
+0x2,
+0x9,
+0xc,
+0xe,
+0x2e,
+0x9,
+0x3,
+0x29,
+0x29,
+0x8,
+0x2e,
+0xe,
+0xc,
+0x9,
+0x3,
+0x3,
+0x2,
+0x2,
+0x8,
+0x2,
+0x29,
+0x3,
+0x8,
+0x8,
+0x2,
+0x2,
+0x23,
+0x1,
+0x22,
+0x22,
+0x22,
+0x1,
+0x9,
+0xd,
+0xe,
+0x9,
+0x3,
+0x29,
+0x9,
+0x9,
+0x9,
+0x29,
+0x2a,
+0xe,
+0xe,
+0xc,
+0x2a,
+0x8,
+0x1,
+0x22,
+0x0,
+0x0,
+0x33,
+0x20,
+0x32,
+0x31,
+0x31,
+0x31,
+0x32,
+0x32,
+0x20,
+0x20,
+0x0,
+0x23,
+0xe,
+0xe,
+0x9,
+0x2,
+0x8,
+0x2,
+0x3,
+0x29,
+0x2,
+0x2,
+0x2,
+0x29,
+0x9,
+0xe,
+0xd,
+0xa,
+0x8,
+0x1,
+0x22,
+0x22,
+0x39,
+0x39,
+0x1,
+0x1,
+0x23,
+0x1,
+0x2,
+0x3,
+0x29,
+0x8,
+0x9,
+0x9,
+0xe,
+0xe,
+0x9,
+0x3,
+0x3,
+0x2a,
+0x2d,
+0xb,
+0xd,
+0xb,
+0xd,
+0xb,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x29,
+0x8,
+0x29,
+0x8,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x29,
+0x9,
+0x9,
+0xc,
+0xa,
+0x2e,
+0x2e,
+0xc,
+0x2e,
+0xd,
+0xb,
+0x2e,
+0xc,
+0xa,
+0xc,
+0x2e,
+0x2e,
+0xe,
+0x2e,
+0xc,
+0x9,
+0x8,
+0x8,
+0x29,
+0x8,
+0x8,
+0x29,
+0x8,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x2,
+0x29,
+0x8,
+0x29,
+0x29,
+0x9,
+0x22,
+0x2,
+0x9,
+0x2e,
+0xe,
+0x2e,
+0x29,
+0x8,
+0x8,
+0x29,
+0x29,
+0xc,
+0xe,
+0xe,
+0x2e,
+0x9,
+0x8,
+0x1,
+0x22,
+0x1,
+0x22,
+0x23,
+0x1,
+0x22,
+0x22,
+0x0,
+0x20,
+0x32,
+0x42,
+0x31,
+0x42,
+0x20,
+0x2,
+0x9,
+0xc,
+0xb,
+0xd,
+0xe,
+0x2e,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xf,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x29,
+0x39,
+0x33,
+0x32,
+0x31,
+0x20,
+0x0,
+0x29,
+0x9,
+0x2e,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xe,
+0xd,
+0xb,
+0xc,
+0xa,
+0xc,
+0x2e,
+0x2e,
+0x2e,
+0xd,
+0x2e,
+0xc,
+0x2b,
+0x8,
+0x29,
+0x2,
+0x1,
+0x22,
+0x33,
+0x20,
+0x32,
+0x33,
+0x1,
+0x2,
+0x3,
+0x29,
+0x2a,
+0x9,
+0xc,
+0xa,
+0xc,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x3,
+0x3,
+0x2,
+0x2,
+0x39,
+0x22,
+0x22,
+0x39,
+0x39,
+0x1,
+0x0,
+0x32,
+0x32,
+0x20,
+0x20,
+0x20,
+0x20,
+0x20,
+0x33,
+0x39,
+0x29,
+0x9,
+0x2e,
+0x2e,
+0x2e,
+0xa,
+0x8,
+0x29,
+0x2,
+0x29,
+0x9,
+0xc,
+0xb,
+0xd,
+0x2e,
+0xa,
+0xa,
+0x9,
+0x9,
+0x9,
+0x8,
+0x2,
+0x1,
+0x0,
+0x33,
+0x21,
+0x33,
+0x20,
+0x20,
+0x32,
+0x20,
+0x20,
+0x20,
+0x33,
+0x0,
+0x39,
+0x2,
+0x9,
+0x2e,
+0xe,
+0xe,
+0xe,
+0xd,
+0xb,
+0xc,
+0x9,
+0x9,
+0x29,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x3,
+0x29,
+0x2,
+0x2,
+0x1,
+0x0,
+0x33,
+0x32,
+0x31,
+0x32,
+0x20,
+0x33,
+0x39,
+0x2,
+0x8,
+0x29,
+0x9,
+0x9,
+0xa,
+0x9,
+0x9,
+0xa,
+0x2d,
+0x2b,
+0x9,
+0x2a,
+0x2a,
+0x9,
+0x9,
+0xa,
+0x9,
+0xa,
+0x9,
+0x2,
+0x39,
+0x22,
+0x0,
+0x20,
+0x31,
+0x42,
+0x30,
+0x30,
+0x32,
+0x0,
+0x2,
+0x9,
+0xc,
+0xa,
+0x2d,
+0x2a,
+0x29,
+0x3,
+0x29,
+0x2a,
+0x2d,
+0xa,
+0xc,
+0xa,
+0x9,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x2,
+0x42,
+0x30,
+0x30,
+0x40,
+0x40,
+0x40,
+0x40,
+0x40,
+0x40,
+0x42,
+0x21,
+0x2,
+0x9,
+0x2e,
+0x2e,
+0x2e,
+0xa,
+0xa,
+0x9,
+0xa,
+0xc,
+0x2e,
+0xe,
+0xd,
+0xb,
+0x9,
+0x2,
+0x33,
+0x20,
+0x32,
+0x32,
+0x32,
+0x3,
+0x2,
+0x2,
+0x39,
+0x0,
+0x33,
+0x20,
+0x32,
+0x20,
+0x33,
+0x0,
+0x39,
+0x2,
+0x8,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0xc,
+0x2e,
+0x2e,
+0x2e,
+0xa,
+0x2d,
+0x9,
+0x9,
+0x9,
+0x9,
+0x9,
+0x2a,
+0x23,
+0x1,
+0x22,
+0x22,
+0x0,
+0x0,
+0x33,
+0x20,
+0x0,
+0x0,
+0x2,
+0x29,
+0x9,
+0xa,
+0xc,
+0xc,
+0xa,
+0xc,
+0xa,
+0xc,
+0xa,
+0x9,
+0x8,
+0x29,
+0x2,
+0x2,
+0x2,
+0x2,
+0x23,
+0x1,
+0x23,
+0x2,
+0x20,
+0x20,
+0x20,
+0x20,
+0x33,
+0x21,
+0x0,
+0x22,
+0x22,
+0x2,
+0x8,
+0xc,
+0x2e,
+0xe,
+0xd,
+0x2e,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x9,
+0x29,
+0x2,
+0x23,
+0x22,
+0x0,
+0x33,
+0x20,
+0x32,
+0x31,
+0x32,
+0x32,
+0x30,
+0x42,
+0x31,
+0x32,
+0x0,
+0x22,
+0x2,
+0x29,
+0x8,
+0x9,
+0xc,
+0x2e,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0x9,
+0x9,
+0x29,
+0x29,
+0x8,
+0x8,
+0x8,
+0x8,
+0x2,
+0x1,
+0x33,
+0x31,
+0x30,
+0x30,
+0x30,
+0x30,
+0x31,
+0x32,
+0x32,
+0x21,
+0x23,
+0x29,
+0xc,
+0x2e,
+0xc,
+0xa,
+0x9,
+0x3,
+0x2,
+0x23,
+0x2,
+0x29,
+0x9,
+0xc,
+0xa,
+0xc,
+0x9,
+0x2a,
+0x29,
+0x2,
+0x2,
+0x39,
+0x33,
+0x20,
+0x31,
+0x43,
+0x31,
+0x42,
+0x22,
+0x39,
+0x2,
+0x29,
+0x9,
+0xa,
+0x2e,
+0x2e,
+0x2e,
+0xc,
+0x9,
+0x8,
+0x2,
+0x23,
+0x1,
+0x23,
+0x2,
+0x2,
+0x3,
+0x8,
+0x29,
+0x8,
+0x9,
+0x9,
+0x9,
+0x3,
+0x2,
+0x22,
+0x0,
+0x0,
+0x0,
+0x0,
+0x2,
+0x29,
+0x9,
+0xc,
+0x2e,
+0xe,
+0xd,
+0xe,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0xa,
+0x9,
+0x29,
+0x2,
+0x23,
+0x1,
+0x22,
+0x2,
+0x3,
+0x8,
+0x9,
+0x9,
+0x9,
+0x8,
+0x2,
+0x1,
+0x0,
+0x0,
+0x0,
+0x22,
+0x1,
+0x29,
+0xa,
+0xd,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0xc,
+0xb,
+0xd,
+0xe,
+0xe,
+0x2e,
+0xa,
+0x9,
+0x9,
+0x9,
+0x8,
+0x9,
+0x29,
+0x3,
+0x2,
+0x2,
+0x2,
+0x22,
+0x33,
+0x32,
+0x41,
+0x42,
+0x31,
+0x20,
+0x9,
+0xe,
+0x2e,
+0x9,
+0x8,
+0x8,
+0x2c,
+0x9,
+0x2d,
+0xe,
+0xe,
+0x2e,
+0x9,
+0x2,
+0x1,
+0x22,
+0x22,
+0x22,
+0x22,
+0x22,
+0x0,
+0x0,
+0x33,
+0x20,
+0x20,
+0x20,
+0x32,
+0x20,
+0x32,
+0x32,
+0x33,
+0x1,
+0x2e,
+0xe,
+0x9,
+0x3,
+0x29,
+0x9,
+0x9,
+0x2a,
+0x9,
+0x8,
+0x2e,
+0xe,
+0xa,
+0x29,
+0x2,
+0x39,
+0x1,
+0x1,
+0x23,
+0x22,
+0x21,
+0x32,
+0x30,
+0x30,
+0x30,
+0x42,
+0x32,
+0x21,
+0x0,
+0x0,
+0x1,
+0x3,
+0x2e,
+0xa,
+0x9,
+0xe,
+0xc,
+0x9,
+0x2e,
+0x29,
+0x39,
+0x0,
+0x33,
+0x31,
+0x32,
+0x20,
+0x33,
+0x39,
+0x2e,
+0x8,
+0x9,
+0x8,
+0x8,
+0x2e,
+0xc,
+0x2,
+0x0,
+0x33,
+0x23,
+0x8,
+0x29,
+0x0,
+0x20,
+0x22,
+0x2e,
+0xa,
+0x9,
+0xd,
+0xc,
+0x2a,
+0x2e,
+0x29,
+0x20,
+0x32,
+0x21,
+0x22,
+0x39,
+0x22,
+0x22,
+0x2,
+0x29,
+0x2e,
+0x9,
+0x8,
+0x8,
+0xd,
+0x2b,
+0x1,
+0x33,
+0x20,
+0x1,
+0x2a,
+0x29,
+0x0,
+0x32,
+0x20,
+0x9,
+0x2e,
+0x9,
+0x8,
+0x8,
+0x2e,
+0xc,
+0x3,
+0x2,
+0x39,
+0x39,
+0x0,
+0x0,
+0x0,
+0x33,
+0x39,
+0xe,
+0x8,
+0x29,
+0x9,
+0x9,
+0x9,
+0xc,
+0xa,
+0x29,
+0x2,
+0x2,
+0x2,
+0x2,
+0x8,
+0x9,
+0xa,
+0x2a,
+0xc,
+0x2e,
+0x9,
+0x9,
+0x2e,
+0x2e,
+0x9,
+0x29,
+0x2,
+0x2,
+0x23,
+0x1,
+0x22,
+0x0,
+0x39,
+0x8,
+0x2e,
+0xe,
+0xd,
+0xe,
+0xe,
+0x2e,
+0x2e,
+0xd,
+0xb,
+0xc,
+0x9,
+0x29,
+0x0,
+0x32,
+0x21,
+0x22,
+0x39,
+0x2,
+0x2,
+0x29,
+0x9,
+0xa,
+0x9,
+0x9,
+0x8,
+0x9,
+0x9,
+0x2a,
+0x29,
+0x2,
+0x2,
+0x2,
+0x22,
+0x33,
+0x32,
+0x20,
+0x0,
+0x1,
+0x2a,
+0xc,
+0x2e,
+0xc,
+0xa,
+0x8,
+0x9,
+0x9,
+0x2a,
+0x33,
+0x31,
+0x42,
+0x30,
+0x42,
+0x39,
+0xa,
+0xc,
+0x9,
+0x9,
+0xa,
+0x2e,
+0x9,
+0x2,
+0x0,
+0x0,
+0x2,
+0x39,
+0x0,
+0x20,
+0x33,
+0x1,
+0x2a,
+0xc,
+0x2b,
+0x2d,
+0xa,
+0x9,
+0x8,
+0x8,
+0x29,
+0x8,
+0x31,
+0x32,
+0x0,
+0x23,
+0x29,
+0xc,
+0xe,
+0x2e,
+0xa,
+0x9,
+0x8,
+0x8,
+0x39,
+0x20,
+0x42,
+0x42,
+0x33,
+0x1,
+0x8,
+0x2e,
+0xc,
+0x8,
+0x2,
+0x2,
+0x29,
+0x9,
+0x9,
+0x8,
+0x2,
+0x22,
+0x20,
+0x20,
+0x2,
+0xc,
+0xe,
+0x2e,
+0x2e,
+0xd,
+0xa,
+0x9,
+0x2,
+0x29,
+0x8,
+0x29,
+0x2,
+0x0,
+0x20,
+0x33,
+0x2e,
+0x9,
+0x2a,
+0x9,
+0x9,
+0xe,
+0x29,
+0x1,
+0x22,
+0x39,
+0x33,
+0x31,
+0x32,
+0x20,
+0x33,
+0x39,
+0xa,
+0x9,
+0xc,
+0x9,
+0x0,
+0x22,
+0x0,
+0x21,
+0xa,
+0x9,
+0x2d,
+0x2a,
+0x20,
+0x1,
+0x1,
+0x0,
+0xc,
+0x2a,
+0x9,
+0x9,
+0x2,
+0x39,
+0x23,
+0x2,
+0x9,
+0x2e,
+0x2e,
+0x2e,
+0x9,
+0x8,
+0x39,
+0x0,
+0x39,
+0x22,
+0x1,
+0x2a,
+0x9,
+0x9,
+0x9,
+0x29,
+0x0,
+0x32,
+0x21,
+0x2b,
+0x9,
+0xc,
+0x8,
+0x23,
+0x20,
+0x3,
+0x9,
+0x9,
+0x9,
+0x8,
+0x22,
+0x32,
+0x9,
+0xc,
+0xb,
+0x8,
+0x2,
+0x39,
+0x0,
+0x33,
+0xa,
+0x9,
+0x0,
+0x0,
+0xa,
+0xc,
+0x3,
+0x1,
+0x0,
+0x2,
+0xa,
+0x29,
+0x29,
+0x9,
+0x3,
+0x33,
+0x9,
+0x1,
+0x2,
+0x3,
+0x3,
+0x0,
+0x0,
+0x0
+};
+
+#undef RAW_NAME 
+#undef IMAGE_NAME 
+#define RAW_NAME hilite_3dfinfo_raw 
+#define IMAGE_NAME hilite_3dfinfo_image 
+unsigned char RAW_NAME[] = {
+0x20,
+0x0,
+0x0,
+0x0,
+0x20,
+0x0,
+0x0,
+0x0,
+0x8,
+0x0,
+0x0,
+0x0,
+0x3,
+0x0,
+0x0,
+0x0,
+0x3,
+0x0,
+0x0,
+0x0,
+0x3,
+0x0,
+0x0,
+0x0,
+0xff,
+0x1,
+0xfc,
+0x1,
+0xee,
+0x1,
+0x19,
+0x0,
+0x10,
+0x0,
+0xe5,
+0x1,
+0x11,
+0x0,
+0x6,
+0x0,
+0xe8,
+0x1,
+0x9,
+0x0,
+0x8,
+0x0,
+0xeb,
+0x1,
+0x1,
+0x0,
+0x4,
+0x0,
+0x22,
+0x22,
+0x2b,
+0x3c,
+0x44,
+0x44,
+0x66,
+0x77,
+0x88,
+0x99,
+0xaa,
+0xbb,
+0xcc,
+0xdd,
+0xee,
+0xff,
+0x23,
+0x4e,
+0x3c,
+0x7,
+0xef,
+0x1,
+0x4,
+0x0,
+0x12,
+0x1c,
+0x88,
+0x7,
+0xfc,
+0xff,
+0xd3,
+0x7,
+0x10,
+0x32,
+0xb8,
+0x7,
+0x6,
+0x22,
+0x94,
+0x7,
+0x8,
+0x12,
+0xa0,
+0x7,
+0x4,
+0x2,
+0xac,
+0x7,
+0x62,
+0x0,
+0x0,
+0x0,
+0x63,
+0x0,
+0x0,
+0x0,
+0x64,
+0x0,
+0x0,
+0x0,
+0x65,
+0x0,
+0x0,
+0x0,
+0x66,
+0x0,
+0x0,
+0x0,
+0x67,
+0x0,
+0x0,
+0x0,
+0x69,
+0x0,
+0x0,
+0x0,
+0x6a,
+0x0,
+0x0,
+0x0,
+0x6b,
+0x0,
+0x0,
+0x0,
+0x6c,
+0x0,
+0x0,
+0x0,
+0x6d,
+0x0,
+0x0,
+0x0,
+0x6e,
+0x0,
+0x0,
+0x0,
+0x6f,
+0x0,
+0x0,
+0x0,
+0x70,
+0x0,
+0x0,
+0x0,
+0x71,
+0x0,
+0x0,
+0x0,
+0x72,
+0x0,
+0x0,
+0x0,
+0x73,
+0x0,
+0x0,
+0x0,
+0x74,
+0x0,
+0x0,
+0x0,
+0x75,
+0x0,
+0x0,
+0x0,
+0x76,
+0x0,
+0x0,
+0x0,
+0x77,
+0x0,
+0x0,
+0x0,
+0x78,
+0x0,
+0x0,
+0x0,
+0x79,
+0x0,
+0x0,
+0x0,
+0x7a,
+0x0,
+0x0,
+0x0,
+0x7b,
+0x0,
+0x0,
+0x0,
+0x7c,
+0x0,
+0x0,
+0x0,
+0x7d,
+0x0,
+0x0,
+0x0,
+0x7e,
+0x0,
+0x0,
+0x0,
+0x7f,
+0x0,
+0x0,
+0x0,
+0x80,
+0x0,
+0x0,
+0x0,
+0x81,
+0x0,
+0x0,
+0x0,
+0x82,
+0x0,
+0x0,
+0x0,
+0x83,
+0x0,
+0x0,
+0x0,
+0x84,
+0x0,
+0x0,
+0x0,
+0x85,
+0x0,
+0x0,
+0x0,
+0x86,
+0x0,
+0x0,
+0x0,
+0x87,
+0x0,
+0x0,
+0x0,
+0x87,
+0x0,
+0x0,
+0x0,
+0x88,
+0x0,
+0x0,
+0x0,
+0x89,
+0x0,
+0x0,
+0x0,
+0x8a,
+0x0,
+0x0,
+0x0,
+0x8b,
+0x0,
+0x0,
+0x0,
+0x8c,
+0x0,
+0x0,
+0x0,
+0x8d,
+0x0,
+0x0,
+0x0,
+0x8e,
+0x0,
+0x0,
+0x0,
+0x8f,
+0x0,
+0x0,
+0x0,
+0x90,
+0x0,
+0x0,
+0x0,
+0x90,
+0x0,
+0x0,
+0x0,
+0x91,
+0x0,
+0x0,
+0x0,
+0x92,
+0x0,
+0x0,
+0x0,
+0x93,
+0x0,
+0x0,
+0x0,
+0x94,
+0x0,
+0x0,
+0x0,
+0x95,
+0x0,
+0x0,
+0x0,
+0x96,
+0x0,
+0x0,
+0x0,
+0x96,
+0x0,
+0x0,
+0x0,
+0x97,
+0x0,
+0x0,
+0x0,
+0xeb,
+0xa5,
+0x40,
+0x0,
+0x41,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0xb8,
+0xfc,
+0x7b,
+0x0,
+0xd4,
+0xfc,
+0x7b,
+0x0,
+0xc,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x94,
+0xa4,
+0x40,
+0x0,
+0x12,
+0x9f,
+0x40,
+0x0,
+0x12,
+0x9f,
+0x40,
+0x0,
+0xa,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0xbc,
+0xfc,
+0x7b,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0x68,
+0x82,
+0xe2,
+0x0,
+0xa6,
+0x0,
+0x0,
+0x0,
+0xa7,
+0x0,
+0x0,
+0x0,
+0xa8,
+0x0,
+0x0,
+0x0,
+0xa8,
+0x0,
+0x0,
+0x0,
+0xa9,
+0x0,
+0x0,
+0x0,
+0xaa,
+0x0,
+0x0,
+0x0,
+0xab,
+0x0,
+0x0,
+0x0,
+0xac,
+0x0,
+0x0,
+0x0,
+0xac,
+0x0,
+0x0,
+0x0,
+0xad,
+0x0,
+0x0,
+0x0,
+0xae,
+0x0,
+0x0,
+0x0,
+0xaf,
+0x0,
+0x0,
+0x0,
+0xaf,
+0x0,
+0x0,
+0x0,
+0xb0,
+0x0,
+0x0,
+0x0,
+0xb1,
+0x0,
+0x0,
+0x0,
+0xb2,
+0x0,
+0x0,
+0x0,
+0xb2,
+0x0,
+0x0,
+0x0,
+0xb3,
+0x0,
+0x0,
+0x0,
+0xb4,
+0x0,
+0x0,
+0x0,
+0xb5,
+0x0,
+0x0,
+0x0,
+0xb5,
+0x0,
+0x0,
+0x0,
+0xb6,
+0x0,
+0x0,
+0x0,
+0xb7,
+0x0,
+0x0,
+0x0,
+0xb8,
+0x0,
+0x0,
+0x0,
+0xb8,
+0x0,
+0x0,
+0x0,
+0xb9,
+0x0,
+0x0,
+0x0,
+0xba,
+0x0,
+0x0,
+0x0,
+0xbb,
+0x0,
+0x0,
+0x0,
+0xbb,
+0x0,
+0x0,
+0x0,
+0xbc,
+0x0,
+0x0,
+0x0,
+0xbd,
+0x0,
+0x0,
+0x0,
+0xbe,
+0x0,
+0x0,
+0x0,
+0xbe,
+0x0,
+0x0,
+0x0,
+0xbf,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x0,
+0x0,
+0x0,
+0xc1,
+0x0,
+0x0,
+0x0,
+0xc2,
+0x0,
+0x0,
+0x0,
+0xc3,
+0x0,
+0x0,
+0x0,
+0xc3,
+0x0,
+0x0,
+0x0,
+0xc4,
+0x0,
+0x0,
+0x0,
+0xc5,
+0x0,
+0x0,
+0x0,
+0xc5,
+0x0,
+0x0,
+0x0,
+0xc6,
+0x0,
+0x0,
+0x0,
+0xc7,
+0x0,
+0x0,
+0x0,
+0xc7,
+0x0,
+0x0,
+0x0,
+0xc8,
+0x0,
+0x0,
+0x0,
+0xc9,
+0x0,
+0x0,
+0x0,
+0xca,
+0x0,
+0x0,
+0x0,
+0xca,
+0x0,
+0x0,
+0x0,
+0xcb,
+0x0,
+0x0,
+0x0,
+0xcc,
+0x0,
+0x0,
+0x0,
+0xcc,
+0x0,
+0x0,
+0x0,
+0xcd,
+0x0,
+0x0,
+0x0,
+0xce,
+0x0,
+0x0,
+0x0,
+0xce,
+0x0,
+0x0,
+0x0,
+0xcf,
+0x0,
+0x0,
+0x0,
+0xd0,
+0x0,
+0x0,
+0x0,
+0xd0,
+0x0,
+0x0,
+0x0,
+0xd1,
+0x0,
+0x0,
+0x0,
+0xd2,
+0x0,
+0x0,
+0x0,
+0xd2,
+0x0,
+0x0,
+0x0,
+0xd3,
+0x0,
+0x0,
+0x0,
+0xd4,
+0x0,
+0x0,
+0x0,
+0xd4,
+0x0,
+0x0,
+0x0,
+0xd5,
+0x0,
+0x0,
+0x0,
+0xd6,
+0x0,
+0x0,
+0x0,
+0xd6,
+0x0,
+0x0,
+0x0,
+0xd7,
+0x0,
+0x0,
+0x0,
+0xd8,
+0x0,
+0x0,
+0x0,
+0xd8,
+0x0,
+0x0,
+0x0,
+0xd9,
+0x0,
+0x0,
+0x0,
+0xda,
+0x0,
+0x0,
+0x0,
+0xda,
+0x0,
+0x0,
+0x0,
+0xdb,
+0x0,
+0x0,
+0x0,
+0xdc,
+0x0,
+0x0,
+0x0,
+0xdc,
+0x0,
+0x0,
+0x0,
+0xdd,
+0x0,
+0x0,
+0x0,
+0xde,
+0x0,
+0x0,
+0x0,
+0xde,
+0x0,
+0x0,
+0x0,
+0xdf,
+0x0,
+0x0,
+0x0,
+0xe0,
+0x0,
+0x0,
+0x0,
+0xe0,
+0x0,
+0x0,
+0x0,
+0xe1,
+0x0,
+0x0,
+0x0,
+0xe2,
+0x0,
+0x0,
+0x0,
+0xe2,
+0x0,
+0x0,
+0x0,
+0xe3,
+0x0,
+0x0,
+0x0,
+0xe3,
+0x0,
+0x0,
+0x0,
+0xe4,
+0x0,
+0x0,
+0x0,
+0xe5,
+0x0,
+0x0,
+0x0,
+0xe5,
+0x0,
+0x0,
+0x0,
+0xe6,
+0x0,
+0x0,
+0x0,
+0xe7,
+0x0,
+0x0,
+0x0,
+0xe7,
+0x0,
+0x0,
+0x0,
+0xe8,
+0x0,
+0x0,
+0x0,
+0xe9,
+0x0,
+0x0,
+0x0,
+0xe9,
+0x0,
+0x0,
+0x0,
+0xea,
+0x0,
+0x0,
+0x0,
+0xea,
+0x0,
+0x0,
+0x0,
+0xeb,
+0x0,
+0x0,
+0x0,
+0xec,
+0x0,
+0x0,
+0x0,
+0xec,
+0x0,
+0x0,
+0x0,
+0xed,
+0x0,
+0x0,
+0x0,
+0xee,
+0x0,
+0x0,
+0x0,
+0xee,
+0x0,
+0x0,
+0x0,
+0xef,
+0x0,
+0x0,
+0x0,
+0xef,
+0x0,
+0x0,
+0x0,
+0xf0,
+0x0,
+0x0,
+0x0,
+0xf1,
+0x0,
+0x0,
+0x0,
+0xf1,
+0x0,
+0x0,
+0x0,
+0xf2,
+0x0,
+0x0,
+0x0,
+0xf2,
+0x0,
+0x0,
+0x0,
+0xf3,
+0x0,
+0x0,
+0x0,
+0xf4,
+0x0,
+0x0,
+0x0,
+0xf4,
+0x0,
+0x0,
+0x0,
+0xf5,
+0x0,
+0x0,
+0x0,
+0xf5,
+0x0,
+0x0,
+0x0,
+0xf6,
+0x0,
+0x0,
+0x0,
+0xf7,
+0x0,
+0x0,
+0x0,
+0xf7,
+0x0,
+0x0,
+0x0,
+0xf8,
+0x0,
+0x0,
+0x0,
+0xf8,
+0x0,
+0x0,
+0x0,
+0xf9,
+0x0,
+0x0,
+0x0,
+0xfa,
+0x0,
+0x0,
+0x0,
+0xfa,
+0x0,
+0x0,
+0x0,
+0xfb,
+0x0,
+0x0,
+0x0,
+0xfb,
+0x0,
+0x0,
+0x0,
+0xfc,
+0x0,
+0x0,
+0x0,
+0xfd,
+0x0,
+0x0,
+0x0,
+0xfd,
+0x0,
+0x0,
+0x0,
+0xfe,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1b,
+0x0,
+0x0,
+0x0,
+0x1b,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x41,
+0x0,
+0x41,
+0x95,
+0x40,
+0x0,
+0x2,
+0x0,
+0x0,
+0x0,
+0x40,
+0x69,
+0xa0,
+0x0,
+0x1a,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0x1a,
+0x0,
+0x0,
+0x0,
+0xd8,
+0x9c,
+0x40,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0xfd,
+0x90,
+0x40,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0x3c,
+0x83,
+0xe2,
+0x0,
+0x48,
+0x8,
+0x0,
+0x0,
+0x68,
+0x82,
+0xe2,
+0x0,
+0xf,
+0x21,
+0x40,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0xec,
+0x41,
+0x55,
+0x0,
+0x38,
+0xfe,
+0x7b,
+0x0,
+0x74,
+0xe4,
+0x61,
+0x81,
+0x94,
+0xdf,
+0x61,
+0x81,
+0x0,
+0x0,
+0x6b,
+0x0,
+0xe0,
+0xae,
+0xa0,
+0x0,
+0x58,
+0x5,
+0x0,
+0x0
+};
+
+unsigned char IMAGE_NAME[] = {
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1,
+0x3,
+0x2,
+0x2,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1,
+0x2,
+0x5,
+0x7,
+0xc,
+0xb,
+0xb,
+0x7,
+0x5,
+0x2,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x2,
+0x7,
+0xb,
+0xe,
+0x11,
+0x16,
+0x16,
+0x15,
+0x11,
+0xe,
+0xa,
+0x6,
+0x2,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x3,
+0x8,
+0x10,
+0x14,
+0x17,
+0x1a,
+0x20,
+0x21,
+0x1e,
+0x1a,
+0x17,
+0x14,
+0xe,
+0x8,
+0x3,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x2,
+0x8,
+0x10,
+0x16,
+0x20,
+0x22,
+0x26,
+0x2d,
+0x2f,
+0x2b,
+0x26,
+0x21,
+0x1b,
+0x16,
+0x10,
+0x8,
+0x2,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1,
+0x7,
+0xf,
+0x16,
+0x1f,
+0x28,
+0x30,
+0x35,
+0x3d,
+0x40,
+0x3d,
+0x36,
+0x2d,
+0x26,
+0x1f,
+0x16,
+0xf,
+0x7,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x4,
+0xc,
+0x15,
+0x1c,
+0x28,
+0x31,
+0x41,
+0x46,
+0x4f,
+0x54,
+0x50,
+0x47,
+0x3f,
+0x31,
+0x28,
+0x1c,
+0x15,
+0xc,
+0x4,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1,
+0x7,
+0x11,
+0x1a,
+0x25,
+0x31,
+0x3e,
+0x4d,
+0x60,
+0x66,
+0x79,
+0x64,
+0x5e,
+0x4d,
+0x3e,
+0x31,
+0x25,
+0x1a,
+0x11,
+0x7,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x2,
+0xb,
+0x14,
+0x1f,
+0x2a,
+0x39,
+0x4a,
+0x63,
+0x76,
+0x94,
+0xa4,
+0x8c,
+0x76,
+0x5a,
+0x4a,
+0x39,
+0x2a,
+0x1f,
+0x14,
+0xb,
+0x2,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x4,
+0xe,
+0x16,
+0x21,
+0x2f,
+0x40,
+0x54,
+0x6a,
+0x91,
+0xcf,
+0xd9,
+0xc5,
+0x95,
+0x76,
+0x54,
+0x40,
+0x2f,
+0x21,
+0x16,
+0xe,
+0x4,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x6,
+0x10,
+0x1b,
+0x27,
+0x35,
+0x47,
+0x60,
+0x81,
+0xc1,
+0xeb,
+0xff,
+0xe8,
+0xb8,
+0x73,
+0x5d,
+0x44,
+0x31,
+0x23,
+0x17,
+0xe,
+0x4,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x4,
+0xe,
+0x17,
+0x27,
+0x38,
+0x4e,
+0x69,
+0x95,
+0xc7,
+0xec,
+0xff,
+0xe6,
+0xbe,
+0x81,
+0x5c,
+0x45,
+0x31,
+0x23,
+0x17,
+0xe,
+0x4,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x3,
+0xb,
+0x16,
+0x1c,
+0x2a,
+0x3a,
+0x4e,
+0x5b,
+0x73,
+0x9a,
+0xd1,
+0xf9,
+0xc0,
+0x9d,
+0x70,
+0x5d,
+0x4b,
+0x32,
+0x22,
+0x16,
+0xe,
+0x4,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x6,
+0x13,
+0x1c,
+0x21,
+0x2a,
+0x43,
+0x53,
+0x64,
+0x7c,
+0xa7,
+0x97,
+0x94,
+0x7a,
+0x64,
+0x52,
+0x3c,
+0x2e,
+0x1f,
+0x14,
+0xb,
+0x2,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1,
+0x7,
+0x11,
+0x1e,
+0x2c,
+0x33,
+0x46,
+0x55,
+0x69,
+0x72,
+0x6d,
+0x6c,
+0x62,
+0x54,
+0x46,
+0x33,
+0x25,
+0x1a,
+0x11,
+0x7,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x4,
+0x11,
+0x15,
+0x1c,
+0x28,
+0x34,
+0x47,
+0x56,
+0x55,
+0x55,
+0x54,
+0x4b,
+0x47,
+0x34,
+0x28,
+0x1c,
+0x15,
+0xc,
+0x4,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x2,
+0x7,
+0xf,
+0x16,
+0x1f,
+0x2a,
+0x34,
+0x42,
+0x3f,
+0x3f,
+0x3f,
+0x3d,
+0x30,
+0x29,
+0x1f,
+0x16,
+0xf,
+0x7,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x2,
+0x8,
+0x10,
+0x16,
+0x1e,
+0x25,
+0x2e,
+0x2c,
+0x2c,
+0x2c,
+0x28,
+0x21,
+0x1b,
+0x16,
+0x10,
+0x8,
+0x2,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x3,
+0x8,
+0xe,
+0x14,
+0x19,
+0x1c,
+0x1c,
+0x1c,
+0x1c,
+0x1a,
+0x17,
+0x14,
+0xe,
+0x8,
+0x3,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x2,
+0x6,
+0xa,
+0x11,
+0x11,
+0x13,
+0x13,
+0x13,
+0x11,
+0xe,
+0xa,
+0x6,
+0x2,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1,
+0x2,
+0xa,
+0x7,
+0x8,
+0x8,
+0x8,
+0x7,
+0x5,
+0x2,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1,
+0x1,
+0x1,
+0x1,
+0x1,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x59,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x2,
+0x5,
+0x6,
+0x4,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1,
+0x9,
+0x11,
+0x19,
+0x1b,
+0x14,
+0xc,
+0x3,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x8,
+0x17,
+0x27,
+0x31,
+0x35,
+0x2b,
+0x1e,
+0xf,
+0x3,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x3,
+0x13,
+0x26,
+0x3f,
+0x57,
+0x60,
+0x4c,
+0x32,
+0x1c,
+0xa,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x8,
+0x1a,
+0x35,
+0x5b,
+0x9b,
+0xb4,
+0x77,
+0x46,
+0x26,
+0x11,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0xa,
+0x20,
+0x41,
+0x78,
+0xd8,
+0xf3,
+0x9a,
+0x51,
+0x2a,
+0x13,
+0x2,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1,
+0xe,
+0x20,
+0x3d,
+0x62,
+0xa4,
+0xb9,
+0x7b,
+0x4e,
+0x28,
+0x11,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x3,
+0x15,
+0x29,
+0x46,
+0x62,
+0x60,
+0x52,
+0x35,
+0x1c,
+0xa,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x8,
+0x17,
+0x28,
+0x37,
+0x35,
+0x2e,
+0x1e,
+0xf,
+0x3,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1,
+0x8,
+0x12,
+0x17,
+0x18,
+0x14,
+0xc,
+0x3,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x3,
+0x4,
+0x5,
+0x4,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x16,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x3,
+0xd,
+0xf,
+0x4,
+0x0,
+0x0,
+0x0,
+0x1,
+0x16,
+0x3c,
+0x44,
+0x1f,
+0x3,
+0x0,
+0x0,
+0x4,
+0x2c,
+0x92,
+0xae,
+0x3a,
+0xa,
+0x0,
+0x0,
+0x4,
+0x27,
+0x6c,
+0x7a,
+0x32,
+0x7,
+0x0,
+0x0,
+0x0,
+0xa,
+0x22,
+0x24,
+0xf,
+0x1,
+0x0,
+0x0,
+0x0,
+0x0,
+0x2,
+0x2,
+0x0,
+0x0,
+0x0,
+0x5,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x4,
+0x5,
+0x0,
+0x1,
+0x44,
+0x53,
+0x3,
+0x1,
+0x30,
+0x38,
+0x2,
+0x1,
+0x0,
+0x0,
+0x0,
+0x12,
+0x17,
+0xd,
+0xf,
+0x11,
+0x0,
+0x0,
+0x0
+};
+
+#undef RAW_NAME 
+#undef IMAGE_NAME 
+#define RAW_NAME shadow_3dfinfo_raw 
+#define IMAGE_NAME shadow_3dfinfo_image 
+unsigned char RAW_NAME[] = {
+0x40,
+0x0,
+0x0,
+0x0,
+0x20,
+0x0,
+0x0,
+0x0,
+0x8,
+0x0,
+0x0,
+0x0,
+0x2,
+0x0,
+0x0,
+0x0,
+0x2,
+0x0,
+0x0,
+0x0,
+0x3,
+0x0,
+0x0,
+0x0,
+0xff,
+0x1,
+0xfc,
+0x1,
+0xee,
+0x1,
+0x19,
+0x0,
+0x10,
+0x0,
+0xe5,
+0x1,
+0x11,
+0x0,
+0x6,
+0x0,
+0xe8,
+0x1,
+0x9,
+0x0,
+0x8,
+0x0,
+0xeb,
+0x1,
+0x1,
+0x0,
+0x4,
+0x0,
+0x22,
+0x22,
+0x2b,
+0x3c,
+0x44,
+0x44,
+0x66,
+0x77,
+0x88,
+0x99,
+0xaa,
+0xbb,
+0xcc,
+0xdd,
+0xee,
+0xff,
+0x23,
+0x4e,
+0x3c,
+0x7,
+0xef,
+0x1,
+0x4,
+0x0,
+0x12,
+0x1c,
+0x88,
+0x7,
+0xfc,
+0xff,
+0xd3,
+0x7,
+0x10,
+0x32,
+0xb8,
+0x7,
+0x6,
+0x22,
+0x94,
+0x7,
+0x8,
+0x12,
+0xa0,
+0x7,
+0x4,
+0x2,
+0xac,
+0x7,
+0x62,
+0x0,
+0x0,
+0x0,
+0x63,
+0x0,
+0x0,
+0x0,
+0x64,
+0x0,
+0x0,
+0x0,
+0x65,
+0x0,
+0x0,
+0x0,
+0x66,
+0x0,
+0x0,
+0x0,
+0x67,
+0x0,
+0x0,
+0x0,
+0x69,
+0x0,
+0x0,
+0x0,
+0x6a,
+0x0,
+0x0,
+0x0,
+0x6b,
+0x0,
+0x0,
+0x0,
+0x6c,
+0x0,
+0x0,
+0x0,
+0x6d,
+0x0,
+0x0,
+0x0,
+0x6e,
+0x0,
+0x0,
+0x0,
+0x6f,
+0x0,
+0x0,
+0x0,
+0x70,
+0x0,
+0x0,
+0x0,
+0x71,
+0x0,
+0x0,
+0x0,
+0x72,
+0x0,
+0x0,
+0x0,
+0x73,
+0x0,
+0x0,
+0x0,
+0x74,
+0x0,
+0x0,
+0x0,
+0x75,
+0x0,
+0x0,
+0x0,
+0x76,
+0x0,
+0x0,
+0x0,
+0x77,
+0x0,
+0x0,
+0x0,
+0x78,
+0x0,
+0x0,
+0x0,
+0x79,
+0x0,
+0x0,
+0x0,
+0x7a,
+0x0,
+0x0,
+0x0,
+0x7b,
+0x0,
+0x0,
+0x0,
+0x7c,
+0x0,
+0x0,
+0x0,
+0x7d,
+0x0,
+0x0,
+0x0,
+0x7e,
+0x0,
+0x0,
+0x0,
+0x7f,
+0x0,
+0x0,
+0x0,
+0x80,
+0x0,
+0x0,
+0x0,
+0x81,
+0x0,
+0x0,
+0x0,
+0x82,
+0x0,
+0x0,
+0x0,
+0x83,
+0x0,
+0x0,
+0x0,
+0x84,
+0x0,
+0x0,
+0x0,
+0x85,
+0x0,
+0x0,
+0x0,
+0x86,
+0x0,
+0x0,
+0x0,
+0x87,
+0x0,
+0x0,
+0x0,
+0x87,
+0x0,
+0x0,
+0x0,
+0x88,
+0x0,
+0x0,
+0x0,
+0x89,
+0x0,
+0x0,
+0x0,
+0x8a,
+0x0,
+0x0,
+0x0,
+0x8b,
+0x0,
+0x0,
+0x0,
+0x8c,
+0x0,
+0x0,
+0x0,
+0x8d,
+0x0,
+0x0,
+0x0,
+0x8e,
+0x0,
+0x0,
+0x0,
+0x8f,
+0x0,
+0x0,
+0x0,
+0x90,
+0x0,
+0x0,
+0x0,
+0x90,
+0x0,
+0x0,
+0x0,
+0x91,
+0x0,
+0x0,
+0x0,
+0x92,
+0x0,
+0x0,
+0x0,
+0x93,
+0x0,
+0x0,
+0x0,
+0x94,
+0x0,
+0x0,
+0x0,
+0x95,
+0x0,
+0x0,
+0x0,
+0x96,
+0x0,
+0x0,
+0x0,
+0x96,
+0x0,
+0x0,
+0x0,
+0x97,
+0x0,
+0x0,
+0x0,
+0xeb,
+0xa5,
+0x40,
+0x0,
+0x41,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0xb8,
+0xfc,
+0x7b,
+0x0,
+0xd4,
+0xfc,
+0x7b,
+0x0,
+0xc,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x94,
+0xa4,
+0x40,
+0x0,
+0x12,
+0x9f,
+0x40,
+0x0,
+0x12,
+0x9f,
+0x40,
+0x0,
+0xa,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0xbc,
+0xfc,
+0x7b,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0x68,
+0x82,
+0xe2,
+0x0,
+0xa6,
+0x0,
+0x0,
+0x0,
+0xa7,
+0x0,
+0x0,
+0x0,
+0xa8,
+0x0,
+0x0,
+0x0,
+0xa8,
+0x0,
+0x0,
+0x0,
+0xa9,
+0x0,
+0x0,
+0x0,
+0xaa,
+0x0,
+0x0,
+0x0,
+0xab,
+0x0,
+0x0,
+0x0,
+0xac,
+0x0,
+0x0,
+0x0,
+0xac,
+0x0,
+0x0,
+0x0,
+0xad,
+0x0,
+0x0,
+0x0,
+0xae,
+0x0,
+0x0,
+0x0,
+0xaf,
+0x0,
+0x0,
+0x0,
+0xaf,
+0x0,
+0x0,
+0x0,
+0xb0,
+0x0,
+0x0,
+0x0,
+0xb1,
+0x0,
+0x0,
+0x0,
+0xb2,
+0x0,
+0x0,
+0x0,
+0xb2,
+0x0,
+0x0,
+0x0,
+0xb3,
+0x0,
+0x0,
+0x0,
+0xb4,
+0x0,
+0x0,
+0x0,
+0xb5,
+0x0,
+0x0,
+0x0,
+0xb5,
+0x0,
+0x0,
+0x0,
+0xb6,
+0x0,
+0x0,
+0x0,
+0xb7,
+0x0,
+0x0,
+0x0,
+0xb8,
+0x0,
+0x0,
+0x0,
+0xb8,
+0x0,
+0x0,
+0x0,
+0xb9,
+0x0,
+0x0,
+0x0,
+0xba,
+0x0,
+0x0,
+0x0,
+0xbb,
+0x0,
+0x0,
+0x0,
+0xbb,
+0x0,
+0x0,
+0x0,
+0xbc,
+0x0,
+0x0,
+0x0,
+0xbd,
+0x0,
+0x0,
+0x0,
+0xbe,
+0x0,
+0x0,
+0x0,
+0xbe,
+0x0,
+0x0,
+0x0,
+0xbf,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x0,
+0x0,
+0x0,
+0xc1,
+0x0,
+0x0,
+0x0,
+0xc2,
+0x0,
+0x0,
+0x0,
+0xc3,
+0x0,
+0x0,
+0x0,
+0xc3,
+0x0,
+0x0,
+0x0,
+0xc4,
+0x0,
+0x0,
+0x0,
+0xc5,
+0x0,
+0x0,
+0x0,
+0xc5,
+0x0,
+0x0,
+0x0,
+0xc6,
+0x0,
+0x0,
+0x0,
+0xc7,
+0x0,
+0x0,
+0x0,
+0xc7,
+0x0,
+0x0,
+0x0,
+0xc8,
+0x0,
+0x0,
+0x0,
+0xc9,
+0x0,
+0x0,
+0x0,
+0xca,
+0x0,
+0x0,
+0x0,
+0xca,
+0x0,
+0x0,
+0x0,
+0xcb,
+0x0,
+0x0,
+0x0,
+0xcc,
+0x0,
+0x0,
+0x0,
+0xcc,
+0x0,
+0x0,
+0x0,
+0xcd,
+0x0,
+0x0,
+0x0,
+0xce,
+0x0,
+0x0,
+0x0,
+0xce,
+0x0,
+0x0,
+0x0,
+0xcf,
+0x0,
+0x0,
+0x0,
+0xd0,
+0x0,
+0x0,
+0x0,
+0xd0,
+0x0,
+0x0,
+0x0,
+0xd1,
+0x0,
+0x0,
+0x0,
+0xd2,
+0x0,
+0x0,
+0x0,
+0xd2,
+0x0,
+0x0,
+0x0,
+0xd3,
+0x0,
+0x0,
+0x0,
+0xd4,
+0x0,
+0x0,
+0x0,
+0xd4,
+0x0,
+0x0,
+0x0,
+0xd5,
+0x0,
+0x0,
+0x0,
+0xd6,
+0x0,
+0x0,
+0x0,
+0xd6,
+0x0,
+0x0,
+0x0,
+0xd7,
+0x0,
+0x0,
+0x0,
+0xd8,
+0x0,
+0x0,
+0x0,
+0xd8,
+0x0,
+0x0,
+0x0,
+0xd9,
+0x0,
+0x0,
+0x0,
+0xda,
+0x0,
+0x0,
+0x0,
+0xda,
+0x0,
+0x0,
+0x0,
+0xdb,
+0x0,
+0x0,
+0x0,
+0xdc,
+0x0,
+0x0,
+0x0,
+0xdc,
+0x0,
+0x0,
+0x0,
+0xdd,
+0x0,
+0x0,
+0x0,
+0xde,
+0x0,
+0x0,
+0x0,
+0xde,
+0x0,
+0x0,
+0x0,
+0xdf,
+0x0,
+0x0,
+0x0,
+0xe0,
+0x0,
+0x0,
+0x0,
+0xe0,
+0x0,
+0x0,
+0x0,
+0xe1,
+0x0,
+0x0,
+0x0,
+0xe2,
+0x0,
+0x0,
+0x0,
+0xe2,
+0x0,
+0x0,
+0x0,
+0xe3,
+0x0,
+0x0,
+0x0,
+0xe3,
+0x0,
+0x0,
+0x0,
+0xe4,
+0x0,
+0x0,
+0x0,
+0xe5,
+0x0,
+0x0,
+0x0,
+0xe5,
+0x0,
+0x0,
+0x0,
+0xe6,
+0x0,
+0x0,
+0x0,
+0xe7,
+0x0,
+0x0,
+0x0,
+0xe7,
+0x0,
+0x0,
+0x0,
+0xe8,
+0x0,
+0x0,
+0x0,
+0xe9,
+0x0,
+0x0,
+0x0,
+0xe9,
+0x0,
+0x0,
+0x0,
+0xea,
+0x0,
+0x0,
+0x0,
+0xea,
+0x0,
+0x0,
+0x0,
+0xeb,
+0x0,
+0x0,
+0x0,
+0xec,
+0x0,
+0x0,
+0x0,
+0xec,
+0x0,
+0x0,
+0x0,
+0xed,
+0x0,
+0x0,
+0x0,
+0xee,
+0x0,
+0x0,
+0x0,
+0xee,
+0x0,
+0x0,
+0x0,
+0xef,
+0x0,
+0x0,
+0x0,
+0xef,
+0x0,
+0x0,
+0x0,
+0xf0,
+0x0,
+0x0,
+0x0,
+0xf1,
+0x0,
+0x0,
+0x0,
+0xf1,
+0x0,
+0x0,
+0x0,
+0xf2,
+0x0,
+0x0,
+0x0,
+0xf2,
+0x0,
+0x0,
+0x0,
+0xf3,
+0x0,
+0x0,
+0x0,
+0xf4,
+0x0,
+0x0,
+0x0,
+0xf4,
+0x0,
+0x0,
+0x0,
+0xf5,
+0x0,
+0x0,
+0x0,
+0xf5,
+0x0,
+0x0,
+0x0,
+0xf6,
+0x0,
+0x0,
+0x0,
+0xf7,
+0x0,
+0x0,
+0x0,
+0xf7,
+0x0,
+0x0,
+0x0,
+0xf8,
+0x0,
+0x0,
+0x0,
+0xf8,
+0x0,
+0x0,
+0x0,
+0xf9,
+0x0,
+0x0,
+0x0,
+0xfa,
+0x0,
+0x0,
+0x0,
+0xfa,
+0x0,
+0x0,
+0x0,
+0xfb,
+0x0,
+0x0,
+0x0,
+0xfb,
+0x0,
+0x0,
+0x0,
+0xfc,
+0x0,
+0x0,
+0x0,
+0xfd,
+0x0,
+0x0,
+0x0,
+0xfd,
+0x0,
+0x0,
+0x0,
+0xfe,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x1b,
+0x0,
+0x0,
+0x0,
+0x1b,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0,
+0x41,
+0x0,
+0x41,
+0x95,
+0x40,
+0x0,
+0x2,
+0x0,
+0x0,
+0x0,
+0x40,
+0x69,
+0xa0,
+0x0,
+0x1a,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0x1a,
+0x0,
+0x0,
+0x0,
+0xd8,
+0x9c,
+0x40,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0xfd,
+0x90,
+0x40,
+0x0,
+0x1,
+0x0,
+0x0,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0x3c,
+0x83,
+0xe2,
+0x0,
+0x48,
+0x8,
+0x0,
+0x0,
+0x68,
+0x82,
+0xe2,
+0x0,
+0xf,
+0x21,
+0x40,
+0x0,
+0xc0,
+0x4f,
+0x55,
+0x0,
+0xec,
+0x41,
+0x55,
+0x0,
+0x38,
+0xfe,
+0x7b,
+0x0,
+0x74,
+0xe4,
+0x61,
+0x81,
+0x94,
+0xdf,
+0x61,
+0x81,
+0x0,
+0x0,
+0x6b,
+0x0,
+0x40,
+0xc4,
+0xa0,
+0x0,
+0xb0,
+0xa,
+0x0,
+0x0
+};
+
+unsigned char IMAGE_NAME[] = {
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfd,
+0xfb,
+0xfa,
+0xfa,
+0xfb,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfd,
+0xfd,
+0xfd,
+0xfd,
+0xfd,
+0xfd,
+0xfd,
+0xfd,
+0xfd,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xf4,
+0xe4,
+0xd7,
+0xd0,
+0xcf,
+0xd6,
+0xe2,
+0xf2,
+0xfc,
+0xff,
+0xff,
+0xfb,
+0xe8,
+0xdf,
+0xdf,
+0xdf,
+0xdf,
+0xde,
+0xdf,
+0xe0,
+0xe2,
+0xe7,
+0xee,
+0xf5,
+0xfa,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf1,
+0xc0,
+0x94,
+0x80,
+0x79,
+0x78,
+0x7f,
+0x91,
+0xb1,
+0xda,
+0xf8,
+0xfd,
+0xe7,
+0xab,
+0x8c,
+0x89,
+0x89,
+0x89,
+0x89,
+0x89,
+0x8b,
+0x8e,
+0x96,
+0xa1,
+0xb4,
+0xcf,
+0xe8,
+0xf9,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfd,
+0xe3,
+0x93,
+0x60,
+0x58,
+0x58,
+0x57,
+0x55,
+0x59,
+0x6b,
+0x96,
+0xd4,
+0xf7,
+0xdc,
+0x88,
+0x5d,
+0x59,
+0x59,
+0x5a,
+0x5a,
+0x5b,
+0x5b,
+0x5b,
+0x5d,
+0x60,
+0x6a,
+0x7e,
+0xa0,
+0xcc,
+0xf0,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfd,
+0xe2,
+0x96,
+0x72,
+0x7a,
+0x7e,
+0x74,
+0x60,
+0x53,
+0x53,
+0x66,
+0xa3,
+0xe8,
+0xdb,
+0x84,
+0x57,
+0x52,
+0x54,
+0x5d,
+0x67,
+0x69,
+0x68,
+0x65,
+0x5f,
+0x59,
+0x56,
+0x58,
+0x64,
+0x86,
+0xbc,
+0xed,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xfa,
+0xf7,
+0xf4,
+0xf3,
+0xf6,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xef,
+0xc8,
+0xc1,
+0xd1,
+0xd6,
+0xc4,
+0x95,
+0x62,
+0x52,
+0x57,
+0x84,
+0xd7,
+0xd9,
+0x84,
+0x57,
+0x52,
+0x5b,
+0x82,
+0xac,
+0xb6,
+0xb4,
+0xac,
+0x9c,
+0x83,
+0x68,
+0x58,
+0x55,
+0x5d,
+0x7f,
+0xc0,
+0xf3,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf9,
+0xe5,
+0xcc,
+0xba,
+0xb0,
+0xaf,
+0xc4,
+0xeb,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xf7,
+0xf8,
+0xfb,
+0xfc,
+0xf5,
+0xc9,
+0x79,
+0x55,
+0x54,
+0x7c,
+0xd0,
+0xd8,
+0x85,
+0x58,
+0x52,
+0x61,
+0xa1,
+0xe7,
+0xf6,
+0xf6,
+0xf3,
+0xe9,
+0xd1,
+0xa5,
+0x72,
+0x58,
+0x54,
+0x5f,
+0x8d,
+0xd6,
+0xfb,
+0xff,
+0xff,
+0xf8,
+0xd2,
+0x9f,
+0x7e,
+0x77,
+0x7b,
+0x81,
+0xa8,
+0xe5,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf9,
+0xd0,
+0x7d,
+0x55,
+0x57,
+0x88,
+0xda,
+0xd9,
+0x85,
+0x58,
+0x53,
+0x61,
+0xa7,
+0xf2,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xf9,
+0xe2,
+0xa7,
+0x6a,
+0x55,
+0x56,
+0x6c,
+0xb2,
+0xf2,
+0xff,
+0xfd,
+0xe2,
+0x9a,
+0x69,
+0x6c,
+0x95,
+0xb3,
+0xbd,
+0xd0,
+0xed,
+0xf5,
+0xf8,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfa,
+0xf7,
+0xf6,
+0xf9,
+0xfe,
+0xfe,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf6,
+0xda,
+0xa6,
+0x69,
+0x55,
+0x69,
+0xaa,
+0xeb,
+0xdc,
+0x85,
+0x58,
+0x52,
+0x61,
+0xa7,
+0xf1,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfa,
+0xd4,
+0x87,
+0x5b,
+0x55,
+0x5d,
+0x93,
+0xe3,
+0xfd,
+0xfa,
+0xcc,
+0x7a,
+0x5e,
+0x85,
+0xd1,
+0xf3,
+0xf0,
+0xd8,
+0xbf,
+0xb7,
+0xc4,
+0xe5,
+0xfc,
+0xff,
+0xff,
+0xf4,
+0xd2,
+0xbb,
+0xbc,
+0xd6,
+0xf1,
+0xf2,
+0xf0,
+0xf8,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfa,
+0xd1,
+0x94,
+0x6b,
+0x57,
+0x64,
+0x97,
+0xd9,
+0xf8,
+0xdc,
+0x84,
+0x57,
+0x52,
+0x61,
+0xa7,
+0xf1,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xec,
+0xa1,
+0x62,
+0x54,
+0x58,
+0x80,
+0xd4,
+0xf8,
+0xef,
+0xbb,
+0x70,
+0x5f,
+0x8e,
+0xda,
+0xf4,
+0xf2,
+0xd5,
+0x9d,
+0x77,
+0x7a,
+0xaa,
+0xe4,
+0xfc,
+0xf4,
+0xc8,
+0x8c,
+0x76,
+0x93,
+0xcc,
+0xf2,
+0xf2,
+0xed,
+0xf6,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf6,
+0xb8,
+0x6b,
+0x53,
+0x56,
+0x75,
+0xb9,
+0xf1,
+0xfc,
+0xdb,
+0x84,
+0x57,
+0x52,
+0x61,
+0xa7,
+0xf1,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf5,
+0xb0,
+0x67,
+0x55,
+0x57,
+0x77,
+0xc7,
+0xde,
+0xba,
+0x90,
+0x65,
+0x5b,
+0x77,
+0xa3,
+0xb5,
+0xcb,
+0xe5,
+0xc8,
+0x8e,
+0x68,
+0x75,
+0xaf,
+0xdd,
+0xcc,
+0x8e,
+0x6c,
+0x85,
+0xbe,
+0xed,
+0xfe,
+0xfd,
+0xfc,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf7,
+0xba,
+0x6e,
+0x54,
+0x53,
+0x64,
+0x93,
+0xd0,
+0xf5,
+0xdc,
+0x84,
+0x57,
+0x52,
+0x61,
+0xa7,
+0xf1,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf6,
+0xb4,
+0x69,
+0x56,
+0x56,
+0x74,
+0xc0,
+0xc7,
+0x8f,
+0x6e,
+0x5b,
+0x58,
+0x64,
+0x76,
+0x80,
+0xa6,
+0xe7,
+0xf2,
+0xcc,
+0x90,
+0x6a,
+0x77,
+0x98,
+0x8a,
+0x70,
+0x88,
+0xc2,
+0xef,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfb,
+0xd8,
+0xa0,
+0x76,
+0x59,
+0x53,
+0x63,
+0x96,
+0xdc,
+0xd9,
+0x84,
+0x57,
+0x52,
+0x61,
+0xa7,
+0xf1,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf2,
+0xab,
+0x65,
+0x55,
+0x57,
+0x79,
+0xca,
+0xdf,
+0xbd,
+0x91,
+0x65,
+0x5b,
+0x78,
+0xa6,
+0xb8,
+0xce,
+0xf3,
+0xff,
+0xf5,
+0xcd,
+0x8d,
+0x65,
+0x64,
+0x66,
+0x83,
+0xc4,
+0xf2,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfa,
+0xe5,
+0xb9,
+0x77,
+0x55,
+0x53,
+0x70,
+0xbb,
+0xd2,
+0x85,
+0x57,
+0x52,
+0x61,
+0xa7,
+0xf1,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xe3,
+0x95,
+0x5e,
+0x54,
+0x59,
+0x85,
+0xd8,
+0xf9,
+0xf0,
+0xba,
+0x6f,
+0x5f,
+0x90,
+0xdd,
+0xf4,
+0xf9,
+0xff,
+0xff,
+0xfe,
+0xe7,
+0xa4,
+0x6a,
+0x5c,
+0x63,
+0x91,
+0xd9,
+0xfb,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfd,
+0xe5,
+0x96,
+0x5c,
+0x51,
+0x62,
+0xa5,
+0xca,
+0x84,
+0x57,
+0x52,
+0x61,
+0xa7,
+0xf1,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf3,
+0xc0,
+0x77,
+0x58,
+0x54,
+0x61,
+0x9c,
+0xe8,
+0xfe,
+0xf8,
+0xc2,
+0x71,
+0x60,
+0x95,
+0xe7,
+0xfe,
+0xff,
+0xff,
+0xfe,
+0xed,
+0xbf,
+0x84,
+0x6a,
+0x70,
+0x68,
+0x74,
+0xab,
+0xe1,
+0xfa,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfb,
+0xf8,
+0xfd,
+0xff,
+0xff,
+0xfe,
+0xe8,
+0x99,
+0x5d,
+0x52,
+0x60,
+0xa1,
+0xc9,
+0x84,
+0x57,
+0x52,
+0x61,
+0xa6,
+0xef,
+0xfd,
+0xfd,
+0xfc,
+0xf9,
+0xee,
+0xc9,
+0x8b,
+0x5f,
+0x54,
+0x57,
+0x74,
+0xbd,
+0xf5,
+0xff,
+0xf8,
+0xc2,
+0x71,
+0x60,
+0x95,
+0xe7,
+0xfe,
+0xff,
+0xfc,
+0xe8,
+0xb8,
+0x81,
+0x6f,
+0x91,
+0xb2,
+0x96,
+0x6e,
+0x73,
+0xa4,
+0xdb,
+0xf9,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfb,
+0xe0,
+0xca,
+0xdd,
+0xef,
+0xf5,
+0xeb,
+0xc3,
+0x7d,
+0x56,
+0x52,
+0x66,
+0xad,
+0xcd,
+0x85,
+0x57,
+0x52,
+0x5f,
+0x97,
+0xd3,
+0xe1,
+0xdf,
+0xd9,
+0xca,
+0xad,
+0x83,
+0x61,
+0x55,
+0x55,
+0x66,
+0x9d,
+0xe1,
+0xfd,
+0xff,
+0xf8,
+0xc2,
+0x71,
+0x60,
+0x95,
+0xe7,
+0xfe,
+0xfd,
+0xe6,
+0xb3,
+0x7d,
+0x6d,
+0x93,
+0xd0,
+0xef,
+0xd6,
+0x98,
+0x6c,
+0x71,
+0xa0,
+0xd9,
+0xf9,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf8,
+0xc2,
+0x85,
+0x8c,
+0xa4,
+0xad,
+0xa0,
+0x7e,
+0x5c,
+0x51,
+0x56,
+0x7d,
+0xc9,
+0xd5,
+0x84,
+0x57,
+0x52,
+0x58,
+0x6e,
+0x87,
+0x8c,
+0x8a,
+0x83,
+0x77,
+0x68,
+0x5a,
+0x54,
+0x58,
+0x68,
+0x94,
+0xd3,
+0xf9,
+0xff,
+0xff,
+0xf8,
+0xc2,
+0x71,
+0x60,
+0x95,
+0xe7,
+0xfd,
+0xf5,
+0xcd,
+0x9b,
+0x86,
+0x9d,
+0xd1,
+0xf6,
+0xff,
+0xf8,
+0xd4,
+0x9e,
+0x84,
+0x91,
+0xbd,
+0xed,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf7,
+0xbe,
+0x6f,
+0x5a,
+0x5f,
+0x63,
+0x5f,
+0x56,
+0x53,
+0x58,
+0x71,
+0xac,
+0xe9,
+0xdb,
+0x84,
+0x57,
+0x53,
+0x54,
+0x57,
+0x5b,
+0x5b,
+0x5b,
+0x5a,
+0x58,
+0x57,
+0x5a,
+0x63,
+0x79,
+0xa3,
+0xd5,
+0xf7,
+0xff,
+0xff,
+0xff,
+0xf8,
+0xc2,
+0x71,
+0x60,
+0x95,
+0xe7,
+0xfd,
+0xfa,
+0xe6,
+0xd6,
+0xd5,
+0xe4,
+0xf8,
+0xff,
+0xff,
+0xff,
+0xf9,
+0xe4,
+0xd5,
+0xd4,
+0xe0,
+0xf6,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfa,
+0xd2,
+0x8f,
+0x6d,
+0x61,
+0x5e,
+0x5d,
+0x61,
+0x6c,
+0x85,
+0xb2,
+0xe3,
+0xf9,
+0xdf,
+0x92,
+0x6a,
+0x66,
+0x67,
+0x67,
+0x67,
+0x67,
+0x69,
+0x6c,
+0x70,
+0x78,
+0x89,
+0xa4,
+0xc5,
+0xe6,
+0xfa,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf8,
+0xc1,
+0x71,
+0x60,
+0x95,
+0xe7,
+0xfe,
+0xff,
+0xfc,
+0xfb,
+0xfb,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfd,
+0xfb,
+0xfb,
+0xfc,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf4,
+0xd8,
+0xbe,
+0xaa,
+0xa0,
+0xa0,
+0xa9,
+0xbb,
+0xd5,
+0xef,
+0xfd,
+0xfe,
+0xf0,
+0xc8,
+0xb4,
+0xb2,
+0xb2,
+0xb3,
+0xb3,
+0xb3,
+0xb6,
+0xbb,
+0xc3,
+0xcd,
+0xdc,
+0xec,
+0xf8,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf9,
+0xc9,
+0x83,
+0x73,
+0xa2,
+0xea,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfc,
+0xf7,
+0xf2,
+0xee,
+0xee,
+0xf1,
+0xf7,
+0xfb,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xf8,
+0xf5,
+0xf5,
+0xf5,
+0xf5,
+0xf5,
+0xf5,
+0xf6,
+0xf7,
+0xf8,
+0xfa,
+0xfc,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfd,
+0xe7,
+0xc5,
+0xbd,
+0xd4,
+0xf6,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfa,
+0xf6,
+0xf6,
+0xf9,
+0xfd,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xfe,
+0xff,
+0xff,
+0xfe,
+0xfd,
+0xfc,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xf4,
+0xf1,
+0xf2,
+0xf3,
+0xee,
+0xf0,
+0xf4,
+0xf6,
+0xf5,
+0xf4,
+0xf3,
+0xf7,
+0xf6,
+0xf1,
+0xea,
+0xea,
+0xf0,
+0xf6,
+0xf7,
+0xf5,
+0xfa,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfc,
+0xe7,
+0xd4,
+0xce,
+0xd0,
+0xcb,
+0xcd,
+0xcd,
+0xd3,
+0xd4,
+0xd9,
+0xd3,
+0xd7,
+0xd8,
+0xd6,
+0xcc,
+0xd0,
+0xd4,
+0xd5,
+0xd3,
+0xd0,
+0xe7,
+0xfc,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfb,
+0xde,
+0xc5,
+0xc0,
+0xc4,
+0xc2,
+0xc1,
+0xbc,
+0xc5,
+0xcb,
+0xd5,
+0xc3,
+0xbf,
+0xcb,
+0xd7,
+0xcb,
+0xca,
+0xc7,
+0xbf,
+0xbf,
+0xbe,
+0xe0,
+0xfb,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfb,
+0xe3,
+0xcf,
+0xce,
+0xd0,
+0xcc,
+0xc9,
+0xc9,
+0xd5,
+0xda,
+0xd9,
+0xc2,
+0xc2,
+0xcd,
+0xd8,
+0xd0,
+0xd2,
+0xd7,
+0xd2,
+0xd3,
+0xcf,
+0xe9,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf6,
+0xee,
+0xee,
+0xef,
+0xeb,
+0xe8,
+0xe8,
+0xef,
+0xf2,
+0xef,
+0xe3,
+0xe6,
+0xe9,
+0xeb,
+0xe8,
+0xec,
+0xf4,
+0xf4,
+0xf3,
+0xeb,
+0xf6,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xfe,
+0xfe,
+0xfd,
+0xfd,
+0xfd,
+0xfe,
+0xfe,
+0xfe,
+0xfc,
+0xfd,
+0xfd,
+0xfd,
+0xfd,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xfd,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfd,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xfe,
+0xfe,
+0xfe,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfb,
+0xcb,
+0xa8,
+0xa7,
+0xc6,
+0xf3,
+0xf8,
+0xc0,
+0xb4,
+0xb4,
+0xb5,
+0xbb,
+0xce,
+0xec,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf0,
+0x7f,
+0x6a,
+0x60,
+0x5b,
+0x9d,
+0xe6,
+0x70,
+0x56,
+0x5e,
+0x62,
+0x5f,
+0x5e,
+0x77,
+0xc0,
+0xfa,
+0xff,
+0xff,
+0xff,
+0xfc,
+0xf9,
+0xfc,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfb,
+0xde,
+0xe8,
+0xc6,
+0x61,
+0x6b,
+0xd6,
+0x6e,
+0x58,
+0xae,
+0xd6,
+0xc9,
+0x98,
+0x5e,
+0x64,
+0xc6,
+0xfe,
+0xfd,
+0xd4,
+0x9f,
+0x97,
+0xcf,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfd,
+0xd2,
+0x64,
+0x7d,
+0xdf,
+0x6f,
+0x5a,
+0xcc,
+0xff,
+0xff,
+0xf5,
+0x9b,
+0x57,
+0x84,
+0xf4,
+0xe9,
+0x77,
+0x96,
+0xd5,
+0xd5,
+0xda,
+0xf7,
+0xff,
+0xf0,
+0xd9,
+0xf0,
+0xf7,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xff,
+0xde,
+0x6f,
+0x62,
+0xc7,
+0xeb,
+0x6e,
+0x5a,
+0xcc,
+0xff,
+0xff,
+0xff,
+0xcd,
+0x5d,
+0x6a,
+0xdc,
+0xbd,
+0x64,
+0xa1,
+0xda,
+0xc8,
+0x7a,
+0xad,
+0xe6,
+0x94,
+0x93,
+0xea,
+0xf6,
+0xfc,
+0xff,
+0xff,
+0xff,
+0xff,
+0xe1,
+0x76,
+0x59,
+0x97,
+0xe2,
+0x6e,
+0x5a,
+0xcc,
+0xff,
+0xff,
+0xff,
+0xd2,
+0x5e,
+0x67,
+0xcc,
+0x93,
+0x5d,
+0x7e,
+0xab,
+0xf3,
+0xc8,
+0x75,
+0x7b,
+0x90,
+0xe9,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xe0,
+0x70,
+0x5e,
+0xbf,
+0x6e,
+0x5a,
+0xcc,
+0xff,
+0xff,
+0xfc,
+0xac,
+0x58,
+0x77,
+0xee,
+0xd9,
+0x68,
+0xba,
+0xfb,
+0xff,
+0xe4,
+0x7f,
+0x66,
+0xa2,
+0xf5,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf5,
+0xe7,
+0xf9,
+0xe5,
+0x72,
+0x5b,
+0xb9,
+0x6e,
+0x59,
+0xc0,
+0xef,
+0xe6,
+0xba,
+0x68,
+0x5a,
+0xac,
+0xfc,
+0xdd,
+0x69,
+0xbe,
+0xfe,
+0xdf,
+0x89,
+0x99,
+0xc3,
+0x79,
+0xa4,
+0xf3,
+0xff,
+0xff,
+0xff,
+0xff,
+0xdc,
+0x77,
+0x85,
+0x75,
+0x56,
+0x7c,
+0xd9,
+0x6e,
+0x54,
+0x6a,
+0x73,
+0x6b,
+0x5d,
+0x62,
+0x9d,
+0xf1,
+0xff,
+0xdd,
+0x69,
+0xbe,
+0xfa,
+0xc9,
+0xb7,
+0xf0,
+0xfd,
+0xd4,
+0xb0,
+0xe0,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf0,
+0xa5,
+0x82,
+0x82,
+0xa0,
+0xe0,
+0xf2,
+0x9e,
+0x8c,
+0x8d,
+0x8e,
+0x97,
+0xab,
+0xd3,
+0xf7,
+0xff,
+0xff,
+0xdf,
+0x72,
+0xc2,
+0xff,
+0xfd,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xfd,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfc,
+0xf8,
+0xf7,
+0xfc,
+0xff,
+0xff,
+0xfb,
+0xfa,
+0xfa,
+0xfa,
+0xfb,
+0xfd,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf7,
+0xdc,
+0xf0,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf5,
+0xe1,
+0xdf,
+0xe0,
+0xe5,
+0xe5,
+0xe7,
+0xdf,
+0xe0,
+0xe5,
+0xea,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xee,
+0xc9,
+0xc9,
+0xc4,
+0xd0,
+0xcd,
+0xc6,
+0xd3,
+0xcf,
+0xc9,
+0xd6,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfd,
+0xf6,
+0xf5,
+0xf3,
+0xf7,
+0xf3,
+0xf2,
+0xf3,
+0xf7,
+0xf9,
+0xf7,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfe,
+0xdc,
+0xda,
+0xfa,
+0xdc,
+0xd9,
+0xe2,
+0xfa,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfa,
+0xac,
+0x79,
+0xb1,
+0x63,
+0x91,
+0x88,
+0x7e,
+0xef,
+0xf4,
+0xcb,
+0xf2,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf6,
+0x82,
+0xc4,
+0x64,
+0xe6,
+0xfd,
+0x87,
+0xb0,
+0xa0,
+0xba,
+0xbc,
+0xe2,
+0xbc,
+0xf2,
+0xfe,
+0xff,
+0xf7,
+0x88,
+0xa6,
+0x64,
+0xe6,
+0xfe,
+0x8d,
+0xa6,
+0x8c,
+0xb8,
+0xe8,
+0x75,
+0xc4,
+0xff,
+0xff,
+0xf4,
+0xb7,
+0x89,
+0x9a,
+0x62,
+0xa3,
+0x9a,
+0x70,
+0xe6,
+0xa3,
+0xdd,
+0xba,
+0xd2,
+0xa8,
+0xf4,
+0xff,
+0xfb,
+0xc7,
+0xc5,
+0xf4,
+0xc8,
+0xc4,
+0xcf,
+0xf2,
+0xff,
+0xc9,
+0xec,
+0xfe,
+0xff,
+0xfe,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xe3,
+0xd3,
+0xda,
+0xd8,
+0xd7,
+0xef,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xff,
+0xfc,
+0xfa,
+0xfa,
+0xf9,
+0xfc,
+0xfd,
+0xff,
+0xe0,
+0xc0,
+0xaa,
+0xb9,
+0xf8,
+0xef,
+0xff,
+0xff,
+0xfb,
+0x9d,
+0xa5,
+0xc4,
+0xa1,
+0xc6,
+0xb6,
+0xfc,
+0xdb,
+0xb7,
+0xa4,
+0xb3,
+0xd4,
+0xe0,
+0xde,
+0xfc,
+0xff,
+0xff,
+0xff,
+0xff,
+0xf7,
+0xe8,
+0xe9,
+0xfb,
+0xce,
+0xb3,
+0xd4,
+0xec,
+0xe4,
+0xd5,
+0xe5,
+0xf0,
+0xcf,
+0xe5,
+0xda,
+0x0,
+0x0,
+0x0,
+0x0,
+0x0
+};
+
+#undef RAW_NAME 
+#undef IMAGE_NAME 
Index: trunk/src/opengl/glide/sst1/glide/sst96.c
===================================================================
--- trunk/src/opengl/glide/sst1/glide/sst96.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide/sst96.c	(revision 2885)
@@ -0,0 +1,746 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/glide/sst96.c,v 1.1 2000-02-25 00:31:23 sandervl Exp $
+** $Log: sst96.c,v $
+** Revision 1.1  2000-02-25 00:31:23  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 20    9/19/97 12:38p Peter
+ * asm rush trisetup vs alt fifo
+ * 
+ * 19    9/12/97 12:56p Dow
+ * Protected JUJU code
+ * 
+ * 18    9/11/97 2:22p Atai
+ * fixed muckage
+ * 
+ * 17    9/10/97 10:15p Peter
+ * fifo logic from GaryT
+ * 
+ * 16    8/19/97 8:55p Peter
+ * lots of stuff, hopefully no muckage
+ * 
+ * 15    8/01/97 11:49a Dow
+ * Allowed for non4K fifo wraps
+ * 
+ * 14    7/08/97 1:29p Jdt
+ * Fixed watcom muckage
+ * 
+ * 13    7/04/97 12:08p Dow
+ * Modified GWP debugging
+ * 
+ * 12    6/20/97 5:54p Dow
+ * Moved grDebugGroupWriteHeader in here.
+ * 
+ * 11    6/18/97 5:54p Dow
+ * P6 adjustments
+ * 
+ * 10    5/27/97 2:03p Dow
+ * added new assertion
+ * 
+ * 9     5/04/97 12:49p Dow
+ * Moved texture downloads to level 195, like on SST1
+ * 
+ * 8     4/13/97 2:06p Pgj
+ * eliminate all anonymous unions (use hwDep)
+ * 
+ * 7     3/16/97 12:39a Jdt
+ * initWrapFifo only neads fifodata...
+ * 
+ * 6     3/04/97 9:12p Dow
+ * Neutered mutiplatform multiheaded monster.
+ * 
+ * 5     2/18/97 9:53a Jdt
+ * Removed some unecessary declarations.
+ * 
+ * 4     2/14/97 12:55p Dow
+ * moved vg96 fifo wrap into init code
+ * 
+ * 3     2/11/97 6:59p Dow
+ * Changes to support vid tiles and ser status
+ * 
+ * 2     1/14/97 10:49a Dow
+ * Changed all output to use GDBG_INFO
+ * Renabled some messages
+ * 
+ * 1     12/23/96 1:39p Dow
+ * Changes for multiplatform
+**
+*/
+/* gsst96.c - transport stuff for SST 96 */
+
+#include <stdio.h>
+#include <string.h>
+#include <3dfx.h>
+
+#include <glidesys.h>
+#include <sst1vid.h>
+
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <glide.h>
+#include "fxglide.h"
+
+#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
+
+#define GEN_INDEX(a) ((((FxU32) a) - ((FxU32) gc->reg_ptr)) >> 2)
+
+char
+*regNames[] = {
+  "status",             /* 0x00 */
+  "reserved001",        /* 0x01 */
+  "vAx",                /* 0x02 */
+  "vAy",                /* 0x03 */
+  "vBx",                /* 0x04 */
+  "vBy",                /* 0x05 */
+  "vCx",                /* 0x06 */
+  "vCy",                /* 0x07 */
+  "r",                  /* 0x08 */
+  "drdx",               /* 0x09 */
+  "drdy",               /* 0x0a */
+  "g",                  /* 0x0b */
+  "dgdx",               /* 0x0c */
+  "dgdy",               /* 0x0d */
+  "b",                  /* 0x0e */
+  "dbdx",               /* 0x0f */
+  "dbdy",               /* 0x10 */
+  "z",                  /* 0x11 */
+  "dzdx",               /* 0x12 */
+  "dzdy",               /* 0x13 */
+  "a",                  /* 0x14 */
+  "dadx",               /* 0x15 */
+  "dady",               /* 0x16 */
+  "s",                  /* 0x17 */
+  "dsdx",               /* 0x18 */
+  "dsdy",               /* 0x19 */
+  "t",                  /* 0x1a */
+  "dtdx",               /* 0x1b */
+  "dtdy",               /* 0x1c */
+  "w",                  /* 0x1d */
+  "dwdx",               /* 0x1e */
+  "dwdy",               /* 0x1f */
+  "triangleCMD",        /* 0x20 */
+  "reserved021",        /* 0x21 */
+  "FvAx",               /* 0x22 */
+  "FvAy",               /* 0x23 */
+  "FvBx",               /* 0x24 */
+  "FvBy",               /* 0x25 */
+  "FvCx",               /* 0x26 */
+  "FvCy",               /* 0x27 */
+  "Fr",                 /* 0x28 */
+  "Fdrdx",              /* 0x29 */
+  "Fdrdy",              /* 0x2a */
+  "Fg",                 /* 0x2b */
+  "Fdgdx",              /* 0x2c */
+  "Fdgdy",              /* 0x2d */
+  "Fb",                 /* 0x2e */
+  "Fdbdx",              /* 0x2f */
+  "Fdbdy",              /* 0x30 */
+  "Fz",                 /* 0x31 */
+  "Fdzdx",              /* 0x32 */
+  "Fdzdy",              /* 0x33 */
+  "Fa",                 /* 0x34 */
+  "Fdadx",              /* 0x35 */
+  "Fdady",              /* 0x36 */
+  "Fs",                 /* 0x37 */
+  "Fdsdx",              /* 0x38 */
+  "Fdsdy",              /* 0x39 */
+  "Ft",                 /* 0x3a */
+  "Fdtdx",              /* 0x3b */
+  "Fdtdy",              /* 0x3c */
+  "Fw",                 /* 0x3d */
+  "Fdwdx",              /* 0x3e */
+  "Fdwdy",              /* 0x3f */
+  "FtriangleCMD",       /* 0x40 */
+  "reserved041",        /* 0x41 */
+  "nopCMD",             /* 0x42 */
+  "reserved043",        /* 0x43 */
+  "fastfillCMD",        /* 0x44 */
+  "reserved045",        /* 0x45 */
+  "swapbufferCMD",      /* 0x46 */
+  "reserved047",        /* 0x47 */
+  "swappendCMD",        /* 0x48 */
+  "reserved049",        /* 0x49 */
+  "reserved04A",        /* 0x4a */
+  "reserved04B",        /* 0x4b */
+  "reserved04C",        /* 0x4c */
+  "reserved04D",        /* 0x4d */
+  "reserved04E",        /* 0x4e */
+  "reserved04F",        /* 0x4f */
+  "fbzColorPath",       /* 0x50 */
+  "fogMode",            /* 0x51 */
+  "alphaMode",          /* 0x52 */
+  "reserved053",        /* 0x53 */
+  "fbzMode",            /* 0x54 */
+  "stipple",            /* 0x55 */
+  "color0",             /* 0x56 */
+  "color1",             /* 0x57 */
+  "fogColor",           /* 0x58 */
+  "zaColor",            /* 0x59 */
+  "chromaKey",          /* 0x5a */
+  "chromaRange",        /* 0x5b */
+  "reserved05C",        /* 0x5c */
+  "reserved05D",        /* 0x5d */
+  "reserved05E",        /* 0x5e */
+  "reserved05F",        /* 0x5f */
+  "colBufferSetup",     /* 0x60 */
+  "auxBufferSetup",     /* 0x61 */
+  "clipLeftRight0",     /* 0x62 */
+  "clipTopBottom0",     /* 0x63 */
+  "clipLeftRight1",     /* 0x64 */
+  "clipTopBottom1",     /* 0x65 */
+  "reserved066",        /* 0x66 */
+  "reserved067",        /* 0x67 */
+  "reserved068",        /* 0x68 */
+  "reserved069",        /* 0x69 */
+  "reserved06A",        /* 0x6a */
+  "reserved06B",        /* 0x6b */
+  "reserved06C",        /* 0x6c */
+  "reserved06D",        /* 0x6d */
+  "reserved06E",        /* 0x6e */
+  "reserved06F",        /* 0x6f */
+  "fogTable0001",       /* 0x70 */
+  "fogTable0203",       /* 0x71 */
+  "fogTable0405",       /* 0x72 */
+  "fogTable0607",       /* 0x73 */
+  "fogTable0809",       /* 0x74 */
+  "fogTable0A0B",       /* 0x75 */
+  "fogTable0C0D",       /* 0x76 */
+  "fogTable0E0F",       /* 0x77 */
+  "fogTable1011",       /* 0x78 */
+  "fogTable1213",       /* 0x79 */
+  "fogTable1415",       /* 0x7a */
+  "fogTable1617",       /* 0x7b */
+  "fogTable1819",       /* 0x7c */
+  "fogTable1A1B",       /* 0x7d */
+  "fogTable1C1D",       /* 0x7e */
+  "fogTable1E1F",       /* 0x7f */
+  "fogTable2021",       /* 0x80 */
+  "fogTable2223",       /* 0x81 */
+  "fogTable2425",       /* 0x82 */
+  "fogTable2627",       /* 0x83 */
+  "fogTable2829",       /* 0x84 */
+  "fogTable2A2B",       /* 0x85 */
+  "fogTable2C2D",       /* 0x86 */
+  "fogTable2E2F",       /* 0x87 */
+  "fogTable3031",       /* 0x88 */
+  "fogTable3233",       /* 0x89 */
+  "fogTable3435",       /* 0x8a */
+  "fogTable3637",       /* 0x8b */
+  "fogTable3839",       /* 0x8c */
+  "fogTable3A3B",       /* 0x8d */
+  "fogTable3C3D",       /* 0x8e */
+  "fogTable3E3F",       /* 0x8f */
+  "fbijrInit0",         /* 0x90 */
+  "fbijrInit1",         /* 0x91 */
+  "fbijrInit2",         /* 0x92 */
+  "fbijrInit3",         /* 0x93 */
+  "fbijrInit4",         /* 0x94 */
+  "fbijrInit5",         /* 0x95 */
+  "reserved096",        /* 0x96 */
+  "reserved097",        /* 0x97 */
+  "reserved098",        /* 0x98 */
+  "reserved099",        /* 0x99 */
+  "reserved09A",        /* 0x9a */
+  "reserved09B",        /* 0x9b */
+  "reserved09C",        /* 0x9c */
+  "reserved09D",        /* 0x9d */
+  "reserved09E",        /* 0x9e */
+  "reserved09F",        /* 0x9f */
+  "fbijrVersion",       /* 0xa0 */
+  "fbiPixelsIn",        /* 0xa1 */
+  "fbiChromaFail",      /* 0xa2 */
+  "fbiZfuncFail",       /* 0xa3 */
+  "fbiAfuncFail",       /* 0xa4 */
+  "fbiPixelsOut",       /* 0xa5 */
+  "reserved0A6",        /* 0xa6 */
+  "reserved0A7",        /* 0xa7 */
+  "reserved0A8",        /* 0xa8 */
+  "reserved0A9",        /* 0xa9 */
+  "reserved0AA",        /* 0xaa */
+  "reserved0AB",        /* 0xab */
+  "reserved0AC",        /* 0xac */
+  "reserved0AD",        /* 0xad */
+  "reserved0AE",        /* 0xae */
+  "reserved0AF",        /* 0xaf */
+  "reserved0B0",        /* 0xb0 */
+  "reserved0B1",        /* 0xb1 */
+  "reserved0B2",        /* 0xb2 */
+  "reserved0B3",        /* 0xb3 */
+  "reserved0B4",        /* 0xb4 */
+  "reserved0B5",        /* 0xb5 */
+  "reserved0B6",        /* 0xb6 */
+  "reserved0B7",        /* 0xb7 */
+  "reserved0B8",        /* 0xb8 */
+  "reserved0B9",        /* 0xb9 */
+  "reserved0BA",        /* 0xba */
+  "reserved0BB",        /* 0xbb */
+  "reserved0BC",        /* 0xbc */
+  "reserved0BD",        /* 0xbd */
+  "reserved0BE",        /* 0xbe */
+  "texChipSel",         /* 0xbf */
+  "textureMode",        /* 0xc0 */
+  "tLOD",               /* 0xc1 */
+  "tDetail",            /* 0xc2 */
+  "texBaseAddr",        /* 0xc3 */
+  "texBaseAddr1",       /* 0xc4 */
+  "texBaseAddr2",       /* 0xc5 */
+  "texBaseAddr38",      /* 0xc6 */
+  "trexInit0",          /* 0xc7 */
+  "trexInit1",          /* 0xc8 */
+  "nccTable0_0",        /* 0xc9 */
+  "nccTable0_1",        /* 0xca */
+  "nccTable0_2",        /* 0xcb */
+  "nccTable0_3",        /* 0xcc */
+  "nccTable0_4",        /* 0xcd */
+  "nccTable0_5",        /* 0xce */
+  "nccTable0_6",        /* 0xcf */
+  "nccTable0_7",        /* 0xd0 */
+  "nccTable0_8",        /* 0xd1 */
+  "nccTable0_9",        /* 0xd2 */
+  "nccTable0_A",        /* 0xd3 */
+  "nccTable0_B",        /* 0xd4 */
+  "nccTable1_0",        /* 0xd5 */
+  "nccTable1_1",        /* 0xd6 */
+  "nccTable1_2",        /* 0xd7 */
+  "nccTable1_3",        /* 0xd8 */
+  "nccTable1_4",        /* 0xd9 */
+  "nccTable1_5",        /* 0xda */
+  "nccTable1_6",        /* 0xdb */
+  "nccTable1_7",        /* 0xdc */
+  "nccTable1_8",        /* 0xdd */
+  "nccTable1_9",        /* 0xde */
+  "nccTable1_A",        /* 0xdf */
+  "nccTable1_B",        /* 0xe0 */
+  "reserved0E1",        /* 0xe1 */
+  "reserved0E2",        /* 0xe2 */
+  "reserved0E3",        /* 0xe3 */
+  "reserved0E4",        /* 0xe4 */
+  "reserved0E5",        /* 0xe5 */
+  "reserved0E6",        /* 0xe6 */
+  "reserved0E7",        /* 0xe7 */
+  "reserved0E8",        /* 0xe8 */
+  "reserved0E9",        /* 0xe9 */
+  "reserved0EA",        /* 0xea */
+  "reserved0EB",        /* 0xeb */
+  "reserved0EC",        /* 0xec */
+  "reserved0ED",        /* 0xed */
+  "reserved0EE",        /* 0xee */
+  "reserved0EF",        /* 0xef */
+  "reserved0F0",        /* 0xf0 */
+  "reserved0F1",        /* 0xf1 */
+  "reserved0F2",        /* 0xf2 */
+  "reserved0F3",        /* 0xf3 */
+  "reserved0F4",        /* 0xf4 */
+  "reserved0F5",        /* 0xf5 */
+  "reserved0F6",        /* 0xf6 */
+  "reserved0F7",        /* 0xf7 */
+  "reserved0F8",        /* 0xf8 */
+  "reserved0F9",        /* 0xf9 */
+  "reserved0FA",        /* 0xfa */
+  "reserved0FB",        /* 0xfb */
+  "reserved0FC",        /* 0xfc */
+  "reserved0FD",        /* 0xfd */
+  "reserved0FE",        /* 0xfe */
+  "reserved0FF"         /* 0xff */
+};
+
+/*---------------------------------------------------------------------------
+** _grDebugGroupWriteHeader
+*/
+#if defined(GDBG_INFO_ON) && (GLIDE_PLATFORM & GLIDE_HW_SST96)
+void
+_grDebugGroupWriteHeader(FxU32 header, FxU32 address) 
+{
+#define FN_NAME "_grDebugGroupWriteHeader"
+  GR_DCL_GC;
+  FxU32
+    offset,
+    /* laddress,
+     * chipField, */
+    lheader = header;
+  int
+    index,
+    nBits = 0;
+
+  GR_ASSERT(address & GWH_ENABLE_BIT);
+
+  GDBG_INFO((128, "New Group Write Packet ======================\n"));
+  GDBG_INFO((128, "Address:      0x%x\n", address));
+  GDBG_INFO((128, "Header:       0x%x\n", header));
+  GDBG_INFO((128, "PCI Address:  0x%x\n", (address & 0xfffff) << 2));
+  GDBG_INFO((128, "Chip Field:   0x%x\n", (address >> 14) & 0xf));
+            
+  offset = (address & ~(0xf << 14)) & 0xfffff;
+  index = offset;
+
+  if (offset < 0x100 ) { /* It's state or triangle */
+    
+    GDBG_INFO((128, "Start:     0x%s (0x%x)\n", regNames[index], index));
+    GDBG_INFO((128, "Mask:      0x%x\n", header));
+    
+    while (lheader) {
+      if (lheader & 0x1) {
+        nBits++;
+        GDBG_INFO((128, "Includes:\t%s (0x%x)\n",
+                   regNames[index], index));
+      }
+      lheader >>= 1;
+      index++;
+    }
+  } else if (offset >= 0x10000) { /* It's texture */
+    GDBG_INFO((128, "Mask:      0x%x\n", header));
+    GDBG_INFO((128, "TEXTURE\n"));
+    do {
+      if (lheader & 0x1)
+        nBits++;
+    } while (lheader >>=1 );
+  } else {                      /* WTF? */
+    GDBG_INFO((128, "Group Write Header:\t????\n"));
+    nBits = 1;
+  }
+
+  GDBG_INFO((128, "%s:  %d bits of mask 0x%x were set\n", FN_NAME,
+             nBits, header)); 
+
+  GR_ASSERT(nBits);
+
+#undef FN_NAME
+} /* _grDebugGroupWriteHeader */
+#endif /* (GDBG_INFO_ON & (GLIDE_PLATFORM & GLIDE_HW_SST96)) */
+
+void
+_grFifoWriteDebug(FxU32 addr, FxU32 val, FxU32 fifoPtr)
+{
+  GR_DCL_GC;
+  FxU32
+    index = GEN_INDEX(addr);
+  char
+    *regName; 
+
+  regName = (index <= 0xff) ? regNames[index] : "TRAM";
+ 
+  if (index <= 0xff) { 
+    GDBG_INFO((120, "Storing to FIFO:\n"));
+    GDBG_INFO((120, "\tReg Name:    %s\n", regName));
+    GDBG_INFO((120, "\tReg Num:     0x%x\n", index));
+    GDBG_INFO((120, "\tValue:       0x%x\n", val));
+    GDBG_INFO((120, "\tFIFO Ptr:    0x%x\n", fifoPtr));
+    GDBG_INFO((120, "\tSince Fence: 0x%x\n", gc->hwDep.sst96Dep.writesSinceFence));
+    GDBG_INFO((120, "\tFIFO Test:    0x%x\n", gc->fifoData.hwDep.vg96FIFOData.fifoSize));
+  }
+} /* _grFifoWriteDebug */
+
+void
+_grFifoFWriteDebug(FxU32 addr, float val, FxU32 fifoPtr)
+{
+  GR_DCL_GC;
+  FxU32
+    index = GEN_INDEX(addr);
+  char
+    *regName; 
+
+  if (index <= 0xff) {
+    
+    regName = regNames[index];
+    
+    GDBG_INFO((120, "Storing to FIFO:\n"));
+    GDBG_INFO((120, "\tReg Name:    %s\n", regName));
+    GDBG_INFO((120, "\tReg Num:     0x%x\n", index));
+    GDBG_INFO((120, "\tValue:       %4.2f\n", val));
+    GDBG_INFO((120, "\tFIFO Ptr:    0x%x\n", fifoPtr));
+    GDBG_INFO((120, "\tFIFO Test:    0x%x\n", gc->fifoData.hwDep.vg96FIFOData.fifoSize));
+  } else {
+    GDBG_INFO((195, "Storing to FIFO:\n"));
+    GDBG_INFO((195, "\tTEX Addr:    0x%x\n", index));
+    GDBG_INFO((195, "\tTexel:       %4.2f\n", val));
+    GDBG_INFO((195, "\tFIFO Ptr:    0x%x\n", fifoPtr));
+    GDBG_INFO((120, "\tFIFO Test:    0x%x\n", gc->fifoData.hwDep.vg96FIFOData.fifoSize));
+  }  
+} /* _grFifoFWriteDebug */
+
+
+/*--------------------------------------------------------------------------
+** _grSst96PCIFifoEmpty 
+*/
+FxBool
+_grSst96PCIFifoEmpty() {
+  GR_DCL_GC;
+  GR_DCL_HW;
+
+  int
+    count = 0;
+
+#define COUNT_PATIENCE_VALUE  100000000
+#define SST96_PCI_FIFO_EMPTY(a) ((((a->status) & 0x3f00) >> 8) == 0x3f)
+  for (;;) {
+    if (SST96_PCI_FIFO_EMPTY(hw))
+      return FXTRUE;
+    
+    if (!(++count % COUNT_PATIENCE_VALUE)) {
+      GDBG_INFO((120, "Losing Patients after %d tries\n", COUNT_PATIENCE_VALUE));
+      break;
+    }
+  }
+  return FXFALSE;  
+} /* _grSst96PCIFifoEmpty */
+
+
+FxU32
+*sstGlobal(void);
+
+void GR_CDECL
+_grSst96FifoMakeRoom(void) 
+{
+  GR_DCL_GC;
+#ifdef SST96_ALT_FIFO_WRAP
+  /* NB: W/ the alternate fifo wrapping stuff on only the asm
+   * tri-setup uses this routine.  
+   */
+  gc->fifoData.hwDep.vg96FIFOData.blockSize = _GlideRoot.curTriSize;
+#endif
+
+  /* Wrap Fifo now if triangle is going to incur a wrap */
+  initWrapFIFO(&gc->fifoData);
+} /* _grSst96FifoMakeRoom */
+
+/*--------------------------------------------------------------------------
+** _grSst96Load32
+*/
+FxU32
+_grSst96Load32(FxU32 *s) {
+  GR_DCL_GC;
+  FxU32
+    index,                      /* index into reg name list */
+    regVal;
+  char
+    *regName;
+
+  regVal = *s;
+
+  index = GEN_INDEX(s);
+
+  if (index <= 0xff) {
+    regName = regNames[index];
+    GDBG_INFO((120, "Direct Register Read:\n"));
+    GDBG_INFO((120, "\tReg Name:        %s\n", regName));
+    GDBG_INFO((120, "\tReg Num:         0x%x\n", index));
+    GDBG_INFO((120, "\tReg Val:         0x%x\n", regVal));
+  }
+      
+  return regVal;
+
+} /* _grSst96Load32 */
+
+
+/*---------------------------------------------------------------------------
+** _gr96SstStore32
+*/
+void
+_grSst96Store32(FxU32 *d, FxU32 s) {
+  GR_DCL_GC;
+
+#ifdef SST96_FIFO
+  GLIDE_FIFO_CHECK();
+  {
+    FxI32 fifoSize = gc->fifoData.hwDep.vg96FIFOData.fifoSize - 8;
+    if (fifoSize < 0) {
+#if SST96_ALT_FIFO_WRAP
+      gc->fifoData.hwDep.vg96FIFOData.blockSize = (sizeof(FxU32) << 1);
+      initWrapFIFO(&gc->fifoData);
+#else
+      _grSst96FifoMakeRoom();
+#endif
+    }
+  }
+
+  SST96_STORE_FIFO( d, s );
+  GLIDE_FIFO_CHECK();
+#else /* !SST96_FIFO */
+  FxU32
+    index; /* Index into reg name list */
+  char
+    *regName;
+
+  index = GEN_INDEX(d);
+
+  if (index <= 0xff) {
+    regName = (index <= 0xff) ? regNames[index] : "TRAM";
+    GDBG_INFO((120, "Direct Rester Write:\n"));
+    GDBG_INFO((120, "\tReg Name:        %s\n", regName));
+    GDBG_INFO((120, "\tReg Num:         0x%x\n", index));
+    GDBG_INFO((120, "\tValue:           0x%x\n", s));
+  }
+
+  if (_grSst96PCIFifoEmpty() == FXFALSE) {
+    GDBG_INFO((120, "ERROR:  Fifo didn't empty\n"));
+  }
+
+  *d = s;
+#endif /* !SST96_FIFO */
+} /* _gr96SstStore32 */
+
+/*---------------------------------------------------------------------------
+** _grSst96Store32F
+*/
+void
+_grSst96Store32F(float *d, float s) {
+#ifdef SST96_FIFO
+  GLIDE_FIFO_CHECK();
+#else
+  FxU32
+    index;                      /* Offset into reg name array */
+  char
+    *regName;                   /* Name of register */
+
+  index = GEN_INDEX(d);
+
+  if (index <= 0xff) {
+    regName = regNames[index];
+    GDBG_INFO((120, "Direct Register Write:\n"));
+    GDBG_INFO((120, "\tReg Name:        %s\n", regName));
+    GDBG_INFO((120, "\tReg Num:         0x%x\n", index));
+    GDBG_INFO((120, "\tValue:           %4.4f\n", s));
+  }
+  *d = s;
+
+  if (_grSst96PCIFifoEmpty() == FXFALSE) {
+    GDBG_INFO((120, "ERROR:  Fifo didn't empty\n"));
+  }
+#endif
+} /* _grSst96Store32F */
+
+/*---------------------------------------------------------------------------
+** _grSst96Store16
+*/
+void
+_grSst96Store16(FxU16 *d, FxU16 s) {
+  FxU32 dummy;
+
+  dummy = (FxU32) s;
+  _grSst96Store32((FxU32 *) d, dummy);
+} /* _grSst96Store16 */
+
+#undef GETINDEX
+#undef GETREADADDR
+#undef GR_GET
+#define GR_GET(s) *(GETREADADDR(s))
+#define GETINDEX(a) ((((FxU32) &a) - (((FxU32) hw) + 0x400000)) >> 2)
+#define GETREADADDR(s) ((FxU32 *) (((FxU32) hw) + (GETINDEX(s) <<12)))
+
+#define STATUS_MEMFIFOERR       FXBIT(15)
+#define STATUS_CMDFIFOERR       FXBIT(14)
+
+#define FIFO_TOP_BYTES(a) ((((a) >> 11) & 0x3ff) << 12)
+#define FIFO_BOT_BYTES(a) ((((a) >> 1) & 0x3ff) << 12)
+#define FIFO_RD_BYTES(a) (((a) << 3) & 0x7ffff)
+
+/*---------------------------------------------------------------------------
+** _grSst96CheckFifoData
+*/
+void
+_grSst96CheckFifoData()
+{
+#define FN_NAME "_grSst96CheckFifoData"
+  GR_DCL_GC;
+  GR_DCL_HW;
+
+  FxU32
+    /* Data for error checking */
+    fifoStartGC,                /* GC's idea of FIFO bottom */
+    fifoStartHW,                /* Jr's idea of FIFO bbottom */
+    fifoWrPtrGC,                /* GC's idea of write pointer */
+    fifoRdPtrHW,                /* Jr's idea of read pointer */
+    fifoTopHW,                  /* Jr's idea of top of FIFO */
+    /* Register contents */
+    status,
+    fbiJrInit3,
+    fbiJrInit4,
+    fbiJrInit5;
+
+  FxBool
+    error = FXFALSE;
+
+  if (!gc->open) return;
+
+  /*
+  **  Get the relavent data from the GC and from Jr.
+  */
+
+  /* Jr. */
+  status = GR_GET(hw->status);
+  fbiJrInit3 = GR_GET(hw->fbijrInit3);
+  fbiJrInit4 = GR_GET(hw->fbijrInit4);
+  fbiJrInit5 = GR_GET(hw->fbijrInit5);
+
+  /* GC */
+  fifoStartGC = (FxU32) gc->fifoData.hwDep.vg96FIFOData.fifoVirt - (FxU32) gc->base_ptr;
+  fifoWrPtrGC = (FxU32) gc->fifoData.hwDep.vg96FIFOData.fifoPtr - (FxU32) gc->base_ptr;
+  
+  /* Deduce relevant data from registers */
+  fifoStartHW = FIFO_BOT_BYTES(fbiJrInit3);
+  fifoTopHW = FIFO_TOP_BYTES(fbiJrInit3) + 0x1000;
+  fifoRdPtrHW = FIFO_RD_BYTES(fbiJrInit5);
+
+  /*
+  **  Perform Error Checking
+  */
+
+  /* Check for errors indicated in status bits */
+  if (status & STATUS_MEMFIFOERR) {
+    GDBG_PRINTF(("FIFO ERROR:  Status 0x%x indicates MEMFIFO error!\n", status));
+    error = FXTRUE;
+  }
+
+  if (status & STATUS_CMDFIFOERR) {
+    GDBG_PRINTF(("FIFO ERROR:   Status 0x%x indicates CMDFIFO error\n"));
+    error = FXTRUE;
+  }
+
+  /* Check for proper concept of FIFO bottom */
+  if (fifoStartGC != fifoStartHW) {
+    GDBG_PRINTF(("FIFO_ERROR:   fbijrInit3 0x%x: FIFO Bottom  0x%x != 0x%x\n",
+               fbiJrInit3, fifoStartGC, fifoStartHW));
+    error = FXTRUE;
+  }
+
+  /* Check for write past end of FIFO */
+  if (fifoWrPtrGC > fifoTopHW) {
+    GDBG_PRINTF(("FIFO ERROR:  Top of FIFO: 0x%x, Write Ptr: 0x%x\n",
+                fifoTopHW, fifoWrPtrGC));
+    error = FXTRUE;
+  }
+
+  if ((fbiJrInit4 > (FxU32)gc->fifoData.hwDep.vg96FIFOData.fifoMax) ||
+      (fbiJrInit4 >= 0x10000UL)) {
+    GDBG_PRINTF(("FIFO Error: Entry count overflow: 0x%X 0x%X\n",
+                 fbiJrInit4, gc->fifoData.hwDep.vg96FIFOData.fifoMax));
+    error = FXTRUE;
+  }
+
+  if (error) {
+    GrErrorCallback("FATAL FIFO ERROR (See above)\n", FXTRUE);
+  }
+
+#undef FN_NAME
+} /* _grSst96CheckFifoData */
+
+#endif /* (GLIDE_PLATFORM & GLIDE_HW_SST96) */
Index: trunk/src/opengl/glide/sst1/glide2x.def
===================================================================
--- trunk/src/opengl/glide/sst1/glide2x.def	(revision 2885)
+++ trunk/src/opengl/glide/sst1/glide2x.def	(revision 2885)
@@ -0,0 +1,179 @@
+; THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+; PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+; TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+; INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
+; DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
+; THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+; EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+; FULL TEXT OF THE NON-WARRANTY PROVISIONS.
+;
+; USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+; RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+; TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+; AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+; SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+; THE UNITED STATES.
+;
+; COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+;
+; glide2x.def - dynamic link library definition
+;
+; NOTE: Must be identical (ordinals) to .def file in Voodoo 2 Glide dir!!!!!!!
+
+LIBRARY GLIDE2X INITINSTANCE TERMINSTANCE
+
+DESCRIPTION '3Dfx Glide Dynamic link library'
+
+CODE        LOADONCALL EXECUTEREAD NOIOPL NONCONFORMING
+DATA        LOADONCALL READWRITE NOIOPL NONSHARED
+
+EXPORTS
+ _ConvertAndDownloadRle@64              @1
+ _grAADrawLine@8			@2
+ _grAADrawPoint@4			@3
+ _grAADrawPolygon@12			@4
+ _grAADrawPolygonVertexList@8		@5
+ _grAADrawTriangle@24			@6
+ _grAlphaBlendFunction@16		@7
+ _grAlphaCombine@20			@8
+ _grAlphaControlsITRGBLighting@4	@9
+ _grAlphaTestFunction@4			@10
+ _grAlphaTestReferenceValue@4		@11
+ _grBufferClear@12			@12
+ _grBufferNumPending@0			@13
+ _grBufferSwap@4			@14
+ _grCheckForRoom@4			@15
+ _grChromakeyMode@4			@16
+ _grChromakeyValue@4			@17
+ _grClipWindow@16			@18
+ _grColorCombine@20			@19
+ _grColorMask@8				@20
+ _grConstantColorValue4@16		@21
+ _grConstantColorValue@4		@22
+ _grCullMode@4				@23
+ _grDepthBiasLevel@4			@24
+ _grDepthBufferFunction@4		@25
+ _grDepthBufferMode@4			@26
+ _grDepthMask@4				@27
+ _grDisableAllEffects@0			@28
+ _grDitherMode@4			@29
+ _grDrawLine@8				@30
+ _grDrawPlanarPolygon@12		@31
+ _grDrawPlanarPolygonVertexList@8	@32
+ _grDrawPoint@4				@33
+ _grDrawPolygon@12			@34
+ _grDrawPolygonVertexList@8		@35
+ _grDrawTriangle@12			@36
+ _grErrorSetCallback@4			@37
+ _grFogColorValue@4			@38
+ _grFogMode@4				@39
+ _grFogTable@4				@40
+ _grGammaCorrectionValue@4		@41
+ _grGlideGetState@4			@42
+ _grGlideGetVersion@4			@43
+ _grGlideInit@0				@44
+ _grGlideSetState@4			@45
+ _grGlideShamelessPlug@4		@46
+ _grGlideShutdown@0			@47
+ _grHints@8				@48
+ _grLfbConstantAlpha@4			@49
+ _grLfbConstantDepth@4			@50
+ _grLfbLock@24				@51
+ _grLfbReadRegion@28			@52
+ _grLfbUnlock@8				@53
+ _grLfbWriteColorFormat@4		@54
+ _grLfbWriteColorSwizzle@8		@55
+ _grLfbWriteRegion@32			@56
+ _grRenderBuffer@4			@57
+ _grResetTriStats@0			@58
+ _grSplash@20				@59
+ _grSstConfigPipeline@12		@60
+ _grSstControl@4			@61
+ _grSstIdle@0				@62
+ _grSstIsBusy@0				@63
+ _grSstOrigin@4				@64
+ _grSstPerfStats@4			@65
+ _grSstQueryBoards@4			@66
+ _grSstQueryHardware@4			@67
+ _grSstResetPerfStats@0			@68
+ _grSstScreenHeight@0			@69
+ _grSstScreenWidth@0			@70
+ _grSstSelect@4				@71
+ _grSstStatus@0				@72
+ _grSstVRetraceOn@0			@73
+ _grSstVidMode@8			@74
+ _grSstVideoLine@0			@75
+ _grSstWinClose@0			@76
+ _grSstWinOpen@28			@77
+ _grTexCalcMemRequired@16		@78
+ _grTexClampMode@12			@79
+ _grTexCombine@28			@80
+ _grTexCombineFunction@8		@81
+ _grTexDetailControl@16			@82
+ _grTexDownloadMipMap@16		@83
+ _grTexDownloadMipMapLevel@32		@84
+ _grTexDownloadMipMapLevelPartial@40	@85
+ _grTexDownloadTable@12			@86
+ _grTexDownloadTablePartial@20		@87
+ _grTexFilterMode@12			@88
+ _grTexLodBiasValue@8			@89
+ _grTexMaxAddress@4			@90
+ _grTexMinAddress@4			@91
+ _grTexMipMapMode@12			@92
+ _grTexMultibase@8			@93
+ _grTexMultibaseAddress@20		@94
+ _grTexNCCTable@8			@95
+ _grTexSource@16			@96
+ _grTexTextureMemRequired@8		@97
+ _grTriStats@8				@98
+ _gu3dfGetInfo@8			@99
+ _gu3dfLoad@8				@100
+ _guAADrawTriangleWithClip@12		@101
+ _guAlphaSource@4			@102
+ _guColorCombineFunction@4		@103
+ _guDrawPolygonVertexListWithClip@8	@104
+ _guDrawTriangleWithClip@12		@105
+ _guEncodeRLE16@16			@106
+ _guEndianSwapBytes@4			@107
+ _guEndianSwapWords@4			@108
+ _guFogGenerateExp2@8			@109
+ _guFogGenerateExp@8			@110
+ _guFogGenerateLinear@12		@111
+ _guFogTableIndexToW@4			@112
+ _guMPDrawTriangle@12			@113
+ _guMPInit@0				@114
+ _guMPTexCombineFunction@4		@115
+ _guMPTexSource@8			@116
+ _guMovieSetName@4			@117
+ _guMovieStart@0			@118
+ _guMovieStop@0				@119
+ _guTexAllocateMemory@60		@120
+ _guTexChangeAttributes@48		@121
+ _guTexCombineFunction@8		@122
+ _guTexCreateColorMipMap@0		@123
+ _guTexDownloadMipMap@12		@124
+ _guTexDownloadMipMapLevel@12		@125
+ _guTexGetCurrentMipMap@4		@126
+ _guTexGetMipMapInfo@4			@127
+ _guTexMemQueryAvail@4			@128
+ _guTexMemReset@0			@129
+ _guTexSource@4				@130
+ _pciClose@0                  		@131
+ _pciDeviceExists@4          		@132
+ _pciFindCard@12               		@133
+ _pciFindCardMulti@16             	@134
+ _pciFindFreeMTRR@4           		@135
+ _pciFindMTRRMatch@16              	@136
+ _pciGetConfigData@20              	@137
+ _pciGetErrorCode@0           		@138
+ _pciGetErrorString@0             	@139
+ _pciLinearRangeSetPermission@12   	@140
+ _pciMapCard@20                		@141
+ _pciMapCardMulti@24           		@142
+ _pciMapPhysicalToLinear@12             @143
+ _pciOpen@0              		@144
+ _pciOutputDebugString@4          	@145
+ _pciSetConfigData@20              	@146
+ _pciSetMTRR@16                		@147
+ _pciSetPassThroughBase@8         	@148
+ _pciUnmapPhysical@8              	@149
Index: trunk/src/opengl/glide/sst1/incsrc/makefile.sun
===================================================================
--- trunk/src/opengl/glide/sst1/incsrc/makefile.sun	(revision 2885)
+++ trunk/src/opengl/glide/sst1/incsrc/makefile.sun	(revision 2885)
@@ -0,0 +1,29 @@
+#
+# THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+# PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+# TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+# INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+# DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+# THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+# EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+# FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+# 
+# USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+# RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+# TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+# AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+# SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+# THE UNITED STATES.  
+# 
+# COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+#
+# $Revision: 1.1 $
+# $Date: 2000-02-25 00:31:24 $
+#
+
+HEADERS=*.h
+
+INSTALL_DESTINATION=$(BUILD_ROOT_SST1)
+
+include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak
+
Index: trunk/src/opengl/glide/sst1/incsrc/makefile.unix
===================================================================
--- trunk/src/opengl/glide/sst1/incsrc/makefile.unix	(revision 2885)
+++ trunk/src/opengl/glide/sst1/incsrc/makefile.unix	(revision 2885)
@@ -0,0 +1,25 @@
+#
+# THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+# PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+# TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+# INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+# DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+# THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+# EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+# FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+# 
+# USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+# RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+# TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+# AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+# SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+# THE UNITED STATES.  
+# 
+# COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+#
+
+HEADERS = $(wildcard *.h)
+
+INSTALL_DESTINATION = $(BUILD_ROOT_SST1)
+
+include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak
Index: trunk/src/opengl/glide/sst1/incsrc/ncc.h
===================================================================
--- trunk/src/opengl/glide/sst1/incsrc/ncc.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/incsrc/ncc.h	(revision 2885)
@@ -0,0 +1,41 @@
+/* 
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+*/
+
+
+#ifndef __NCC_H__
+#define __NCC_H__
+
+/*
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:25 $
+*/
+
+// translation tables for decompressing NCC format
+typedef struct {
+    unsigned char yRGB[16];
+    int iRGB[4][3];
+    int qRGB[4][3];
+} NccTable;
+
+extern void yiq2rgb(NccTable *ncc, unsigned char *c888, unsigned char yiq);
+extern void nccYIQtoRGB(unsigned int *array, long length);
+extern unsigned char *nccRGBtoYIQ(const int xSize, const int ySize,
+				const unsigned int *from, float percent);
+#endif	/* !__NCC_H__ */
Index: trunk/src/opengl/glide/sst1/incsrc/sst.h
===================================================================
--- trunk/src/opengl/glide/sst1/incsrc/sst.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/incsrc/sst.h	(revision 2885)
@@ -0,0 +1,1114 @@
+/* 
+ * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ * FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ * 
+ * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ * TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ * THE UNITED STATES.  
+ * 
+ * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+ */
+
+#ifndef __SST_H__
+#define __SST_H__
+
+/*
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:25 $
+*/
+
+#include <ncc.h>
+#include "fx64.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// this crazy macro fixes the binary point within a floating point
+// number so that it has 'fracbits' to the right of the binary point
+// it also adds a '1' bit to the MSB so that slightly negative numbers
+// end up looking like twos complement numbers (they carry out from the '1')
+#define FLOAT_FIX(f,fracbits) ((f)+(float)(3<<(22-(fracbits))))
+
+#define SST_FLOAT(f,scale,shift) (unsigned long)((f)*((scale)*(float)(1<<shift)))
+#define SST_TLOD_MINMAX(lodmin,lodmax) \
+                (((lodmin) << (SST_LODMIN_SHIFT)) | \
+                ((lodmax) << (SST_LODMAX_SHIFT)))
+#define SST_TLOD_MINMAX_INT(lodmin,lodmax) \
+                (((lodmin) << (SST_LOD_FRACBITS+SST_LODMIN_SHIFT)) | \
+                ((lodmax) << (SST_LOD_FRACBITS+SST_LODMAX_SHIFT)))
+
+// this crazy macro tests the sign bit of a float by loading it into
+// an integer register and then testing the sign bit of the integer
+#define FLOAT_ISNEG(f) ((*(int *)(&(f))) < 0)
+
+// these crazy macros returns the sign of a number (1 if >= 0; -1 if < 0)
+#define ISIGN(x) (((x) | 0x40000000) >> 30)
+#define FSIGN(f) ISIGN(*(long *)&f)
+
+typedef struct vertex_Rec {
+    unsigned long x;            // 12.4 format
+    unsigned long y;            // 12.4
+} vtxRec;
+
+// 256 color palette tables
+typedef struct {
+    unsigned long argb[256];
+} Pal256;
+
+#define BIT(n)  (1<<(n))
+#define SST_MASK(n) (0xFFFFFFFF >> (32-(n)))
+#define SST_MASK64(n) FX_MASK64(n)
+
+
+//----------------- SST binary point locations  ---------------
+#define SST_LOD_SIZE     6
+#define SST_LOD_FRACBITS 2
+#define SST_XY_SIZE     16
+#define SST_XY_INTBITS  12
+#define SST_XY_FRACBITS  4
+#define SST_RGBA_SIZE   24
+#define SST_RGBA_INTBITS 8
+#define SST_RGBA_FRACBITS 12
+#define SST_Z_SIZE      32
+#define SST_Z_INTBITS   16
+#define SST_Z_FRACBITS  12
+// NOTE: below are ONLY for the fixed point registers
+#define SST_ST_SIZE     32
+#define SST_ST_INTBITS  14
+#define SST_ST_FRACBITS 18
+#define SST_W_SIZE      32
+#define SST_W_INTBITS    2
+#define SST_W_FRACBITS  30
+
+//----------------- SST lfbMode bits    -----------------------
+#define SST_LFB_FORMAT_SHIFT    0
+#define SST_LFB_FORMAT          (0xF<<SST_LFB_FORMAT_SHIFT)
+#       define SST_LFB_565              (0<<SST_LFB_FORMAT_SHIFT)
+#       define SST_LFB_555              (1<<SST_LFB_FORMAT_SHIFT)
+#       define SST_LFB_1555             (2<<SST_LFB_FORMAT_SHIFT)
+#       define SST_LFB_u1               (3<<SST_LFB_FORMAT_SHIFT)
+#       define SST_LFB_888              (4<<SST_LFB_FORMAT_SHIFT)
+#       define SST_LFB_8888             (5<<SST_LFB_FORMAT_SHIFT)
+#       define SST_LFB_u2               (6<<SST_LFB_FORMAT_SHIFT)
+#       define SST_LFB_u3               (7<<SST_LFB_FORMAT_SHIFT)
+#       define SST_LFB_Z565             (12<<SST_LFB_FORMAT_SHIFT)
+#       define SST_LFB_Z555             (13<<SST_LFB_FORMAT_SHIFT)
+#       define SST_LFB_Z1555            (14<<SST_LFB_FORMAT_SHIFT)
+#       define SST_LFB_ZZ               (15<<SST_LFB_FORMAT_SHIFT)
+#define SST_LFB_WRITEBUFSELECT_SHIFT    4
+#define SST_LFB_WRITEBUFSELECT  (0x3<<SST_LFB_WRITEBUFSELECT_SHIFT)
+#       define SST_LFB_WRITEFRONTBUFFER (0<<SST_LFB_WRITEBUFSELECT_SHIFT)
+#       define SST_LFB_WRITEBACKBUFFER  (1<<SST_LFB_WRITEBUFSELECT_SHIFT)
+#   define SST_LFB_WRITEAUXBUFFER   (2<<SST_LFB_WRITEBUFSELECT_SHIFT)
+#define SST_LFB_READBUFSELECT_SHIFT     6
+#define SST_LFB_READBUFSELECT   (0x3<<SST_LFB_READBUFSELECT_SHIFT)
+#       define SST_LFB_READFRONTBUFFER  (0<<SST_LFB_READBUFSELECT_SHIFT)
+#       define SST_LFB_READBACKBUFFER   (1<<SST_LFB_READBUFSELECT_SHIFT)
+#       define SST_LFB_READDEPTHABUFFER (2<<SST_LFB_READBUFSELECT_SHIFT)
+#   define SST_LFB_READAUXBUFFER    SST_LFB_READDEPTHABUFFER
+#define SST_LFB_ENPIXPIPE       BIT(8)
+#define SST_LFB_RGBALANES_SHIFT         9
+#define SST_LFB_RGBALANES       (0x3<<SST_LFB_RGBALANES_SHIFT)
+#       define SST_LFB_RGBALANES_ARGB (0<<SST_LFB_RGBALANES_SHIFT)
+#       define SST_LFB_RGBALANES_ABGR (1<<SST_LFB_RGBALANES_SHIFT)
+#       define SST_LFB_RGBALANES_RGBA (2<<SST_LFB_RGBALANES_SHIFT)
+#       define SST_LFB_RGBALANES_BGRA (3<<SST_LFB_RGBALANES_SHIFT)
+#define SST_LFB_WRITE_SWAP16    BIT(11)
+#define SST_LFB_WRITE_BYTESWAP  BIT(12)
+#define SST_LFB_YORIGIN         BIT(13)
+#define SST_LFB_WSELECT         BIT(14)
+#define SST_LFB_READ_SWAP16     BIT(15)
+#define SST_LFB_READ_BYTESWAP   BIT(16)
+
+
+//----------------- SST videoFilterRgbThreshold
+#define SST_VIDEOFILTER_BLUE_SHIFT      0
+#define SST_VIDEOFILTER_BLUE    (0xff << SST_VIDEOFILTER_BLUE_SHIFT)
+#define SST_VIDEOFILTER_GREEN_SHIFT     8
+#define SST_VIDEOFILTER_GREEN   (0xff << SST_VIDEOFILTER_GREEN_SHIFT)
+#define SST_VIDEOFILTER_RED_SHIFT 16            
+#define SST_VIDEOFILTER_RED     (0xff << SST_VIDEOFILTER_RED_SHIFT)
+
+//----------------- SST textureMode bits -----------------------
+#define SST_TPERSP_ST           BIT(0)
+#define SST_TMINFILTER          BIT(1)
+#define SST_TMAGFILTER          BIT(2)
+#define SST_TCLAMPW             BIT(3)
+#define SST_TLODDITHER          BIT(4)
+#define SST_TNCCSELECT          BIT(5)  // selects which table
+#define SST_TCLAMPS             BIT(6)
+#define SST_TCLAMPT             BIT(7)
+#define SST_T8BIT(mode) ((mode&SST_TFORMAT)<SST_ARGB8332)
+#define SST_TFORMAT_SHIFT       8
+#define SST_TFORMAT             (0xF<<SST_TFORMAT_SHIFT)
+#       define SST_RGB332               (0<<SST_TFORMAT_SHIFT)
+#       define SST_YIQ422               (1<<SST_TFORMAT_SHIFT)
+#       define SST_A8                   (2<<SST_TFORMAT_SHIFT)
+#       define SST_I8                   (3<<SST_TFORMAT_SHIFT)
+#       define SST_AI44                 (4<<SST_TFORMAT_SHIFT)
+#       define SST_P8                   (5<<SST_TFORMAT_SHIFT)
+#       define SST_P8_RGBA6666          (6<<SST_TFORMAT_SHIFT)
+#       define SST_ARGB8332             (8<<SST_TFORMAT_SHIFT)
+#       define SST_AYIQ8422             (9<<SST_TFORMAT_SHIFT)
+#       define SST_RGB565               (10<<SST_TFORMAT_SHIFT)
+#       define SST_ARGB1555             (11<<SST_TFORMAT_SHIFT)
+#       define SST_ARGB4444             (12<<SST_TFORMAT_SHIFT)
+#       define SST_AI88                 (13<<SST_TFORMAT_SHIFT)
+#       define SST_AP88                 (14<<SST_TFORMAT_SHIFT)
+#define SST_TC_ZERO_OTHER       BIT(12)
+#define SST_TC_SUB_CLOCAL       BIT(13)
+#define SST_TC_MSELECT_SHIFT    14
+#define SST_TC_MSELECT          (0x7<<SST_TC_MSELECT_SHIFT)
+#       define SST_TC_MONE              (0<<SST_TC_MSELECT_SHIFT)
+#       define SST_TC_MCLOCAL           (1<<SST_TC_MSELECT_SHIFT)
+#       define SST_TC_MAOTHER           (2<<SST_TC_MSELECT_SHIFT)
+#       define SST_TC_MALOCAL           (3<<SST_TC_MSELECT_SHIFT)
+#       define SST_TC_MLOD              (4<<SST_TC_MSELECT_SHIFT)
+#       define SST_TC_MLODFRAC          (5<<SST_TC_MSELECT_SHIFT)
+#define SST_TC_REVERSE_BLEND    BIT(17)
+#define SST_TC_ADD_CLOCAL       BIT(18)
+#define SST_TC_ADD_ALOCAL       BIT(19)
+#define SST_TC_INVERT_OUTPUT    BIT(20)
+#define SST_TCA_ZERO_OTHER      BIT(21)
+#define SST_TCA_SUB_CLOCAL      BIT(22)
+#define SST_TCA_MSELECT_SHIFT   23
+#define SST_TCA_MSELECT         (0x7<<SST_TCA_MSELECT_SHIFT)
+#       define SST_TCA_MONE             (0<<SST_TCA_MSELECT_SHIFT)
+#       define SST_TCA_MCLOCAL          (1<<SST_TCA_MSELECT_SHIFT)
+#       define SST_TCA_MAOTHER          (2<<SST_TCA_MSELECT_SHIFT)
+#       define SST_TCA_MALOCAL          (3<<SST_TCA_MSELECT_SHIFT)
+#       define SST_TCA_MLOD             (4<<SST_TCA_MSELECT_SHIFT)
+#       define SST_TCA_MLODFRAC         (5<<SST_TCA_MSELECT_SHIFT)
+#define SST_TCA_REVERSE_BLEND   BIT(26)
+#define SST_TCA_ADD_CLOCAL      BIT(27)
+#define SST_TCA_ADD_ALOCAL      BIT(28)
+#define SST_TCA_INVERT_OUTPUT   BIT(29)
+#define SST_TRILINEAR           BIT(30)
+#define SST_SEQ_8_DOWNLD        BIT(31)
+
+
+// here are some abstract constants that most people will be using
+// TC stands for Texture Combine (RGB channels)
+// TCA stands for Texture Combine Alpha (just the Alpha channel)
+// BLEND_ATT blends on the Alpha channel of the color passed from TMU to TMU
+// BLEND_ALOCAL blends on the Alpha channel of the local texture color
+// NOTE: and of the BLEND modes can be modified using SST_TC_REVERSE_BLEND
+//       and/or SST_TCA_REVERSE_BLEND, these modifiers reverse the "polarity"
+//       of the blend
+#define SST_TC_MZERO  (SST_TC_MONE  | SST_TC_REVERSE_BLEND)
+#define SST_TCA_MZERO (SST_TCA_MONE | SST_TCA_REVERSE_BLEND)
+
+#define SST_TCOMBINE_SHIFT      12       // RGB COMBINE MODES
+#define SST_TCOMBINE            (0x1FF<<SST_TCOMBINE_SHIFT)
+#       define SST_TC_REPLACE    (SST_TC_ZERO_OTHER | SST_TC_ADD_CLOCAL)
+#       define SST_TC_PASS       (SST_TC_MONE)
+#       define SST_TC_ADD        (SST_TC_MONE  | SST_TC_ADD_CLOCAL)
+#       define SST_TC_SUB        (SST_TC_SUB_CLOCAL | SST_TC_MONE)
+#       define SST_TC_MULT       (SST_TC_MCLOCAL | SST_TC_REVERSE_BLEND)
+#       define SST_TC_ZERO       (SST_TC_MZERO)
+#       define SST_TC_ONE        (SST_TC_MZERO | SST_TC_INVERT_OUTPUT)
+#       define SST_TC_BLEND      (SST_TC_SUB_CLOCAL | SST_TC_ADD_CLOCAL)
+#       define SST_TC_BLEND_LOD         (SST_TC_BLEND | SST_TC_MLOD)
+#       define SST_TC_BLEND_LODFRAC     (SST_TC_BLEND | SST_TC_MLODFRAC)
+#       define SST_TC_BLEND_ATT         (SST_TC_BLEND | SST_TC_MAOTHER)
+#       define SST_TC_BLEND_ALOCAL      (SST_TC_BLEND | SST_TC_MALOCAL)
+#define SST_TACOMBINE_SHIFT     21      // ALPHA COMBINE MODES
+#define SST_TACOMBINE           (0x1FF<<SST_TACOMBINE_SHIFT)
+#       define SST_TCA_REPLACE   (SST_TCA_ZERO_OTHER | SST_TCA_ADD_CLOCAL)
+#       define SST_TCA_PASS      (SST_TCA_MONE)
+#       define SST_TCA_ADD       (SST_TCA_MONE  | SST_TCA_ADD_CLOCAL)
+#       define SST_TCA_SUB       (SST_TCA_SUB_CLOCAL | SST_TCA_MONE)
+#       define SST_TCA_MULT      (SST_TCA_MCLOCAL | SST_TCA_REVERSE_BLEND)
+#       define SST_TCA_ONE       (SST_TCA_MZERO | SST_TCA_INVERT_OUTPUT)
+#       define SST_TCA_ZERO      (SST_TCA_MZERO)
+#       define SST_TCA_BLEND     (SST_TCA_SUB_CLOCAL | SST_TCA_ADD_CLOCAL)
+#       define SST_TCA_BLEND_LOD        (SST_TCA_BLEND | SST_TCA_MLOD)
+#       define SST_TCA_BLEND_LODFRAC    (SST_TCA_BLEND | SST_TCA_MLODFRAC)
+#       define SST_TCA_BLEND_ATT        (SST_TCA_BLEND | SST_TCA_MAOTHER)
+#       define SST_TCA_BLEND_ALOCAL     (SST_TCA_BLEND | SST_TCA_MALOCAL)
+#define SST_TMU_ACTIVE(texMode) \
+        ((texMode & (SST_TCOMBINE|SST_TACOMBINE)) != (SST_TC_PASS|SST_TCA_PASS))
+#define SST_TREX_ACTIVE(texMode) SST_TMU_ACTIVE(texMode)
+
+//----------------- SST tLOD bits       -----------------------
+#define SST_LODMIN_SHIFT        0       // 4.2 format
+#define SST_LODMIN              (0x3F<<SST_LODMIN_SHIFT)
+#define SST_LODMAX_SHIFT        6
+#define SST_LODMAX              (0x3F<<SST_LODMAX_SHIFT)
+#define SST_LODBIAS_SHIFT       12
+#define SST_LODBIAS             (0x3F<<SST_LODBIAS_SHIFT)
+#define SST_LOD_ODD             BIT(18)
+#define SST_LOD_TSPLIT          BIT(19)
+#define SST_LOD_S_IS_WIDER      BIT(20)
+#define SST_LOD_ASPECT_SHIFT    21
+#define SST_LOD_ASPECT          (0x3<<SST_LOD_ASPECT_SHIFT)
+#define SST_LOD_ZEROFRAC        BIT(23)
+#define SST_TMULTIBASEADDR      BIT(24)
+#define SST_TDATA_SWIZZLE       BIT(25)
+#define SST_TDATA_SWAP          BIT(26)
+#define SST_TDIRECT_WRITE       BIT(27)
+
+//----------------- SST tDetail bits    -----------------------
+#define SST_DETAIL_MAX_SHIFT    0       // 8.0 format
+#define SST_DETAIL_MAX          (0xFF<<SST_DETAIL_MAX_SHIFT)
+#define SST_DETAIL_BIAS_SHIFT   8       // 6.0 format signed
+#define SST_DETAIL_BIAS         (0x3F<<SST_DETAIL_BIAS_SHIFT)
+#define SST_DETAIL_SCALE_SHIFT  14      // 3.0 format
+#define SST_DETAIL_SCALE        (0x7<<SST_DETAIL_SCALE_SHIFT)
+
+
+//----------------- SST fbzMode bits    -----------------------
+#define SST_ENRECTCLIP          BIT(0)
+#define SST_ENCHROMAKEY         BIT(1)
+#define SST_ENSTIPPLE           BIT(2)
+#define SST_WBUFFER             BIT(3)
+#define SST_ENDEPTHBUFFER       BIT(4)
+#       define SST_ZFUNC_LT     BIT(5)
+#       define SST_ZFUNC_EQ     BIT(6)
+#       define SST_ZFUNC_GT     BIT(7)
+#       define SST_ZFUNC_SHIFT  5
+#       define SST_ZFUNC        ( 0x7 << SST_ZFUNC_SHIFT )
+#define SST_ENDITHER            BIT(8)
+#define SST_RGBWRMASK           BIT(9)
+#define SST_ZAWRMASK            BIT(10)
+#define SST_DITHER2x2           BIT(11)
+#define SST_ENSTIPPLEPATTERN    BIT(12)
+#define SST_ENALPHAMASK         BIT(13)
+#define SST_DRAWBUFFER_SHIFT    14
+#define SST_DRAWBUFFER          (0x3<<SST_DRAWBUFFER_SHIFT)
+#define SST_DRAWBUFFER_FRONT            (0<<SST_DRAWBUFFER_SHIFT)
+#define SST_DRAWBUFFER_BACK             (1<<SST_DRAWBUFFER_SHIFT)
+#define SST_ENZBIAS             BIT(16)
+#define SST_YORIGIN             BIT(17)
+#define SST_ENALPHABUFFER       BIT(18)
+#define SST_ENDITHERSUBTRACT    BIT(19)
+#define SST_ABLEND_DITHER_SUB_EN SST_ENDITHERSUBTRACT
+#define SST_ENDITHERSUBTRACT    BIT(19)
+#define SST_ZCOMPARE_TO_ZACOLOR BIT(20)
+
+//----------------- SST fbzColorPath bits       -----------------------
+#define SST_RGBSELECT_SHIFT     0
+#define SST_RGBSELECT           (0x3<<SST_RGBSELECT_SHIFT)
+#       define SST_RGBSEL_RGBA          (0<<SST_RGBSELECT_SHIFT)
+#       define SST_RGBSEL_TMUOUT        (1<<SST_RGBSELECT_SHIFT)
+#       define SST_RGBSEL_TREXOUT       SST_RGBSEL_TMUOUT
+#       define SST_RGBSEL_C1            (2<<SST_RGBSELECT_SHIFT)
+#       define SST_RGBSEL_LFB           (3<<SST_RGBSELECT_SHIFT)
+#define SST_ASELECT_SHIFT       2
+#define SST_ASELECT             (0x3<<SST_ASELECT_SHIFT)
+#       define SST_ASEL_RGBA            (0<<SST_ASELECT_SHIFT)
+#       define SST_ASEL_TMUOUT          (1<<SST_ASELECT_SHIFT)
+#       define SST_ASEL_TREXOUT         SST_ASEL_TMUOUT
+#       define SST_ASEL_C1              (2<<SST_ASELECT_SHIFT)
+#       define SST_ASEL_LFB             (3<<SST_ASELECT_SHIFT)
+#define SST_LOCALSELECT_SHIFT   4
+#define SST_LOCALSELECT         BIT(4)
+#define SST_ALOCALSELECT_SHIFT  5
+#define SST_ALOCALSELECT        (0x3<<SST_ALOCALSELECT_SHIFT)
+#define SST_ALOCAL_ITERATOR             (0<<SST_ALOCALSELECT_SHIFT)
+#define SST_ALOCAL_C0                   (1<<SST_ALOCALSELECT_SHIFT)
+#define SST_ALOCAL_Z                    (2<<SST_ALOCALSELECT_SHIFT)
+#define SST_LOCALSELECT_OVERRIDE_WITH_ATEX      BIT(7)
+#define SST_CC_ZERO_OTHER       BIT(8)
+#define SST_CC_SUB_CLOCAL       BIT(9)
+#define SST_CC_MSELECT_SHIFT    10
+#define SST_CC_MSELECT          (0x7<<SST_CC_MSELECT_SHIFT)
+#       define SST_CC_MONE              (0<<SST_CC_MSELECT_SHIFT)
+#       define SST_CC_MCLOCAL           (1<<SST_CC_MSELECT_SHIFT)
+#       define SST_CC_MAOTHER           (2<<SST_CC_MSELECT_SHIFT)
+#       define SST_CC_MALOCAL           (3<<SST_CC_MSELECT_SHIFT)
+#       define SST_CC_MATMU             (4<<SST_CC_MSELECT_SHIFT)
+#       define SST_CC_MATREX            SST_CC_MATMU
+#define SST_CC_REVERSE_BLEND    BIT(13)
+#define SST_CC_ADD_CLOCAL       BIT(14)
+#define SST_CC_ADD_ALOCAL       BIT(15)
+#define SST_CC_INVERT_OUTPUT    BIT(16)
+#define SST_CCA_ZERO_OTHER      BIT(17)
+#define SST_CCA_SUB_CLOCAL      BIT(18)
+#define SST_CCA_MSELECT_SHIFT   19
+#define SST_CCA_MSELECT         (0x7<<SST_CCA_MSELECT_SHIFT)
+#       define SST_CCA_MONE             (0<<SST_CCA_MSELECT_SHIFT)
+#       define SST_CCA_MCLOCAL          (1<<SST_CCA_MSELECT_SHIFT)
+#       define SST_CCA_MAOTHER          (2<<SST_CCA_MSELECT_SHIFT)
+#       define SST_CCA_MALOCAL          (3<<SST_CCA_MSELECT_SHIFT)
+#       define SST_CCA_MATMU            (4<<SST_CCA_MSELECT_SHIFT)
+#       define SST_CCA_MATREX           SST_CCA_MATMU
+#define SST_CCA_REVERSE_BLEND   BIT(22)
+#define SST_CCA_ADD_CLOCAL      BIT(23)
+#define SST_CCA_ADD_ALOCAL      BIT(24)
+#define SST_CCA_INVERT_OUTPUT   BIT(25)
+#define SST_PARMADJUST          BIT(26)
+#define SST_ENTEXTUREMAP        BIT(27)
+
+
+// here are some abstract constants that most people will be using
+// CC stands for Color Combine (RGB channels)
+// CCA stands for Color Combine Alpha (just the Alpha channel)
+// BLEND_ATT blends on the Alpha channel of the color passed from TMU to TMU
+// BLEND_ALOCAL blends on the Alpha channel of the local texture color
+// NOTE: and of the BLEND modes can be modified using SST_CC_REVERSE_BLEND
+//       and/or SST_CCA_REVERSE_BLEND, these modifiers reverse the "polarity"
+//       of the blend
+#define SST_CC_MZERO  (SST_CC_MONE  | SST_CC_REVERSE_BLEND)
+#define SST_CCA_MZERO (SST_CCA_MONE | SST_CCA_REVERSE_BLEND)
+
+#define SST_CCOMBINE_SHIFT      8       // RGB COMBINE MODES
+#define SST_CCOMBINE            (0x1FF<<SST_CCOMBINE_SHIFT)
+#       define SST_CC_REPLACE    (SST_CC_ZERO_OTHER | SST_CC_ADD_CLOCAL)
+#       define SST_CC_PASS       (SST_CC_MONE)
+#       define SST_CC_ADD        (SST_CC_MONE  | SST_CC_ADD_CLOCAL)
+#       define SST_CC_SUB        (SST_CC_SUB_CLOCAL | SST_CC_MONE)
+#       define SST_CC_MULT       (SST_CC_MCLOCAL | SST_CC_REVERSE_BLEND)
+#       define SST_CC_ZERO       (SST_CC_MZERO)
+#       define SST_CC_ONE        (SST_CC_MZERO | SST_CC_INVERT_OUTPUT)
+#       define SST_CC_BLEND      (SST_CC_SUB_CLOCAL | SST_CC_ADD_CLOCAL)
+#       define SST_CC_BLEND_ATT         (SST_CC_BLEND | SST_CC_MAOTHER)
+#       define SST_CC_BLEND_ATEX        (SST_CC_BLEND | SST_CC_MATMU)
+#       define SST_CC_BLEND_ATEX_REV    (SST_CC_BLEND | SST_CC_MATMU | SST_CC_REVERSE_BLEND)
+#       define SST_CC_BLEND_ATT_REV     (SST_CC_BLEND | SST_CC_MAOTHER | SST_CC_REVERSE_BLEND)
+#       define SST_CC_BLEND_ALOCAL      (SST_CC_BLEND | SST_CC_MALOCAL)
+#define SST_CACOMBINE_SHIFT     17      // ALPHA COMBINE MODES
+#define SST_CACOMBINE           (0x1FF<<SST_CACOMBINE_SHIFT)
+#       define SST_CCA_REPLACE   (SST_CCA_ZERO_OTHER | SST_CCA_ADD_CLOCAL)
+#       define SST_CCA_PASS      (SST_CCA_MONE)
+#       define SST_CCA_ADD       (SST_CCA_MONE  | SST_CCA_ADD_CLOCAL)
+#       define SST_CCA_SUB       (SST_CCA_SUB_CLOCAL | SST_CCA_MONE)
+#       define SST_CCA_MULT      (SST_CCA_MCLOCAL | SST_CCA_REVERSE_BLEND)
+#       define SST_CCA_ONE       (SST_CCA_MZERO | SST_CCA_INVERT_OUTPUT)
+#       define SST_CCA_ZERO      (SST_CCA_MZERO)
+#       define SST_CCA_BLEND     (SST_CCA_SUB_CLOCAL | SST_CCA_ADD_CLOCAL)
+#       define SST_CCA_BLEND_ATT        (SST_CCA_BLEND | SST_CCA_MAOTHER)
+#       define SST_CCA_BLEND_ATEX       (SST_CCA_BLEND | SST_CCA_MATMU)
+#       define SST_CCA_BLEND_ATEX_REV   (SST_CCA_BLEND | SST_CCA_MATMU | SST_CCA_REVERSE_BLEN)
+#       define SST_CCA_BLEND_ATT_REV    (SST_CCA_BLEND | SST_CCA_MAOTHER | SST_CCA_REVERSE_BLEND)
+#       define SST_CCA_BLEND_ALOCAL     (SST_CCA_BLEND | SST_CCA_MALOCAL)
+
+
+//----------------- SSTfogMode bits     -----------------------
+#define SST_ENFOGGING           BIT(0)  // Afog*Cfog + (1-Afog)*Color
+#define SST_FOGADD              BIT(1)  // generates (1-Afog)*Color
+#define SST_FOGMULT             BIT(2)  // generates Afog*Cfog
+#define SST_FOG_ALPHA           BIT(3)  // use Alpha iterator to control fog
+#define SST_FOG_Z               BIT(4)  // use Z iterator to control fog
+#define SST_FOG_CONSTANT        BIT(5)  // simply add Cfog to color and clamp
+
+//----------------- SST alphaMode bits  -----------------------
+#define SST_ENALPHAFUNC         BIT(0)
+#define SST_ALPHAFNC_SHIFT      1
+#define SST_ALPHAFUNC_SHIFT      1
+#       define SST_ALPHAFUNC_LT BIT(1)
+#       define SST_ALPHAFUNC_EQ BIT(2)
+#       define SST_ALPHAFUNC_GT BIT(3)
+#   define SST_ALPHAFNC     ( 0x7 << SST_ALPHAFNC_SHIFT )
+#   define SST_ALPHAFUNC    ( 0x7 << SST_ALPHAFUNC_SHIFT )
+#define SST_ENALPHABLEND        BIT(4)
+#define SST_ENANTIALIAS         BIT(5)
+#define SST_RGBSRCFACT_SHIFT    8       // RGB source factor
+#define SST_RGBSRCFACT          (0xF<<SST_RGBSRCFACT_SHIFT)
+#       define SST_A_ZERO       0
+#       define SST_A_SRCALPHA   1
+#       define SST_A_COLOR      2
+#       define SST_A_DSTALPHA   3
+#       define SST_A_ONE        4
+#       define SST_AOM_SRCALPHA 5
+#       define SST_AOM_COLOR    6
+#       define SST_AOM_DSTALPHA 7
+#       define SST_A_SATURATE   0xF     // for SRC factor only
+#       define SST_A_COLORBEFOREFOG 0xF // for DST factor only
+#define SST_RGBDSTFACT_SHIFT    12      // RGB destination factor
+#define SST_RGBDSTFACT          (0xF<<SST_RGBDSTFACT_SHIFT)
+#define SST_ASRCFACT_SHIFT      16      // A source factor
+#define SST_ASRCFACT            (0xF<<SST_ASRCFACT_SHIFT)
+#define SST_ADSTFACT_SHIFT      20      // A destination factor
+#define SST_ADSTFACT            (0xF<<SST_ADSTFACT_SHIFT)
+#define SST_ALPHAREF_SHIFT      24
+#define SST_ALPHAREF            (0xFF<<SST_ALPHAREF_SHIFT)
+
+//---------------- SST zaColor bits ----------------------
+#define SST_ZACOLOR_DEPTH_SHIFT   0
+#define SST_ZACOLOR_DEPTH         ( 0xFFFF << SST_ZACOLOR_DEPTH_SHIFT )
+#define SST_ZACOLOR_ALPHA_SHIFT   24
+#define SST_ZACOLOR_ALPHA         ( 0xFF << SST_ZACOLOR_ALPHA_SHIFT )
+
+//----------------- SST clip bits ------------------------
+//clipLeftRight
+#define SST_CLIPLEFT_SHIFT        16
+#define SST_CLIPRIGHT_SHIFT       0
+//clipBottomTop
+#define SST_CLIPBOTTOM_SHIFT      16
+#define SST_CLIPTOP_SHIFT         0
+
+//----------------- SST status bits     -----------------------
+#define SST_FIFOLEVEL           0x3F
+#define SST_VRETRACE            BIT(6)
+#define SST_FBI_BUSY            BIT(7)
+#define SST_TMU_BUSY            BIT(8)
+#define SST_TREX_BUSY           SST_TMU_BUSY
+#define SST_BUSY                BIT(9)
+#define SST_DISPLAYED_BUFFER_SHIFT 10
+#define SST_DISPLAYED_BUFFER    (0x3<<SST_DISPLAYED_BUFFER_SHIFT)
+#define SST_MEMFIFOLEVEL_SHIFT  12
+#define SST_MEMFIFOLEVEL        (0xFFFF<<SST_MEMFIFOLEVEL_SHIFT)
+#define SST_SWAPBUFPENDING_SHIFT 28
+#define SST_SWAPBUFPENDING      (0x7<<SST_SWAPBUFPENDING_SHIFT)
+#define SST_PCIINTERRUPTED      BIT(31)
+//----------------- SST fbiInit*        -----------------------
+// fbiInit0
+#define SST_EN_VGA_PASSTHRU     BIT(0)
+#define SST_PCI_FIFO_LWM_SHIFT  6
+#define SST_PCI_FIFO_LWM        (0x1F<<SST_PCI_FIFO_LWM_SHIFT)
+#define SST_EN_LFB_MEMFIFO      BIT(11)
+#define SST_EN_TEX_MEMFIFO      BIT(12)
+#define SST_MEM_FIFO_EN         BIT(13)
+#define SST_MEM_FIFO_HWM_SHIFT  14
+#define SST_MEM_FIFO_HWM        (0x7FF<<SST_MEM_FIFO_HWM_SHIFT)
+#define SST_MEM_FIFO_BURST_HWM_SHIFT    25
+#define SST_MEM_FIFO_BURST_HWM  (0x3F<<SST_MEM_FIFO_BURST_HWM_SHIFT)
+// fbiInit1
+#define SST_PCI_WRWS_0                  0x0
+#define SST_PCI_WRWS_1                  BIT(1)
+#define SST_LFB_READ_EN                 BIT(3)
+#define SST_VIDEO_TILES_IN_X_SHIFT      4
+#define SST_VIDEO_TILES_IN_X            (0xF<<SST_VIDEO_TILES_IN_X_SHIFT)
+#       define SST_VIDEO_TILES_IN_X_448         (7<<SST_VIDEO_TILES_IN_X_SHIFT)
+#       define SST_VIDEO_TILES_IN_X_512         (8<<SST_VIDEO_TILES_IN_X_SHIFT)
+#       define SST_VIDEO_TILES_IN_X_640         (10<<SST_VIDEO_TILES_IN_X_SHIFT)
+#       define SST_VIDEO_TILES_IN_X_832         (13<<SST_VIDEO_TILES_IN_X_SHIFT)
+#       define SST_VIDEO_TILES_IN_X_800 SST_VIDEO_TILES_IN_X_832
+#define SST_VIDEO_RESET                 BIT(8)
+#define SST_VIDEO_RUN                   0
+#define SST_VIDEO_STOP                  BIT(8)
+#define SST_HVSYNC_OVERRIDE             BIT(9)
+#define SST_HSYNC_OVERRIDE_VAL          BIT(10)
+#define SST_VSYNC_OVERRIDE_VAL          BIT(11)
+#define SST_VIDEO_BLANK_EN              BIT(12)
+#define SST_VIDEO_DATA_OE_EN            BIT(13)
+#define SST_VIDEO_BLANK_OE_EN           BIT(14)
+#define SST_VIDEO_HVSYNC_OE_EN          BIT(15)
+#define SST_VIDEO_DCLK_OE_EN            BIT(16)
+#define SST_VIDEO_VID_CLK_SEL           BIT(17)
+#define SST_VIDEO_VID_CLK_2X            0x0
+#define SST_VIDEO_VID_CLK_SLAVE         BIT(17)
+#define SST_VIDEO_VCLK_2X_INPUT_DEL_SHIFT 18
+#define SST_VIDEO_VCLK_2X_INPUT_DEL     (0x3<<SST_VIDEO_VCLK_2X_INPUT_DEL_SHIFT)
+#define SST_VIDEO_VCLK_SEL_SHIFT        20
+#       define SST_VIDEO_VCLK_SEL               (0x3<<SST_VIDEO_VCLK_SEL_SHIFT)
+#       define SST_VIDEO_VCLK_DIV2              (0x1<<SST_VIDEO_VCLK_SEL_SHIFT)
+#define SST_VIDEO_24BPP_EN              BIT(22)
+#define SST_EN_SCANLINE_INTERLEAVE      BIT(23)
+#define SST_VIDEO_FILTER_EN             BIT(25)
+#define SST_VIDEO_INVERT_VID_CLK_2X     BIT(26)
+#define SST_VIDEO_VCLK_2X_OUTPUT_DEL_SHIFT 27
+#       define SST_VIDEO_VCLK_2X_OUTPUT_DEL     (0x3<<SST_VIDEO_VCLK_2X_OUTPUT_DEL_SHIFT)
+#define SST_VIDEO_VCLK_DEL_SHIFT        29
+#       define SST_VIDEO_VCLK_DEL               (0x3<<SST_VIDEO_VCLK_DEL_SHIFT)
+#define SST_DISEN_RD_AHEAD_WR_RD        BIT(31)
+#define SST_VIDEO_MASK                  0x7e7ffe00
+// fbiInit2
+#define SST_VIDEO_DITHER_SUB_EN         BIT(0)
+#define SST_DRAM_BANKING_CONFIG         BIT(1)
+#define SST_EN_TRIPLE_BUFFERING         BIT(4)
+#define SST_EN_FAST_RAS_READ            BIT(5)
+#define SST_EN_OE_GEN                   BIT(6)
+#define SST_EN_FAST_RD_AHEAD_WR         BIT(7)
+#define SST_EN_DITHER_PASSTHRU          BIT(8)
+#define SST_SWAP_ALGORITHM_SHIFT        9
+#define SST_SWAP_ALGORITHM              (0x3<<SST_SWAP_ALGORITHM_SHIFT)
+#       define SST_SWAP_VSYNC                   (0<<SST_SWAP_ALGORITHM_SHIFT)
+#       define SST_SWAP_DACDATA0                (1<<SST_SWAP_ALGORITHM_SHIFT)
+#       define SST_SWAP_FIFOSTALL               (2<<SST_SWAP_ALGORITHM_SHIFT)
+#define SST_VIDEO_BUFFER_OFFSET_SHIFT   11
+#define SST_VIDEO_BUFFER_OFFSET         (0x1FF<<SST_VIDEO_BUFFER_OFFSET_SHIFT)
+#       define SST_VIDEO_BUFFER_OFFSET_448      (77<<SST_VIDEO_BUFFER_OFFSET_SHIFT)
+#       define SST_VIDEO_BUFFER_OFFSET_512      (96<<SST_VIDEO_BUFFER_OFFSET_SHIFT)
+#       define SST_VIDEO_BUFFER_OFFSET_640      (150<<SST_VIDEO_BUFFER_OFFSET_SHIFT)
+#       define SST_VIDEO_BUFFER_OFFSET_832      (247<<SST_VIDEO_BUFFER_OFFSET_SHIFT)
+#define SST_VIDEO_BUFFER_OFFSET_800     SST_VIDEO_BUFFER_OFFSET_832
+#define SST_EN_DRAM_BANKED              BIT(20)
+#define SST_EN_DRAM_RD_AHEAD_FIFO       BIT(21)
+#define SST_EN_DRAM_REFRESH             BIT(22)
+#define SST_DRAM_REFRESH_CNTR_SHIFT     23
+#       define SST_DRAM_REFRESH_CNTR            (0x1FF<<SST_DRAM_REFRESH_CNTR_SHIFT)
+// fbiInit3
+#define SST_ALT_REGMAPPING              BIT(0)
+#define SST_VIDEO_FIFO_THRESH_SHIFT     1
+#       define SST_VIDEO_FIFO_THRESH            (0x1F<<SST_VIDEO_FIFO_THRESH_SHIFT)
+#define SST_YORIGIN_TOP_SHIFT           22
+#       define SST_YORIGIN_TOP                  (0x3FF<<SST_YORIGIN_TOP_SHIFT)
+#define SST_YORIGIN_SUBVAL_SHIFT        SST_YORIGIN_TOP_SHIFT
+#define SST_YORIGIN_SUBVAL                      (0x3FF<<SST_YORIGIN_SUBVAL_SHIFT)
+
+//----------------- SST dacData bits    -----------------------
+#define SST_DACDATA_DATA                (0xFF)
+#define SST_DACDATA_ADDR_SHIFT          8
+#define SST_DACDATA_ADDR                (0x7<<SST_DACDATA_ADDR_SHIFT)
+#define SST_DACDATA_RD                  BIT(11)
+#define SST_DACDATA_WR                  0x0
+
+//----------------- swapBufferCMD bits    ---------------------
+#define SST_SWAP_EN_WAIT_ON_VSYNC       BIT(0)
+#define SST_SWAP_BUFFER_INTERVAL_SHIFT  1
+#define SST_SWAP_BUFFER_INTERVAL        (0xff << SST_SWAP_BUFFER_INTERVAL_SHIFT)
+
+//----------------- SST Configuration Registers ---------------
+#define SST_MEMBASE_ADDR                0x10
+#define SST_INIT_ENABLE                 0x40
+#define SST_BUS_SNOOP0                  0x44
+#define SST_BUS_SNOOP1                  0x48
+#define SST_CFG_STATUS                  0x4c
+
+//----------------- SST Remapped Registers --------------------
+#define SST_DAC_RD_DATA                 0x00000218
+#define SST_VIDEO_CHECKSUM              0x0000021c
+
+//----------------- SST initEnable (Config register) bits   ---
+#define SST_INITWR_EN                   BIT(0)
+#define SST_PCI_FIFOWR_EN               BIT(1)
+#define SST_FBIINIT23_REMAP             BIT(2)
+#define SST_SNOOP0_EN                   BIT(4)
+#define SST_SNOOP0_IO                   BIT(5)
+#define SST_SNOOP0_RD                   BIT(6)
+#define SST_SNOOP1_EN                   BIT(7)
+#define SST_SNOOP1_IO                   BIT(8)
+#define SST_SNOOP1_RD                   BIT(9)
+#define SST_SCANLINE_SLV_OWNPCI         BIT(10)
+#define SST_SCANLINE_SLI_SLV            BIT(11)
+
+//----------------- Other---------------------------------------
+#define SST_LFB_ADDR            BIT(22)
+#define SST_TEX_ADDR            BIT(23)
+
+//----------------- SST vRetrace bits ---------------------
+#define SST_VRETRACE_VSYNC_OFF  0xff
+
+//----------------- SST hSync bits ------------------------
+#define SST_HSYNC_ON            0xff
+#define SST_HSYNC_OFF_SHIFT     16
+#define SST_HSYNC_OFF           (0x3ff << SST_HSYNCOFF_SHIFT)
+
+//----------------- SST vSync bits ------------------------
+#define SST_VSYNC_ON            0xff
+#define SST_VSYNC_OFF_SHIFT     16
+#define SST_VSYNC_OFF           (0xfff << SST_VSYNC_OFF_SHIFT)
+
+//----------------- SST backPorch bits
+#define SST_HBACKPORCH          0xff
+#define SST_VBACKPORCH_SHIFT    16
+#define SST_VBACKPORCH          (0xff << SST_VBACKPORCH_SHIFT)
+
+//----------------- SST videoDimensionS Register
+#define SST_VIDEODIMENSIONS_X   0x3ff
+#define SST_VIDEODIMENSIONS_Y_SHIFT 16
+#define SST_VIDEODIMENSIONS_Y   0x3ff
+
+
+//----------------- SST chip layout     -----------------------
+// registers are in groups of 8 for easy decode
+typedef struct sstregs {        // THE CHIP
+#ifndef SST96
+                                // EXTERNAL registers
+    unsigned long status;       // chip status, Read Only
+    unsigned long reserved0;
+    vtxRec vA;          // Vertex A,B,C
+    vtxRec vB;
+    vtxRec vC;
+
+    long r;             // 12.12        Parameters
+    long g;             // 12.12
+    long b;             // 12.12
+    long z;             // 20.12
+    long a;             // 12.12
+    long s;             // 14.18
+    long t;             // 14.18
+    long w;             //  2.30
+
+    long drdx;                  // X Gradients
+    long dgdx;
+    long dbdx;
+    long dzdx;
+    long dadx;
+    long dsdx;
+    long dtdx;
+    long dwdx;
+
+    long drdy;                  // Y Gradients
+    long dgdy;
+    long dbdy;
+    long dzdy;
+    long dady;
+    long dsdy;
+    long dtdy;
+    long dwdy;
+
+    unsigned long triangleCMD;  // execute a triangle command (float)
+    unsigned long reserved1;
+    vtxRec FvA;                 // floating point version
+    vtxRec FvB;
+    vtxRec FvC;
+
+    long Fr;                    // floating point version
+    long Fg;
+    long Fb;
+    long Fz;
+    long Fa;
+    long Fs;
+    long Ft;
+    long Fw;
+
+    long Fdrdx;
+    long Fdgdx;
+    long Fdbdx;
+    long Fdzdx;
+    long Fdadx;
+    long Fdsdx;
+    long Fdtdx;
+    long Fdwdx;
+
+    long Fdrdy;
+    long Fdgdy;
+    long Fdbdy;
+    long Fdzdy;
+    long Fdady;
+    long Fdsdy;
+    long Fdtdy;
+    long Fdwdy;
+
+    unsigned long FtriangleCMD;         // execute a triangle command
+    unsigned long fbzColorPath;         // color select and combine
+    unsigned long fogMode;              // fog Mode
+    unsigned long alphaMode;            // alpha Mode
+    unsigned long fbzMode;              // framebuffer and Z mode
+    unsigned long lfbMode;              // linear framebuffer Mode
+    unsigned long clipLeftRight;        // (6)10(6)10
+    unsigned long clipBottomTop;        // (6)10(6)10
+
+    unsigned long nopCMD;       // execute a nop command
+    unsigned long fastfillCMD;  // execute a fast fill command
+    unsigned long swapbufferCMD;// execute a swapbuffer command
+    unsigned long fogColor;             // (8)888
+    unsigned long zaColor;              // 8(8)16
+    unsigned long chromaKey;            // (8)888
+    unsigned long reserved2;
+    unsigned long reserved3;
+
+    unsigned long stipple;              // 32 bits, MSB masks pixels
+    unsigned long c0;                   // 8.8.8.8 (ARGB)
+    unsigned long c1;                   // 8.8.8.8 (ARGB)
+    struct {                            // statistic gathering variables
+        unsigned int fbiPixelsIn;
+        unsigned int fbiChromaFail;
+        unsigned int fbiZfuncFail;
+        unsigned int fbiAfuncFail;
+        unsigned int fbiPixelsOut;
+    } stats;
+
+    unsigned long fogTable[32];         // 64 entries, 2 per word, 2 bytes each
+
+    unsigned long reserved8[8];
+
+    unsigned long fbiInit4;
+    unsigned long vRetrace;
+    unsigned long backPorch;
+    unsigned long videoDimensions;
+    unsigned long fbiInit0;
+    unsigned long fbiInit1;
+    unsigned long fbiInit2;
+    unsigned long fbiInit3;
+
+    unsigned long hSync;
+    unsigned long vSync;
+    unsigned long clutData;
+    unsigned long dacData;
+    unsigned long videoFilterRgbThreshold;
+    unsigned long reserved35[35];       // reserved51 became reserved35,
+                                        // Grabbed remaining 16 for sst-96
+    
+   
+//========================================================================
+// Please treat as the SST-96 area.
+// These belong in the SST_CHROMARANGE register
+#define SST_CHROMARANGE_BLUE_EX         BIT(24) // Blue value in exclusive mode
+#define SST_CHROMARANGE_GREEN_EX        BIT(25) // Green value in exclusive mode
+#define SST_CHROMARANGE_RED_EX          BIT(26) // Red  value in exclusive mode
+#define SST_CHROMARANGE_BLOCK_OR        BIT(27) // Union of all colors.
+#define SST_ENCHROMARANGE               BIT(28)
+
+// These belong in the clipLeftRight and clipTopBottom Registers.
+#define SST_ENRECTCLIP01                BIT(31) // 
+#define SST_RECTCLIP_EX                 BIT(31) //
+
+// Just to unconfuse myself:
+//
+//      CHIP            FBI-REV TMU-REV DEV-ID
+//      SST1-0.6u       1       0       1
+//      SST1-0.5u       2       1       1
+//      SST-96          1       (1)     2
+//
+//      SST96h2 == H2
+//      SST97   == H3
+#define SST_DEVICE_ID_SST1      1
+#define SST_DEVICE_ID_SST96     2
+#define SST_DEVICE_ID_SST96h2   3
+#define SST_DEVICE_ID_SST97     4
+
+
+    unsigned long chromaRange;          // SST-96 specific
+    unsigned long clipLeftRight1;       // SST-96 specific
+    unsigned long clipBottomTop1;       // SST-96 specific
+    unsigned long colBufferSetup;       // SST-96 specific
+    unsigned long auxBufferSetup;       // SST-96 specific
+    unsigned long texChipSel;           // SST-96 specific
+    unsigned long swapPendCmd;          // SST-96 specific
+    unsigned long reservedSST96[9];     // SST-96 specific
+    
+// End SST-96 area
+//========================================================================
+
+    unsigned long textureMode;          // texture Mode
+    unsigned long tLOD;                 // texture LOD settings
+    unsigned long tDetail;              // texture detail settings
+    unsigned long texBaseAddr;          // current texture base address
+    unsigned long texBaseAddr1;
+    unsigned long texBaseAddr2;
+    unsigned long texBaseAddr38;
+    unsigned long trexInit0;            // hardware init bits
+    unsigned long trexInit1;            // hardware init bits
+   
+    unsigned long nccTable0[12];        // NCC decode tables, bits are packed
+    unsigned long nccTable1[12];        // 4 words Y, 4 words I, 4 words Q
+
+#else
+                                /* EXTERNAL registers */
+    unsigned long status;       /* chip status, Read Only */
+    unsigned long reserved001;  /* reserved001 */
+
+    /* Fixed point version */
+    vtxRec vA;                 /* Vertex A,B,C */
+    vtxRec vB;
+    vtxRec vC;
+
+    /* Parameters, X gradients, Y gradients */
+    long r;                     /* 12.12 */
+    long drdx;                  /* 12.12 */
+    long drdy;
+    long g;
+    long dgdx;
+    long dgdy;
+    long b;
+    long dbdx;
+
+    long dbdy;
+    long z;                     /* 20.12 */
+    long dzdx;                  /* 20.12 */
+    long dzdy;                  /* ??? 12.12 */              
+    long a;                     /* 12.12 */
+    long dadx;                  /* 12.12 */
+    long dady;
+    long s;                     /* 14.18 */
+
+    long dsdx;                  /* 14.18 */
+    long dsdy;
+    long t;
+    long dtdx;
+    long dtdy;
+    long w;                     /* 2.30 */
+    long dwdx;                  /* 2.30 */
+    long dwdy;
+
+    unsigned long triangleCMD;  /* execute a triangle command (fixed) */
+    unsigned long reserved021;
+
+    /* Floating point version */
+    vtxRec FvA;
+    vtxRec FvB;
+    vtxRec FvC;
+
+    /* Parameters, X gradients, Y gradients */
+    float Fr;
+    float Fdrdx;
+    float Fdrdy;
+    float Fg;
+    float Fdgdx;
+    float Fdgdy;
+    float Fb;
+    float Fdbdx;
+
+    float Fdbdy;
+    float Fz;
+    float Fdzdx;
+    float Fdzdy;
+    float Fa;
+    float Fdadx;
+    float Fdady;
+    float Fs;
+
+    float Fdsdx;
+    float Fdsdy;
+    float Ft;
+    float Fdtdx;
+    float Fdtdy;
+    float Fw;
+    float Fdwdx;
+    float Fdwdy;
+
+    /* commands except for triangleCMD */
+    unsigned long FtriangleCMD; /* execute a triangle command (float) */
+    unsigned long reserved041;  /* required cmd spacer for SST-96 */
+    unsigned long nopCMD;       /* execute a nop command */
+    unsigned long reserved043;  /* required cmd spacer for SST-96 */
+    unsigned long fastfillCMD;  /* execute a fast fill command */
+    unsigned long reserved045;  /* required cmd spacer for SST-96 */
+    unsigned long swapbufferCMD; /* execute a swapbuffer command */
+    unsigned long reserved047;  /* required cmd spacer for SST-96 */
+                                
+    unsigned long swappendCMD;  /* increment swap pending count */
+    unsigned long reserved049;  /* required cmd spacer for SST-96 */
+    unsigned long reserved04A[6]; /* 0x04A to 0x04F */
+                                
+                                /* state registers */
+    unsigned long fbzColorPath; /* color select and combine */
+    unsigned long fogMode;      /* fog Mode */
+    unsigned long alphaMode;    /* alpha Mode */
+                                unsigned long reserved053;
+    unsigned long fbzMode;      /* color and auxiliary buffer control */
+    unsigned long stipple;      /* 32 bits, MSB masks pixels */
+    unsigned long c0;           /* 8.8.8.8 (ARGB) */
+    unsigned long c1;           /* 8.8.8.8 (ARGB) */
+                                
+    unsigned long fogColor;     /* (8)888 */
+    unsigned long zaColor;      /* 8(8)16 */
+    unsigned long chromaKey;    /* (8)888 */
+    unsigned long chromaRange;  /* Chroma Range compare Values, Modes & Enable */
+    unsigned long reserved05C[4]; /* 0x05C to 0x05F */
+                                
+    unsigned long colBufferSetup; /* color buffer base address, stride, and mode */
+    unsigned long auxBufferSetup; /* auxiliary buffer base address, stride */
+    unsigned long clipLeftRight; /* (6)10(6)10 */
+    unsigned long clipBottomTop; /* (6)10(6)10 */
+    unsigned long clipLeftRight1; /* (6)10(6)10 */
+    unsigned long clipBottomTop1; /* (6)10(6)10 */
+    unsigned long reserved066[10]; /* 0x066 to 0x06F */
+                                
+    unsigned long fogTable[32]; /* 64 entries, 2 per word, 2 bytes each */
+                                
+    unsigned long fbijrInit0;   /* FBIjr Hardware Init 0 - General */
+    unsigned long fbijrInit1;   /* FBIjr Hardware Init 1 - PUMA */
+    unsigned long fbijrInit2;   /* FBIjr Hardware Init 2 - MEM FIFO Setup */
+    unsigned long fbijrInit3;   /* FBIjr Hardware Init 3 - CMD FIFO Setup */
+    unsigned long fbijrInit4;   /* FBIjr Hardware Init 4 - CMD FIFO Entry Count */
+    unsigned long fbijrInit5;   /* FBIjr Hardware Init 5 - CMD FIFO Read Pointer */
+    unsigned long reserved096[10]; /* 0x096 to 0x09F */
+                                
+    unsigned long fbijrVersion; /* FBIjr Version (company, device, & board */
+    struct {                    /* statistic gathering variables */
+      unsigned int fbiPixelsIn; /* Pixel counter (number pixels processed) */
+      unsigned int fbiChromaFail; /* Pixel counter (number pixels failed Chroma test) */
+      unsigned int fbiZfuncFail; /* Pixel counter (number pixels failed Z test) */
+      unsigned int fbiAfuncFail; /* Pixel counter (number pixels failed Alpha test) */
+      unsigned int fbiPixelsOut; /* Pixel counter (number pixels drawn) */
+    } stats;
+    unsigned long reserved0A6[10]; /* 0x0A6 to 0x0AF */
+
+    unsigned long reserved0B0[15];  /* 0x0B0 to 0x0BE */
+    unsigned long texChipSel;       /* Texture Write Chip select */
+
+    /* TMU registers */
+    unsigned long textureMode;      /* texture Mode */
+    unsigned long tLOD;             /* texture LOD settings */
+    unsigned long tDetail;          /* texture detail settings */
+    unsigned long texBaseAddr;      /* current texture base address */
+    unsigned long texBaseAddr1;
+    unsigned long texBaseAddr2;
+    unsigned long texBaseAddr38;
+    unsigned long trexInit0;        /* hardware init bits */
+    unsigned long trexInit1;        /* hardware init bits */
+    unsigned long nccTable0[12];    /* NCC decode tables, bits are packed */
+    unsigned long nccTable1[12];    /* 4 words Y, 4 words I, 4 words Q */
+
+    unsigned long reserved0E1[31];  /* 0x0E1 to 0x0FF */
+#endif
+} Sstregs;
+
+#ifndef SST96
+// Here are the defines for the alternate register mappings
+#define r_ALT           r
+#define drdx_ALT        g
+#define drdy_ALT        b
+#define g_ALT           z
+#define dgdx_ALT        a
+#define dgdy_ALT        s
+#define b_ALT           t
+#define dbdx_ALT        w
+
+#define dbdy_ALT        drdx
+#define z_ALT           dgdx
+#define dzdx_ALT        dbdx
+#define dzdy_ALT        dzdx
+#define a_ALT           dadx
+#define dadx_ALT        dsdx
+#define dady_ALT        dtdx
+#define s_ALT           dwdx
+
+#define dsdx_ALT        drdy
+#define dsdy_ALT        dgdy
+#define t_ALT           dbdy
+#define dtdx_ALT        dzdy
+#define dtdy_ALT        dady
+#define w_ALT           dsdy
+#define dwdx_ALT        dtdy
+#define dwdy_ALT        dwdy
+
+#define Fr_ALT          Fr
+#define Fdrdx_ALT       Fg
+#define Fdrdy_ALT       Fb
+#define Fg_ALT          Fz
+#define Fdgdx_ALT       Fa
+#define Fdgdy_ALT       Fs
+#define Fb_ALT          Ft
+#define Fdbdx_ALT       Fw
+
+#define Fdbdy_ALT       Fdrdx
+#define Fz_ALT          Fdgdx
+#define Fdzdx_ALT       Fdbdx
+#define Fdzdy_ALT       Fdzdx
+#define Fa_ALT          Fdadx
+#define Fdadx_ALT       Fdsdx
+#define Fdady_ALT       Fdtdx
+#define Fs_ALT          Fdwdx
+
+#define Fdsdx_ALT       Fdrdy
+#define Fdsdy_ALT       Fdgdy
+#define Ft_ALT          Fdbdy
+#define Fdtdx_ALT       Fdzdy
+#define Fdtdy_ALT       Fdady
+#define Fw_ALT          Fdsdy
+#define Fdwdx_ALT       Fdtdy
+#define Fdwdy_ALT       Fdwdy
+#else
+// Here are the defines for the alternate register mappings
+#define r_ALT           r
+#define drdx_ALT        drdx
+#define drdy_ALT        drdy
+#define g_ALT           c
+#define dgdx_ALT        dgdx
+#define dgdy_ALT        dgdy
+#define b_ALT           b
+#define dbdx_ALT        dbdx
+
+#define dbdy_ALT        dbdy
+#define z_ALT           zgdx
+#define dzdx_ALT        dzdx
+#define dzdy_ALT        dzdy
+#define a_ALT           a
+#define dadx_ALT        dadx
+#define dady_ALT        dady
+#define s_ALT           s
+
+#define dsdx_ALT        dsdx
+#define dsdy_ALT        dsdy
+#define t_ALT           t
+#define dtdx_ALT        dtdx
+#define dtdy_ALT        dtdy
+#define w_ALT           w
+#define dwdx_ALT        dwdx
+#define dwdy_ALT        dwdy
+
+#define Fr_ALT          Fr
+#define Fdrdx_ALT       Fdrdx
+#define Fdrdy_ALT       Fdrdy
+#define Fg_ALT          Fg
+#define Fdgdx_ALT       Fdgdx
+#define Fdgdy_ALT       Fdgdy
+#define Fb_ALT          Fb
+#define Fdbdx_ALT       Fdbdx
+
+#define Fdbdy_ALT       Fdbdy
+#define Fz_ALT          Fz
+#define Fdzdx_ALT       Fdzdx
+#define Fdzdy_ALT       Fdzdy
+#define Fa_ALT          Fa
+#define Fdadx_ALT       Fdadx
+#define Fdady_ALT       Fdady
+#define Fs_ALT          Fs
+
+#define Fdsdx_ALT       Fdsdx
+#define Fdsdy_ALT       Fdsdy
+#define Ft_ALT          Ft
+#define Fdtdx_ALT       Fdtdx
+#define Fdtdy_ALT       Fdtdy
+#define Fw_ALT          Fw
+#define Fdwdx_ALT       Fdwdx
+#define Fdwdy_ALT       Fdwdy
+#endif
+
+// Here are the defines for the hardware
+#define GET(s) s
+#define GET16(s) s
+#define SET(d,s) d = s
+#define SET16(d,s) d = s
+#define SETF(d,s) (*(float *)&(d)) = s
+
+// SET macros for FBI
+#define SET_FBI(d,s)    SET (*(&(d)+0x100),s)
+#define SET_FBIF(d,s)   SETF(*(&(d)+0x100),s)
+
+// SET macros for TMU0
+#define SET_0(d,s)      SET (*(&(d)+0x200),s)
+#define SET_0F(d,s)     SETF(*(&(d)+0x200),s)
+
+// SET macros for FBI+TMU0
+#define SET_FBI_0(d,s)  SET (*(&(d)+0x300),s)
+#define SET_FBI_0F(d,s) SETF(*(&(d)+0x300),s)
+
+// SET macros for TMU1
+#define SET_1(d,s)      SET (*(&(d)+0x400),s)
+#define SET_1F(d,s)     SETF(*(&(d)+0x400),s)
+
+// SET macros for FBI+TMU1
+#define SET_FBI_1(d,s)  SET (*(&(d)+0x500),s)
+#define SET_FBI_1F(d,s) SETF(*(&(d)+0x500),s)
+
+// SET macros for TMU2
+#define SET_2(d,s)      SET (*(&(d)+0x800),s)
+#define SET_2F(d,s)     SETF(*(&(d)+0x800),s)
+
+#ifndef SST96
+#define SST_WRAP(sst,n) ((Sstregs *)((n)*0x4000+(long)(sst)))
+#define SST_CHIP(sst,n) ((Sstregs *)((n)*0x400+(long)(sst)))
+#define SST_TMU(sst,n)  ((Sstregs *)((0x800<<(n))+(long)(sst)))
+#define SST_TREX(sst,n) SST_TMU(sst,n)
+#define SST_LFB_ADDRESS(sst)    (0x400000+(long)(sst))
+#define SST_TEX_ADDRESS(sst)    (0x800000+(long)(sst))
+#else
+#define SST_WRAP(sst,n) ((Sstregs *)(((n) << 12) + ((FxU32) (sst))))
+#define SST_CHIP(sst,n) ((Sstregs *)(((n) << 16) + ((FxU32) (sst))))
+#define SST_TMU(sst,n)  ((Sstregs *)(((n) << 17) + ((FxU32) (sst))))
+#define SST_TREX(sst,n) SST_TMU(sst,n)
+#define SST_LFB_ADDRESS(sst)    (0x000000+(FxU32)(sst))
+#define SST_TEX_ADDRESS(sst)    (0x600000+(FxU32)(sst))
+#endif
+
+extern unsigned long sstMipMapSize[4][16];
+extern unsigned long sstMipMapOffset[4][16];
+extern unsigned long sstMipMapOffset_Tsplit[4][16];
+
+
+extern void sstMemoryConfig(int fbiMem, int trex0Mem,int trex1Mem,int trex2Mem);
+extern Sstregs *sstGinit (char *, int);
+extern void sstTrexChips(int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !__SST_H__ */
Index: trunk/src/opengl/glide/sst1/init/.depend
===================================================================
--- trunk/src/opengl/glide/sst1/init/.depend	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/.depend	(revision 2885)
@@ -0,0 +1,227 @@
+h3drvr.obj: \
+       h3drvr.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       initvg\sst1init.h \
+       .\init.h \
+       .\fxinit.h
+init.obj: \
+       init.c \
+       .\init.h \
+       .\fxinit.h \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       .\init96\init96.h \
+       initvg\sst1init.h \
+       ..\..\..\..\..\include\win\windows.h \
+       ..\..\swlibs\pcilib\fxpci.h \
+       initvg\gdebug.h
+vg96drvr.obj: \
+       vg96drvr.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\sst1vid.h \
+       .\init.h \
+       .\init96\init96.h \
+       .\fxinit.h \
+       k:\ibmcpp\INCLUDE\assert.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       initvg\gdebug.h
+vgdrvr.obj: \
+       vgdrvr.c \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       initvg\sst1init.h \
+       .\init.h \
+       .\fxinit.h \
+       initvg\sst1init.h \
+       ..\incsrc\sst.h
+fxinit.h: \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\init.h \
+       ..\..\swlibs\fxmisc\fxdll.h
+init.h: \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       .\sst1vid.h \
+       initvg\sst1init.h
+sst1vid.h:
+..\..\..\..\..\include\codepage.h: \
+       k:\toolkit\H\uconv.h
+..\..\..\..\..\include\comtype.h:
+..\..\..\..\..\include\cpuhlp.h:
+..\..\..\..\..\include\dcdata.h:
+..\..\..\..\..\include\exceptions.h: \
+       ..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\include\misc.h
+..\..\..\..\..\include\excpt.h:
+..\..\..\..\..\include\exitlist.h:
+..\..\..\..\..\include\HandleManager.h: \
+       ..\..\..\..\..\include\winos2def.h
+..\..\..\..\..\include\heap.h: \
+       ..\..\..\..\..\include\win\winbase.h
+..\..\..\..\..\include\heapcode.h: \
+       ..\..\..\..\..\include\heapshared.h
+..\..\..\..\..\include\heapshared.h: \
+       k:\ibmcpp\INCLUDE\stddef.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\umalloc.h
+..\..\..\..\..\include\heapstring.h: \
+       ..\..\..\..\..\include\odin.h
+..\..\..\..\..\include\midimapr.h:
+..\..\..\..\..\include\misc.h: \
+       ..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\include\versionos2.h \
+       ..\..\..\..\..\include\unicode.h
+..\..\..\..\..\include\nameid.h:
+..\..\..\..\..\include\odin.h: \
+       k:\ibmcpp\INCLUDE\builtin.h
+..\..\..\..\..\include\odinlx.h:
+..\..\..\..\..\include\odinrsrc.h:
+..\..\..\..\..\include\odinwrap.h: \
+       ..\..\..\..\..\include\os2sel.h \
+       k:\ibmcpp\INCLUDE\malloc.h
+..\..\..\..\..\include\os2mewrap.h: \
+       k:\toolkit\H\os2me.h
+..\..\..\..\..\include\os2newapi.h:
+..\..\..\..\..\include\os2sel.h:
+..\..\..\..\..\include\OS2WIN.H: \
+       ..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\include\odin.h \
+       ..\..\..\..\..\include\win\windef.h \
+       ..\..\..\..\..\include\win\winbase.h \
+       ..\..\..\..\..\include\win\wingdi.h \
+       ..\..\..\..\..\include\win\winuser.h \
+       ..\..\..\..\..\include\win\winerror.h \
+       ..\..\..\..\..\include\win\commdlg.h \
+       ..\..\..\..\..\include\win\ddeml.h \
+       ..\..\..\..\..\include\win\mmsystem.h \
+       ..\..\..\..\..\include\os2sel.h \
+       ..\..\..\..\..\include\misc.h
+..\..\..\..\..\include\os2wrap.h: \
+       k:\toolkit\H\os2.h \
+       ..\..\..\..\..\include\os2sel.h \
+       ..\..\..\..\..\include\os2newapi.h
+..\..\..\..\..\include\pefile.h: \
+       k:\toolkit\H\os2.h \
+       ..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\include\win\peexe.h \
+       k:\ibmcpp\INCLUDE\stdlib.h
+..\..\..\..\..\include\pmmenu.h:
+..\..\..\..\..\include\spy.h:
+..\..\..\..\..\include\unicode.h: \
+       ..\..\..\..\..\include\uniconv.h
+..\..\..\..\..\include\uniconv.h: \
+       k:\ibmcpp\INCLUDE\stddef.h \
+       k:\ibmcpp\INCLUDE\time.h
+..\..\..\..\..\include\versionos2.h:
+..\..\..\..\..\include\virtual.h:
+..\..\..\..\..\include\vmutex.h:
+..\..\..\..\..\include\win32type.h: \
+       ..\..\..\..\..\include\odin.h
+..\..\..\..\..\include\win32util.h:
+..\..\..\..\..\include\win32wnd.h:
+..\..\..\..\..\include\winaccel.h:
+..\..\..\..\..\include\winconst.h:
+..\..\..\..\..\include\wincursor.h:
+..\..\..\..\..\include\windllbase.h: \
+       ..\..\..\..\..\include\winimagebase.h \
+       ..\..\..\..\..\include\odinlx.h
+..\..\..\..\..\include\windlllx.h: \
+       ..\..\..\..\..\include\windllbase.h \
+       ..\..\..\..\..\include\winimagelx.h
+..\..\..\..\..\include\windllpe2lx.h: \
+       ..\..\..\..\..\include\windllbase.h \
+       ..\..\..\..\..\include\winimagepe2lx.h
+..\..\..\..\..\include\windllpeldr.h: \
+       ..\..\..\..\..\include\windllbase.h \
+       ..\..\..\..\..\include\winimagepeldr.h
+..\..\..\..\..\include\wineuni.h:
+..\..\..\..\..\include\winexebase.h: \
+       ..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\include\winexelx.h: \
+       ..\..\..\..\..\include\winexebase.h \
+       ..\..\..\..\..\include\winimagelx.h \
+       ..\..\..\..\..\include\odinlx.h
+..\..\..\..\..\include\winexepe2lx.h: \
+       ..\..\..\..\..\include\winexebase.h \
+       ..\..\..\..\..\include\winimagepe2lx.h
+..\..\..\..\..\include\winexepeldr.h: \
+       ..\..\..\..\..\include\winexebase.h \
+       ..\..\..\..\..\include\winimagepeldr.h
+..\..\..\..\..\include\winfakepeldr.h: \
+       ..\..\..\..\..\include\winimagepeldr.h
+..\..\..\..\..\include\winicon.h:
+..\..\..\..\..\include\winimagebase.h: \
+       ..\..\..\..\..\include\win\peexe.h
+..\..\..\..\..\include\winimagelx.h: \
+       ..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\include\winimagepe2lx.h: \
+       ..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\include\winimagepeldr.h: \
+       ..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\include\winkeyboard.h:
+..\..\..\..\..\include\winmenu.h:
+..\..\..\..\..\include\winos2def.h:
+..\..\..\..\..\include\winres.h:
+..\..\..\..\..\include\wprocess.h: \
+       ..\..\..\..\..\include\win\winprocess.h \
+       ..\..\..\..\..\include\winconst.h \
+       ..\..\..\..\..\include\win\thread.h
+..\incsrc\ncc.h:
+..\incsrc\sst.h: \
+       ..\incsrc\ncc.h \
+       ..\..\swlibs\fxmisc\fx64.h
+..\..\swlibs\fxmisc\3dfx.h:
+..\..\swlibs\fxmisc\fx64.h: \
+       ..\..\swlibs\fxmisc\3dfx.h
+..\..\swlibs\fxmisc\fxdll.h:
+..\..\swlibs\fxmisc\fxglob.h:
+..\..\swlibs\fxmisc\fximg.h:
+..\..\swlibs\fxmisc\fxmemmap.h:
+..\..\swlibs\fxmisc\fxos.h: \
+       k:\ibmcpp\INCLUDE\stdio.h
+..\..\swlibs\fxmisc\fxver.h:
+..\..\swlibs\fxmisc\linutil.h:
+..\..\swlibs\fxmisc\tsc.h:
+initvg\gdebug.h: \
+       k:\ibmcpp\INCLUDE\stdarg.h \
+       ..\..\swlibs\fxmisc\3dfx.h
+initvg\rcver.h:
+initvg\sst1init.h: \
+       .\sst1vid.h \
+       ..\..\swlibs\pcilib\fxpci.h \
+       k:\ibmcpp\INCLUDE\stdio.h
+..\glide\fxglide.h: \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       initvg\sst1init.h \
+       ..\incsrc\sst.h \
+       initvg\gdebug.h \
+       .\init.h \
+       k:\ibmcpp\INCLUDE\assert.h
+..\glide\fxinline.h:
+..\glide\glide.h: \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\glide\glidesys.h \
+       .\sst1vid.h \
+       ..\glide\glideutl.h
+..\glide\glidesys.h:
+..\glide\glideutl.h:
+..\glide\gsstdef.h: \
+       ..\incsrc\sst.h
+..\glide\gump.h:
+..\glide\rcver.h:
+..\texus\texus.h: \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\stdio.h
+..\texus\texusint.h: \
+       ..\texus\texus.h
+..\..\swlibs\pcilib\fxlinux.h:
+..\..\swlibs\pcilib\fxos2.h:
+..\..\swlibs\pcilib\fxpci.h:
+..\..\swlibs\pcilib\fxphrlap.h:
+..\..\swlibs\pcilib\fxw32.h: \
+       ..\..\..\..\..\include\win\windows.h \
+       ..\..\swlibs\pcilib\pcilib.h
+..\..\swlibs\pcilib\pcilib.h:
+..\..\swlibs\pcilib\sst1_pci.h: \
+       ..\..\swlibs\pcilib\fxpci.h
Index: trunk/src/opengl/glide/sst1/init/fxinit.h
===================================================================
--- trunk/src/opengl/glide/sst1/init/fxinit.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/fxinit.h	(revision 2885)
@@ -0,0 +1,125 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:26 $ 
+**
+*/
+
+
+#ifndef _FXTINI_H_
+#define _FXTINI_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <3dfx.h>
+#include "init.h"
+#include <fxdll.h>
+
+/*----------------------------------------------------------------------------
+  DATA DEFINITIONS
+  ----------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------
+  Structure: InitContext
+  Date: 10/9
+  Implementor(s): jdt, murali
+  Library: Init
+  Description:
+  Contains all device dependant functions for a given 3Dfx device
+  Members:
+  setVideo         - initilize video 
+  restoreVideo     - undo setVideo
+  enableTransport  - enable the command transport
+  disableTransport - disable the command transport
+  swapBuffers    - function which executes a buffer swap
+  status         - function which returns the status word from the 3D subsystem
+  busy           - returns true if hardware busy
+  idle           - returns when 3D subsystem is idle
+  getBufferPtr   - get a pointer to a frame buffer
+  renderBuffer   - set the current buffer for rendering
+  origin         - set the y origin 
+  ioCtl          - CYA function 
+  control        - OS response functions
+
+  gamma          - initializes gamma table
+  sliPciOwner    - sets ownership of PCI bus in SLI configuration
+
+  info           - hardware description
+  writeMethod    - function for doing command transport writes to hardware
+  devNumber      - enumerated order of device on bus
+  devPrivate     - Private data for the device type
+  -------------------------------------------------------------------*/
+typedef struct {
+    FxBool       (* FX_CALL setVideo) (
+                    FxU32                   hWnd,
+                    GrScreenResolution_t    sRes,
+                    GrScreenRefresh_t       vRefresh,
+                    InitColorFormat_t       cFormat,
+                    InitOriginLocation_t    yOrigin,
+                    int                     nColBuffers,
+                    int                     nAuxBuffers,
+                    int                     *xres,
+                    int                     *yres,
+                    int                     *fbStride,
+                    sst1VideoTimingStruct   *vidTimings);
+    void         (* FX_CALL restoreVideo)( void );
+    FxBool       (* FX_CALL enableTransport)( InitFIFOData *info );
+    void         (* FX_CALL disableTransport)( void );
+
+    InitSwapType_t         (* FX_CALL swapBuffers)( FxU32 code );
+    FxU32        (* FX_CALL status)( void );
+    FxBool       (* FX_CALL busy)(void);
+    void         (* FX_CALL idle)( void );
+    void        *(* FX_CALL getBufferPtr)( InitBuffer_t buffer, int *strideBytes );
+    void         (* FX_CALL renderBuffer)( InitBuffer_t buffer );
+    void         (* FX_CALL origin)( InitOriginLocation_t origin );
+    void         (* FX_CALL ioCtl)( FxU32 token, void *argument );
+    FxBool       (* FX_CALL control) ( FxU32 code );
+    FxBool       (* FX_CALL wrapFIFO) (InitFIFOData *fD);
+   
+    void         (* FX_CALL gamma)( double gamma );
+    void         (* FX_CALL sliPciOwner)( FxU32 *regbase, FxU32 owner );
+  
+    /*
+    **  added interface for Glide 3
+    */ 
+    FxBool       (* FX_CALL gammaRGB)( double r, double g, double b );
+    FxBool       (* FX_CALL initGammaTable)(FxU32 nentries, FxU32 *r, FxU32 *g, FxU32 *b);
+    sst1VideoTimingStruct * (* FX_CALL findVidTimingStruct) (
+                                                    GrScreenResolution_t    sRes,
+                                                    GrScreenRefresh_t       vRefresh);
+
+    InitDeviceInfo    info;
+    InitWriteCallback *writeMethod;
+    void              *devPrivate;
+} InitContext;
+
+/* Global current context */
+extern InitContext *context;
+
+void vgDriverInit( InitContext *context );
+void vg96DriverInit( InitContext *context );
+void h3DriverInit( InitContext *context );
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Index: trunk/src/opengl/glide/sst1/init/h3drvr.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/h3drvr.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/h3drvr.c	(revision 2885)
@@ -0,0 +1,120 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:26 $ 
+**
+*/
+
+#include <3dfx.h>
+#include <sst1init.h>
+#include "init.h"
+#include "fxinit.h"
+
+static FxBool FX_CALL setVideo( FxU32                   hWnd,
+                        GrScreenResolution_t    sRes,
+                        GrScreenRefresh_t       vRefresh,
+                        InitColorFormat_t       cFormat,
+                        InitOriginLocation_t    yOrigin,
+                        int                     nColBuffers,
+                        int                     nAuxBuffers,
+                        int                     *xres,
+                        int                     *yres,
+                        int                     *fbStride,
+                        sst1VideoTimingStruct   *vidTimings) {
+    return FXFALSE;
+}
+
+static void FX_CALL restoreVideo( void ) {
+}
+
+static FxBool FX_CALL enableTransport( InitFIFOData *info ) {
+    FxBool rv = FXFALSE;
+    return rv;
+}
+
+static void FX_CALL disableTransport( void ) {
+}
+
+static InitSwapType_t FX_CALL swapBuffers( FxU32 code ) {
+  return 0;
+} 
+
+static FxU32 FX_CALL status( void ) {
+  return 0;
+} 
+
+static FxBool FX_CALL busy(void) {
+  return 0;
+} 
+
+static void FX_CALL idle( void ) {
+}
+
+static void * FX_CALL getBufferPtr( InitBuffer_t buffer, int *strideBytes ) {
+    return 0;
+}
+
+static void FX_CALL renderBuffer( InitBuffer_t buffer ) {
+    return;
+}
+
+static void FX_CALL origin( InitOriginLocation_t origin ) {
+    return;
+}
+
+static void FX_CALL ioCtl( FxU32 token, void *argument ) {
+    return;
+}
+
+static FxBool FX_CALL control( FxU32 code ) {
+    return FXFALSE;
+}
+
+static FxBool FX_CALL wrapFIFO(InitFIFOData *fd) {
+    return FXTRUE;
+}
+
+static void FX_CALL gamma( double gamma ) {
+}
+
+static void FX_CALL sliPciOwner( FxU32 *regbase, FxU32 owner ) {
+}
+
+void h3DriverInit( InitContext *context ) {
+    context->setVideo         = setVideo;
+    context->restoreVideo     = restoreVideo;
+    context->enableTransport  = enableTransport;
+    context->disableTransport = disableTransport;
+    context->swapBuffers      = swapBuffers;
+    context->status           = status;
+    context->busy             = busy;
+    context->idle             = idle;
+    context->getBufferPtr     = getBufferPtr;
+    context->renderBuffer     = renderBuffer;
+    context->origin           = origin;
+    context->ioCtl            = ioCtl;
+    context->control          = control;
+    context->wrapFIFO         = wrapFIFO;
+
+
+    context->gamma            = gamma;
+    context->sliPciOwner      = sliPciOwner;
+}
Index: trunk/src/opengl/glide/sst1/init/init.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/init.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init.c	(revision 2885)
@@ -0,0 +1,827 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:26 $ 
+**
+*/
+
+
+#include "init.h"
+#include "fxinit.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#if defined(__WATCOMC__)
+#define _inp inp
+#define _outp outp
+#define _outpw outpw
+#endif
+#if defined(__linux__)
+
+#define _inp(port) pioInByte(port)
+#define _outp(port, data) pioOutByte(port, data)
+#define _outpw(port, data) pioOutWord(port, data);
+
+#endif
+
+#include "init96\init96.h"
+#include <sst1init.h>
+
+#ifdef _WIN32
+#define _WIN32_LEAN_AND_MEAN_
+#include <windows.h>
+#endif
+
+#include <fxpci.h>
+#include <gdebug.h>
+
+extern PciRegister PCI_VENDOR_ID;
+extern PciRegister PCI_DEVICE_ID;
+
+
+/*-------------------------------------------------------------------
+  Module Constants
+  -------------------------------------------------------------------*/
+
+
+static InitContext
+  contexts[NUM_3DFX_PRODUCTS];  /* pool of device contexts */
+InitContext
+  *context;                     /* Current device context */
+static InitDeviceInfo
+  hwInfo[INIT_MAX_DEVICES];     /* Info for all supported devices */
+static FxU32
+  numDevicesInSystem,           /* Number of supported devices. */
+  numSst1s;                     /* # SST1s in system */
+static FxBool
+  libInitialized;               /* Well, has it been? */
+
+/*-------------------------------------------------------------------
+  Function: initEnumHardware
+  Date: 10/9
+  Implementor(s): jdt
+  Library: init
+  Description:
+  Calls a user supplied function on an initialized InitDeviceInfo
+  structure for each device in the system.  Calls a user supplied
+  callback repeatedly for each device in the system.  The callback
+  can stop the enumeration cycle by return a value of FXTRUE.
+  Arguments:
+  cb - callback function of type INitHWEnumCallback which is called on
+       an initialzied InitDeviceInfo structure
+  Return:
+  none
+  -------------------------------------------------------------------*/
+void
+initEnumHardware( InitHWEnumCallback *cb )
+{
+  FxU32  busLocation;
+  FxU32  device;
+  if ( !libInitialized ) {
+
+    /* When initializing the Library snoop out all 3Dfx devices 
+       and fill a static data structure with pertinant data.  */
+
+    numDevicesInSystem = 0;
+    numSst1s = 0;
+    if ( !pciOpen() ) return;
+    for( busLocation = 0; busLocation < MAX_PCI_DEVICES; busLocation++ ) {
+      if ( pciDeviceExists( busLocation ) ) {
+        FxU32 vId, dId;
+        pciGetConfigData( PCI_VENDOR_ID, busLocation, &vId );
+        pciGetConfigData( PCI_DEVICE_ID, busLocation, &dId );
+
+        GDBG_INFO((80, "initEnumHardware:  Vendor:  0x%x  Device:  0x%x\n", vId, dId));
+
+#if defined( SST1 )
+        if ( (vId == TDFXVID) &&
+            (dId == SST1DID) ) { /* Detect SST1 */
+          FxU32 *base;
+          sst1DeviceInfoStruct info;
+
+          /* Scanline interleave must be two boards back to back
+             if there is a second board in the system,
+             and the previous board was SLI, then this is the slave */
+          if ( numDevicesInSystem > 0 ) {
+            if ( hwInfo[numDevicesInSystem-1].hwClass==INIT_VOODOO &&
+                hwInfo[numDevicesInSystem-1].hwDep.vgInfo.sliDetect ) {
+
+              hwInfo[numDevicesInSystem-1].hwDep.vgInfo.slaveBaseAddr =
+                (FxU32)sst1InitMapBoard( numSst1s );
+              hwInfo[numDevicesInSystem-1].regs.hwDep.VGRegDesc.slavePtr = 
+                (FxU32*)hwInfo[numDevicesInSystem-1].hwDep.vgInfo.slaveBaseAddr;
+              numSst1s++;
+              continue;
+
+            }
+          }
+
+          hwInfo[numDevicesInSystem].vendorID  = (FxU16) vId;
+          hwInfo[numDevicesInSystem].deviceID  = (FxU16) dId;
+          hwInfo[numDevicesInSystem].devNumber = numDevicesInSystem;
+          hwInfo[numDevicesInSystem].hwClass   = INIT_VOODOO;
+
+          /* On SST-1 We Have to Initialize the Registers
+             to Discover the configuration of the board */
+#if 0
+          base = sst1InitMapBoard( numSst1s );
+          sst1InitRegisters( base );
+#else
+          base = (FxU32*)initMapBoard(numSst1s);
+#endif
+          sst1InitGetDeviceInfo( base, &info );
+
+          hwInfo[numDevicesInSystem].hwDep.vgInfo.vgBaseAddr = (FxU32) base;
+          hwInfo[numDevicesInSystem].hwDep.vgInfo.pfxRev    = info.fbiRevision;
+          hwInfo[numDevicesInSystem].hwDep.vgInfo.pfxRam    = info.fbiMemSize;
+          hwInfo[numDevicesInSystem].hwDep.vgInfo.nTFX      = info.numberTmus;
+          hwInfo[numDevicesInSystem].hwDep.vgInfo.tfxRev    = info.tmuRevision;
+          hwInfo[numDevicesInSystem].hwDep.vgInfo.tfxRam    = info.tmuMemSize[0];
+          hwInfo[numDevicesInSystem].hwDep.vgInfo.sliDetect = info.sstSliDetect;
+          hwInfo[numDevicesInSystem].hwDep.vgInfo.slaveBaseAddr = 0;
+          hwInfo[numDevicesInSystem].regs.hwDep.VGRegDesc.baseAddress = base;
+          hwInfo[numDevicesInSystem].regs.hwDep.VGRegDesc.slavePtr = 0;
+
+          numSst1s++;
+          numDevicesInSystem++;
+        }
+#elif defined(SST96)
+#define IS_CHIP(name) (vId == name##VID && dId == name##DID)
+
+        if (IS_CHIP(AT3D) ||
+            IS_CHIP(MCRX)) {
+
+          if (IS_CHIP(MCRX)) {
+            /* In the case of Macronix, look for 3d4/3f[2] == 1, as
+               they set that bit when we're attached.  */
+            FxU8 regVal;
+            _outp(0x3d4, 0x3f);
+            regVal = _inp(0x3d5);
+            
+            if (!(regVal & (1 << 2))) /* we're not there */
+              continue;
+          }
+
+          hwInfo[numDevicesInSystem].vendorID  = (FxU16) vId;
+          hwInfo[numDevicesInSystem].deviceID  = (FxU16) dId;
+          hwInfo[numDevicesInSystem].devNumber = numDevicesInSystem;
+          hwInfo[numDevicesInSystem].hwClass   = INIT_VG96;
+
+          /* SST-96 initialization also retrieves board configuration info */
+#if 0
+          init96MapBoard(&hwInfo[numDevicesInSystem].regs,
+                         &hwInfo[numDevicesInSystem].hwDep.vg96Info,
+                         (FxU16) vId, (FxU16) dId);
+#else
+          initMapBoard(numDevicesInSystem);
+#endif
+
+          hwInfo[numDevicesInSystem].hwDep.vg96Info.vgaBaseAddr = 
+            (FxU32)hwInfo[numDevicesInSystem].regs.hwDep.VG96RegDesc.partnerRegPtr;
+          hwInfo[numDevicesInSystem].hwDep.vg96Info.vg96BaseAddr = 
+            (FxU32)hwInfo[numDevicesInSystem].regs.hwDep.VG96RegDesc.baseAddress;
+          
+          numDevicesInSystem++;
+        } 
+#else
+#  error "Do hardware enumeration for this chip!"
+#endif
+      }
+    }
+    
+
+    /* Sanity Check for SLI detection */
+    for( device = 0; device < numDevicesInSystem; device++ ) {
+      if ( hwInfo[device].hwClass == INIT_VOODOO &&
+          hwInfo[device].hwDep.vgInfo.sliDetect              &&
+          hwInfo[device].hwDep.vgInfo.slaveBaseAddr == 0 ) {
+        hwInfo[device].hwDep.vgInfo.sliDetect = FXFALSE;
+      }
+    }
+
+    /* Initialize all drivers */
+    vgDriverInit( &contexts[INIT_VOODOO] );
+    vg96DriverInit( &contexts[INIT_VG96] );
+    h3DriverInit( &contexts[INIT_H3] );
+
+
+    /* Mark the library as initialized */
+    libInitialized = FXTRUE;
+  }
+  
+  if ( cb ) {
+    for( device = 0; device < numDevicesInSystem; device++ ) {
+      cb( &hwInfo[device] );
+    } 
+  }
+  return;
+} /* initEnumHardware */
+
+volatile FxU32*
+initMapBoard(const FxU32 boardNum)
+{
+   volatile FxU32* retVal = NULL;
+   FxBool okP = (boardNum < INIT_MAX_DEVICES);
+   
+   if (okP) {
+      InitDeviceInfo* infoP = (hwInfo + boardNum);
+      const FxU32 vId = infoP->vendorID;
+      const FxU32 dId = infoP->deviceID;
+      
+#if defined(SST1)
+      okP = ((vId == TDFXVID) &&
+             (dId == SST1DID));
+
+      if (okP) {
+         retVal = sst1InitMapBoard(boardNum);
+         sst1InitRegisters((FxU32*)retVal);
+      }
+#elif defined(SST96)
+      okP = (IS_CHIP(AT3D) ||
+             IS_CHIP(MCRX));
+
+      if (okP) {
+         init96MapBoard(&infoP->regs, &infoP->hwDep.vg96Info,
+                        (FxU16)vId, (FxU16)dId);
+         retVal = infoP->regs.hwDep.VG96RegDesc.baseAddress;
+      }
+#else
+#error "Need to define initMapBoard for this chip!"
+#endif /* HW Check */
+   }
+
+   return retVal;
+}
+
+
+/*-------------------------------------------------------------------
+  Function: initClose
+  Date: 10/17
+  Implementor(s): jdt
+  Library: init
+  Description:
+  Unmap all hardware and set library to unitialized state
+  Arguments:
+  none
+  Return:
+  none
+  -------------------------------------------------------------------*/
+void initClose( void ) {
+    if ( libInitialized ) {
+        unsigned i;
+        for ( i = 0; i < numDevicesInSystem; i++ ) {
+            /* Insert unmap code here */ /* FIXME!!!! */
+        }
+        pciClose();
+        libInitialized = FXFALSE;
+    } 
+} /* initClose */
+
+/*-------------------------------------------------------------------
+  Function: initGetDeviceInfo
+  Date: 10/9
+  Implementor(s): jdt
+  Library: init
+  Description:
+  Fills a user supplied area of memory with information describing
+  the a 3Dfx device.  The device is identified on the bus by the unique
+  devNumber assigned by the library and revealed to the user through
+  initEnumHardware.
+  Arguments:
+  devNumber - number identifying device in system
+  info      - pointer to user memory to be filled with dev info
+  Return:
+  FXTRUE  - succeed
+  FXFALSE - one or both parameters invalid
+  -------------------------------------------------------------------*/
+FxBool
+initGetDeviceInfo( FxU32 devNumber, InitDeviceInfo *info )
+{
+    FxBool rv;
+
+    if ( devNumber < numDevicesInSystem ) {
+        *info = hwInfo[devNumber];
+        rv = FXTRUE;
+    } else {
+        rv = FXFALSE;
+    }
+    return rv;
+} /* initGetDeviceInfo */
+
+
+/*-------------------------------------------------------------------
+  Function: initDeviceSelect
+  Date: 10/9
+  Implementor(s): jdt
+  Library: init
+  Description: 
+  Selects a 3Dfx device ( potentially from among many in the system ) and 
+  initializes the internal init driver functions with behavior appropriate
+  to the type of the selected device.
+  Arguments:
+  devNumber - unique number assigned to each device by initEnumHardware
+  Return:
+  FXTRUE - success
+  FXFALSE - invalide device number
+  -------------------------------------------------------------------*/
+
+FxBool
+initDeviceSelect( FxU32 devNumber ) 
+{
+  FxBool rv = FXFALSE;
+  
+  if ( devNumber < numDevicesInSystem ) {
+    context = &contexts[hwInfo[devNumber].hwClass];
+    context->info = hwInfo[devNumber];
+    rv =  FXTRUE;
+  } 
+  
+  return rv;
+
+}/* initDeviceSelect */
+
+/*-------------------------------------------------------------------
+  Function: initSetWriteMethod
+  Date: 10/17
+  Implementor(s): jdt
+  Library: init
+  Description:
+  Sets up a register write method that respects the fifo conventions
+  of the hardware.
+  Arguments:
+  wcb - callback to be used to do direct writes from init code
+  Return:
+  none
+  -------------------------------------------------------------------*/
+void initSetWriteMethod( InitWriteCallback *wcb ) {
+    if ( context )
+        context->writeMethod = wcb;
+    return;
+} /* initSetWriteMethod */
+
+
+
+/*-------------------------------------------------------------------
+  Function: initSetVideo
+  Date: 10/9
+  Implementor(s): jdt, murali
+  Library: init
+  Description:
+        This will initialize the video, and allocate color and aux buffers
+        prior to rendering.
+  Arguments:
+  hwnd - pointer to a window handle or null.  If NULL, then 
+         the application window handle will be inferred though
+         the GetActiveWindow() api.
+  resolution - either one of the pre-defined glide resolutions,
+               or GR_RESOLUTION_NONE, in which case the window
+               size is inferred from the size application window
+  refresh - requested fullscreen refresh rate, ignored in a window
+  format  - requested ccolor format for glide packed color values
+  origin  - location of coordinate origin either upper left or
+                    lower right
+  nColBuffers - number of color buffers to attempt to allocate
+                0 - meaningless
+                1 - allocate a front buffer only
+                2 - allocate a front and back buffer
+                3 - allocate a front, back, aux buffer for tripple buffering
+  nAuxBuffers - number of aux buffers to attempt to allocate
+                0 - no alpha or z buffers
+                1 - allocate one aux buffer for alpha/depth buffering
+                2 - allocate on depth and one alpha buffer ( unsup )
+  xres        - x resolution return val ( for user windows )
+  yres        - y resolution return val ( for user windows )
+  fbStride    - stride in pixels of frame buffer
+  Return:
+  FXTRUE - all resources requested where allocated
+  FXFALSE - some or all resources were not available.  By comparing
+            desc before and after call, the user can determine which
+            resources were denied.
+  -------------------------------------------------------------------*/
+FxBool initSetVideo( FxU32                hWnd,
+                     GrScreenResolution_t sRes,
+                     GrScreenRefresh_t    vRefresh,
+                     InitColorFormat_t    cFormat,
+                     InitOriginLocation_t yOrigin,
+                     int                  nColBuffers,
+                     int                  nAuxBuffers,
+                     int                  *xres,
+                     int                  *yres,
+                     int                  *fbStride,
+                     sst1VideoTimingStruct *vidTimings) {
+    FxBool rv;
+    if ( context ) {
+        rv = context->setVideo( hWnd, sRes, vRefresh, cFormat, 
+                                yOrigin, nColBuffers, nAuxBuffers,
+                                xres, yres, fbStride, vidTimings);
+    } else {
+        rv = FXFALSE;
+    }
+    return rv;
+} /* initSetVideo */
+
+
+/*-------------------------------------------------------------------
+  Function: initRestoreVideo
+  Date: 10/16
+  Implementor(s): jdt
+  Library: init
+  Description:
+  Restore video to its state prior to initSetVideo
+  Arguments:
+  none
+  Return:
+  none
+  -------------------------------------------------------------------*/
+void initRestoreVideo( void ) {
+    if ( context ) 
+        context->restoreVideo();
+} /* initRestoreVideo */
+
+/*-------------------------------------------------------------------
+  Function: initEnableTransport
+  Date: 10/17
+  Implementor(s): jdt
+  Library: init
+  Description:
+  Enable the command transport mechanism for the underlying 
+  hardware and return information about accessing the transport
+  to the caller
+  Arguments:
+  info - data structure describing state of transport
+  Return:
+  FXTRUE  - successfully enabled the command transport
+  FXFALSE - failed ot enable the command transport
+  -------------------------------------------------------------------*/
+FxBool initEnableTransport( InitFIFOData *info ) {
+    FxBool rv;
+    if ( context ) {
+        rv = context->enableTransport( info );
+    } else {
+        rv = FXFALSE;
+    }
+    return rv;
+} /* initEnableTransport */
+
+/*-------------------------------------------------------------------
+  Function: initDisableTransport
+  Date: 10/17
+  Implementor(s): jdt
+  Library: init
+  Description:
+  Return transport control to reset state
+  Arguments:
+  none
+  Return:
+  none
+  -------------------------------------------------------------------*/
+void initDisableTransport( void ) {
+    if ( context ) 
+        context->disableTransport();
+} /* initDisableTransport */
+
+/*-------------------------------------------------------------------
+  Function: initSwapBuffers
+  Date: 10/9
+  Implementor(s): jdt, murali
+  Library: init
+  Description:
+  Initiate a buffer swap.  
+  Arguments: 
+  code - code describing type of swap, wether to sync to vretrace, how
+         many vretraces to wait, etc.
+  -------------------------------------------------------------------*/
+void initSwapBuffers( FxU32 code ) {
+    if ( context )
+        context->swapBuffers( code );
+} /* initSwapBuffers */
+
+/*-------------------------------------------------------------------
+  Function: initStatus
+  Date: 10/9
+  Implementor(s): jdt
+  Library: init
+  Description:
+  Returns the status word from the hardware
+  Arguments:
+  none
+  Return:
+  32-bit status word ( chip specific )
+  -------------------------------------------------------------------*/
+FxU32 initStatus( void ) {
+    FxU32 rv;
+    if ( context ) {
+        rv = context->status();
+    } else {
+        rv = 0;
+    }
+    return rv;
+} /* initStatus */
+
+/*-------------------------------------------------------------------
+  Function: initBusy
+  Date: 10/9
+  Implementor(s): jdt
+  Library: init
+  Description:
+  return true if hardware is busy rendering
+  Arguments:
+  none
+  Return:
+  FXTRUE  - if busy
+  FXFALSE - if idle
+  -------------------------------------------------------------------*/
+FxBool initBusy( void ) {
+    FxBool rv;
+    if ( context ) {
+        rv = context->busy();
+    } else {
+        rv = FXTRUE;
+    }
+    return rv;
+} /* initBusy */
+
+/*-------------------------------------------------------------------
+  Function: initIdle
+  Date: 10/9
+  Implementor(s): jdt
+  Library: init
+  Description:
+  Returns only when graphics pipeline is completely idle. 
+  May hang software if hardware is permanently busy.
+  Arguments:
+  none
+  Return:
+  none
+  -------------------------------------------------------------------*/
+void initIdle( void ) {
+    if ( context )
+        context->idle();
+} /* initIdle */
+
+/*-------------------------------------------------------------------
+  Function: initGetBufferPtr
+  Date: 2/25
+  Implementor(s): jdt
+  Library: Init
+  Description:
+  Get the current pointer to a particular buffer
+  Arguments:
+  buffer - which buffer to get pointer to 
+  Return:
+  integer pointer
+  -------------------------------------------------------------------*/
+void *initGetBufferPtr( InitBuffer_t buffer, int *strideBytes ) {
+    if ( context )
+        return context->getBufferPtr( buffer, strideBytes );
+    else
+        return 0;
+} /* initGetBufferPtr */
+
+/*-------------------------------------------------------------------
+  Function: initRenderBuffer
+  Date: 2/25
+  Implementor(s): jdt
+  Library: init 
+  Description:
+  Sets the current render buffer
+  Arguments:
+  buffer - which buffer to render to ( front or back )
+  Return:
+  none
+  -------------------------------------------------------------------*/
+void initRenderBuffer( InitBuffer_t buffer ) {
+    if ( context ) context->renderBuffer( buffer );
+    return;
+} /* initRenderBuffer */
+
+/*-------------------------------------------------------------------
+  Function: initOrigin
+  Date: 2/25
+  Implementor(s): jdt
+  Library: init
+  Description:
+  Set the yorigin
+  Arguments:
+  origin - origin designation
+  Return:
+  none
+  -------------------------------------------------------------------*/
+void initOrigin( InitOriginLocation_t origin ) {
+    if ( context ) context->origin( origin );
+    return;
+} /* initOrigin */
+
+/*-------------------------------------------------------------------
+  Function:initIOCtl
+  Date: 10/9
+  Implementor(s): jdt
+  Library: init
+  Description:
+  CYA function so that emergency functionality may be added w/o 
+  corrupting dll interface
+  Arguments:
+  token    - describes IOCTL function
+  argument - pointer to arguments
+  Return:
+  none
+  -------------------------------------------------------------------*/
+void initIOCtl( FxU32 token, void *argument ) {
+    if ( context )
+        context->ioCtl( token, argument );
+} /* initIOCtl */
+
+/*-------------------------------------------------------------------
+  Function: initControl
+  Date: 10/9
+  Implementor(s): murali
+  Library: init
+  Description:
+        This will re-attach new buffers for the rendering context, used
+        typically only in a windowing system where buffers need to move 
+        and resize. Also, implicitly detach old associated buffers.
+  Arguments:
+        XXX
+  Return:
+  FXTRUE - all resources requested where allocated
+  FXFALSE - some or all resources were not available.  By comparing
+            desc before and after call, the user can determine which
+            resources were denied.
+  -------------------------------------------------------------------*/
+FxBool initControl( FxU32 code)
+{
+
+    FxBool rv;
+
+    GDBG_INFO((80, "initControl: code = %d, context=%.08x\n", code, context));
+    if ( context ) {
+        rv = context->control( code );
+    } else {
+        rv = FXFALSE;
+    }
+    return rv;
+} /* initControl */
+
+/*-------------------------------------------------------------------
+  Function: initWrapFIFO
+  Date: 13-Feb-97
+  Implementor(s): dow
+  Library: init
+  Description:
+  Reset the command transport when the fifo is full
+  Arguments:
+  pointer to fifo data
+  Return:
+  none
+  -------------------------------------------------------------------*/
+FxBool initWrapFIFO(InitFIFOData *fifoData) {
+    if ( context )
+        return context->wrapFIFO(fifoData);
+    else
+        return FXFALSE;
+} /* initWrapFIFO */
+
+/*-------------------------------------------------------------------
+  Function: initGamma
+  Date: 10/9
+  Implementor(s): jdt
+  Library: init
+  Description:
+  SST-1 holdover function which initializes the gamma table in some
+  video hardware to normalize monitor brightness
+  Arguments:
+  gamma - floating point gamma correction factor
+  Return:
+  none
+  -------------------------------------------------------------------*/
+void initGamma( double gamma ) {
+    if ( context )
+        context->gamma( gamma );
+} /* initGamma */
+
+/*-------------------------------------------------------------------
+  Function: initSliPciOwner
+  Date: 10/9
+  Implementor(s): jdt
+  Library: init
+  Description:
+  Do some voodoo(tm) to change the owner of the PCI bus in an SLI
+  configuration
+  Arguments:
+  regbase - ask scott sellers
+  owner   - ask scott sellers
+  Return:
+  none
+  -------------------------------------------------------------------*/
+void initSliPciOwner( FxU32 *regbase, FxU32 owner ) {
+    if ( context )
+        context->sliPciOwner( regbase, owner );
+} /* initSliPciOwner */
+
+
+/*-------------------------------------------------------------------
+  Function: initNumBoardsInSystem
+  Date: 19970813
+  Implementor(s): pgj
+  Library: init
+  Description:
+    Computes the number of boards compatible with the hardware the init
+    library is compiled for, i.e. this will count either the number
+    of VG xor Rush cards present.
+  Return:
+    number of boards found
+  -------------------------------------------------------------------*/
+FxU32 initNumBoardsInSystem(void)
+{
+    FxU32 numBoards, j, n;
+
+    if(getenv(("SST_BOARDS"))) {
+        numBoards = atoi(getenv(("SST_BOARDS")));
+    } else {
+        numBoards = 0;
+#if defined(SST1)
+        for(j=0; j<INIT_MAX_DEVICES; j++) {
+            if(pciFindCardMulti(TDFXVID, SST1DID, &n, j)) numBoards++;
+        }
+#elif defined(SST96)
+        for(j=0; j<INIT_MAX_DEVICES; j++) {
+            if(pciFindCardMulti(AT3DVID, AT3DDID, &n, j)) numBoards++;
+            if(pciFindCardMulti(MCRXVID, MCRXDID, &n, j)) numBoards++;
+        }
+#else
+#  error "initNumBoardsInSystem: unknown device!!!"
+#endif
+    }
+    return(numBoards);
+} /* end initNumBoardsInSystem() */
+
+/*-------------------------------------------------------------------
+  Function: initGammaRGB
+  Date: Mar-2-98
+  Implementor(s): atai
+  Library: init
+  Description:
+  initialize Gamma table givin RGB value
+  Arguments:
+  Return:
+  none
+  -------------------------------------------------------------------*/
+FxBool initGammaRGB( double r, double g, double b ) {
+    if ( context )
+        return context->gammaRGB( r, g, b );
+    return FXFALSE;
+} /* initGammaRGB */
+
+/*-------------------------------------------------------------------
+  Function: initGammaTable
+  Date: Mar-2-98
+  Implementor(s): atai
+  Library: init
+  Description:
+  initialize Gamma table givin RGB table
+  Arguments:
+  Return:
+  none
+  -------------------------------------------------------------------*/
+FxBool initGammaTable(FxU32 nentries, FxU32 *r, FxU32 *g, FxU32 *b) {
+    if ( context )
+        return context->initGammaTable( nentries, r, g, b );
+    return FXFALSE;
+} /* initGammaTable */
+
+/*-------------------------------------------------------------------
+  Function: initFindVideoTimingStruct
+  Date: Mar-2-98
+  Implementor(s): atai
+  Library: init
+  Description:
+  find video timing structure
+  Arguments:
+  Return:
+  none
+  -------------------------------------------------------------------*/
+sst1VideoTimingStruct *initFindVideoTimingStruct(GrScreenResolution_t sRes, GrScreenRefresh_t vRefresh) {
+    if ( context )
+        return context->findVidTimingStruct( sRes, vRefresh );
+    return NULL;
+} /* initGamma */
+
Index: trunk/src/opengl/glide/sst1/init/init.h
===================================================================
--- trunk/src/opengl/glide/sst1/init/init.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init.h	(revision 2885)
@@ -0,0 +1,403 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:26 $ 
+**
+*/
+
+#ifndef _TINI_H_
+#define _TINI_H_
+
+#include <3dfx.h>
+#include <sst1vid.h>
+#include <sst1init.h>
+
+#ifdef __cplusplus
+extern "C" { 
+#endif
+    
+/*------------------------------------------------------- 
+  Constants
+  -------------------------------------------------------*/
+/*
+  More slots than you will ever see in a consumer system
+ */
+#define INIT_MAX_DEVICES 8
+  
+/*--IOCTLs-----------------------------------------------*/
+  /* An IOCTL value is appliacable on all systems where the the
+     associated value is ORed into the low eight bits.  The reason for
+     this is so that code that calls the init code can do IOCTLs
+     without worrying about conditional compilation for device
+     dependance.  So, the form of an IOCTL is:
+
+     #define INIT_FOO_IOCTL \
+       ((hw1 | hw2 | ... | hwn) | (number << INIT_OCTL_VALUE_SHIFT))
+
+     Remember, this isn't really an I/O control, but rather a back
+     door for whatever we've forgotten, or whatever may only apply to
+     a small-enough subset of 3Dfx hardware that it doesn't justify
+     modifying the init API.
+ */
+#define INIT_IOCTL_SST1         0x01
+#define INIT_IOCTL_SST96        0x02
+#define INIT_IOCTL_SST97        0x04
+
+
+#define INIT_IOCTL_VALUE_SHIFT  0x8
+
+#define INIT_VIDTIMINGS_IOCTL  \
+  (INIT_IOCTL_SST1 | (0x1 << INIT_IOCTL_VALUE_SHIFT))
+
+  /*
+     Vendor IDs and Device IDs
+     */
+/* 3Dfx Voodoo Graphics */
+#define TDFXVID         0x121A
+#define SST1DID         0x01  
+
+/* Alliance AT3D */
+#define AT3DVID         0x1142
+#define AT3DDID         0x643d
+
+/* Trident T96851 */
+#define T968VID         0x1023
+#define T968DID         0x9660
+
+/* MRTI M510 */
+#define MRTIVID         0x1293
+#define MRTIDID         0x0510
+
+/* Macronix MX86251 Fixme!!! these are bogus !!! XXX ??? */
+#define MCRXVID         0x10d9
+#define MCRXDID         0x8626
+
+/*
+ * (* Murali's comments *)
+ *
+ * Note that *EVERY* one of the following 3 definitions have an exact
+ * counterpart in glide.h. 
+ *
+ * We could have used the glide definitions, but that would affect layering 
+ * glide/src/ * on top of this sst1/init/ * library. So, we use these
+ * redundant defintions, and let glide/src/ * translate from glide.h to
+ * init.h defintions.  (Note that translation is simply a typecast).
+ *
+ * The only exception that proves this rule is sst1vid.h, where something 
+ * used in the init library (GrScreenResolution_t, GrScreenRefresh_t) 
+ * is exposed to the glide application from sst1vid.h, WHICH LIVES IN
+ * THIS DIRECTORY, so we can use these typedefs here directly.
+ *
+ * Here are the relevant counterparts in init.h and glide.h:
+ *
+ * initBuffer_t             GrBuffer_t
+ * initOriginLocation_t     GrOriginLocation_t
+ * initColorFormat_t        GrColorFormat_t
+ * initBufDesc_t              ??? (GrBufDesc_t)
+ *
+ *
+ * PLEASE PLEASE PLEASE 
+ * Make sure that the correspondence is exact.
+ */
+typedef FxU32   InitBuffer_t;
+#define INIT_BUFFER_FRONTBUFFER 0x0
+#define INIT_BUFFER_BACKBUFFER  0x1
+#define INIT_BUFFER_AUXBUFFER   0x2
+#define INIT_BUFFER_DEPTHBUFFER 0x3
+#define INIT_BUFFER_ALPHABUFFER 0x4
+#define INIT_BUFFER_TRIPLEBUFFER 0x5
+
+#define INIT_BUFFER_FIFOBUFFER      0x6
+#define INIT_BUFFER_SCREENBUFFER    0x7
+#define INIT_BUFFER_TEXTUREBUFFER   0x8
+#define INIT_BUFFER_NONE            0xff
+
+typedef FxU32   InitOriginLocation_t;
+#define INIT_ORIGIN_UPPER_LEFT  0x0
+#define INIT_ORIGIN_LOWER_LEFT  0x1
+
+typedef FxI32   InitColorFormat_t;
+#define INIT_COLORFORMAT_ARGB   0x0
+#define INIT_COLORFORMAT_ABGR   0x1
+#define INIT_COLORFORMAT_RGBA   0x2
+#define INIT_COLORFORMAT_BGRA   0x3
+
+typedef FxI32   InitSmoothingMode_t;
+#define INIT_SMOOTHING_DISABLE  0x0
+#define INIT_SMOOTHING_ENABLE   0x1
+
+typedef FxU32   InitControl_t;
+#define INIT_CONTROL_ACTIVATE   0x1
+#define INIT_CONTROL_DEACTIVATE 0x2
+#define INIT_CONTROL_RESIZE     0x3
+#define INIT_CONTROL_MOVE       0x4
+
+typedef struct _InitBufDesc_t {
+    FxU32           bufMagic;
+    InitBuffer_t    bufType;
+    FxU32           bufOffset;
+    FxI32           bufStride;
+    FxU32           bufBPP;             /* bits per pixel */
+} InitBufDesc_t;
+
+/*------------------------------------------------------- 
+  Data Structures
+  -------------------------------------------------------*/
+
+
+/*-------------------------------------------------------------------
+  Structure: VGInfo
+  Date: 10/4/96
+  Implementor(s): jdt
+  Library: Init
+  Description:
+  Drescribes the capabilities of a standard Voodoo Graphics chip.
+  Members:
+  pfxRev    - pixelFx chip rev
+  pfxRam    - frame buffer ram
+  nTFX      - number of texelFx chips
+  tfxRev    - texelFx revision
+  tfxRam    = texelFx ram
+  sliDetect - scan line interleave configuration detected
+  -------------------------------------------------------------------*/
+typedef struct _VGInfo {
+    FxU32   vgBaseAddr;
+    FxU32   pfxRev;
+    FxU32   pfxRam;
+    FxU32   nTFX;
+    FxU32   tfxRev;
+    FxU32   tfxRam;
+    FxBool  sliDetect;
+    FxU32   slaveBaseAddr;
+} VGInfo;
+
+/*-------------------------------------------------------------------
+  Structure: VG96Info
+  Date: 10/4/96
+  Implementor(s): jdt
+  Library: Init
+  Description:
+  Describes the capabilities of VG 96 accelerated VGA board
+  Members:
+  vgaChip - code describing partner VGA part
+            0 - undefined
+            1 - Alliance AT3D
+            2 - Trident T9685
+            3 - MRTI MR510
+            4 - Macronics MX 86251
+  vg96Rev - revision of VG96 chip
+  vg96Ram - frame buffer ram
+  nTFX      - number of texelFx chips
+  tfxRev  - texelFx revision
+  tfxRam  - texelFx ram
+  -------------------------------------------------------------------*/
+typedef struct _VG96Info {
+    FxU32 vgaBaseAddr;
+    FxU32 vg96BaseAddr;
+    FxU32 vgaChip;
+    FxU32 vg96Rev;
+    FxU32 vg96Ram;
+    FxU32 nTFX;
+    FxU32 tfxRev;
+    FxU32 tfxRam;
+} VG96Info;
+
+/*-------------------------------------------------------------------
+  Structure: H3Info
+  Date: 10/4
+  Implementor(s): jdt
+  Library: Init
+  Description:
+  Capabilities of H3
+  Members:
+  h3Rev  - revision of H3 
+  fbRam  - frame buffer ram
+  texRam - texture ram
+  -------------------------------------------------------------------*/
+typedef struct _H3Info {
+    FxU32 h3Rev;
+    FxU32 fbRam;
+    FxU32 texRam;
+} H3Info;
+
+typedef enum { INIT_VOODOO,
+               INIT_VG96,
+               INIT_H3,
+               NUM_3DFX_PRODUCTS
+} TDFXHwClass;
+
+typedef struct _InitRegisterDesc {
+  union {
+    struct {
+      FxU32
+        *baseAddress,           /* Base address */
+        *slavePtr;              /* Scanline interleaved slave */
+    } VGRegDesc;
+    struct {
+      volatile FxU32
+        *baseAddress,           /* Base address */
+        *partnerRegPtr,         /* Partners' registers */
+        *serialStatus,          /* Serial Status register */
+        *fifoApertureBase;      /* Ptr to base of FIFO apurture */
+      
+      FxU8 mclockHi;
+      FxU8 mclockLo;
+    } VG96RegDesc;
+    struct {
+      FxU32
+        *baseAddress;           /* Base address */
+      } BansheeRegDesc;
+    } hwDep;
+} InitRegisterDesc;
+
+/*-------------------------------------------------------------------
+  Structure: InitDeviceInfo
+  Date: 10/4
+  Implementor(s): jdt
+  Library: Init
+  Description:
+  Describes a 3Dfx enabled hardware device in a system.  Includes
+  the device number which will uniquely identify this device in the
+  current system configuration
+  Members:
+  devNumber - unique device number
+  class     - 
+  -------------------------------------------------------------------*/
+typedef struct _InitDeviceInfo {
+    FxU32        devNumber;
+    TDFXHwClass  hwClass;
+    FxU16
+      vendorID, deviceID;
+    union {
+      VGInfo   vgInfo;
+      VG96Info vg96Info;
+      H3Info   h3Info;
+    } hwDep;
+    InitRegisterDesc regs;
+} InitDeviceInfo;
+
+
+typedef FxU32 InitSwapType_t;
+#define INIT_SWAP_FLIP 0x0
+#define INIT_SWAP_BLT  0x1
+
+typedef struct _InitFIFOData {
+  FxU32
+    cpuType;                    /* 5 for Pentium, 6 for Pentium Pro */
+  union {
+    struct {
+      FxU32 fifoFree;
+      FxU32 memFifoStatusLwm;
+    } vgFIFOData;
+    struct {
+      volatile FxU32
+        *fifoVirt,              /* linear address of FIFO Start */
+        fifoMax,                /* Max linear address in FIFO  */
+        fifoPhys,               /* Physical location of FIFO */
+        fifoCur,                /* Current Wrap */
+        *fifoPtr,               /* Pointer to current FIFO entry */
+        fifoSize;               /* Size of FIFO in bytes */
+
+#if SST96_ALT_FIFO_WRAP
+      /* dpc - 10 sep 1997 FixMe! - 
+       * I need to pass the init code the block size that I want to
+       * write, but I don't want to change the interface out from
+       * everyone else. If we re-visit the init code interface then
+       * fix me then.  
+       */
+      FxI32  blockSize;
+
+      FxU32  fifoRead;          /* Last known hw read ptr */
+      FxI32  roomToReadPtr;     /* # of bytes to fifoRead */
+      FxI32  roomToEnd;         /* # of bytes to fifoEnd */
+
+      InitRegisterDesc* regDesc;
+#endif /* SST96_ALT_FIFO_WRAP */
+
+      FxBool
+        fifoLfb;                /* LFB FIFO or alternate? */
+    } vg96FIFOData;
+  } hwDep;
+} InitFIFOData;
+
+/*------------------------------------------------------- 
+  Hardware Independant Setup Calls
+  -------------------------------------------------------*/
+typedef FxBool InitHWEnumCallback( const InitDeviceInfo *info );
+typedef void InitWriteCallback( FxU32 *linaddr, FxU32 val );
+
+void   initEnumHardware( InitHWEnumCallback *cb );
+volatile FxU32* initMapBoard(const FxU32 boardNum);
+void   initClose (void);
+FxBool initGetDeviceInfo( FxU32 devNumber, InitDeviceInfo *info );
+FxBool initDeviceSelect( FxU32 devNumber );
+
+/*------------------------------------------------------- 
+  Driver Calls
+  -------------------------------------------------------*/
+void    initSetWriteMethod( InitWriteCallback *wcb );
+FxBool  initSetVideo( FxU32                   hWnd,
+                      GrScreenResolution_t    sRes,
+                      GrScreenRefresh_t       vRefresh,
+                      InitColorFormat_t       cFormat,
+                      InitOriginLocation_t    yOrigin,
+                      int                     nColBuffers,
+                      int                     nAuxBuffers,
+                      int                     *xres, 
+                      int                     *yres,
+                      int                     *fbStride,
+                      sst1VideoTimingStruct   *vidTimings);
+void    initRestoreVideo( void );
+
+FxBool  initEnableTransport( InitFIFOData *info );
+void    initDisableTransport( void );
+
+void    initSwapBuffers( FxU32 code );
+FxU32   initStatus( void );
+FxBool  initBusy( void );
+void    initIdle( void );
+void   *initGetBufferPtr( InitBuffer_t buffer, int *strideBytes );
+void    initRenderBuffer( InitBuffer_t buffer );
+void    initOrigin( InitOriginLocation_t origin );
+void    initIOCtl( FxU32 token, void *argument );
+FxBool  initControl (FxU32 code);
+FxBool  initWrapFIFO(InitFIFOData *fifoData);
+
+/* SST-1 Flotsam */
+void    initGamma( double gamma );
+void    initSliPciOwner( FxU32 *regbase, FxU32 owner );
+FxU32   initNumBoardsInSystem( void );
+
+const char*
+myGetenv(const char*);
+
+/*
+** Glide 3 init functions
+*/
+FxBool initGammaRGB( double r, double g, double b );
+FxBool initGammaTable(FxU32 nentries, FxU32 *r, FxU32 *g, FxU32 *b);
+sst1VideoTimingStruct *initFindVideoTimingStruct(GrScreenResolution_t sRes, GrScreenRefresh_t vRefresh) ;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TINI_H_ */
Index: trunk/src/opengl/glide/sst1/init/init96/atvga.h
===================================================================
--- trunk/src/opengl/glide/sst1/init/init96/atvga.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init96/atvga.h	(revision 2885)
@@ -0,0 +1,86 @@
+/* 
+ * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ * FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ * 
+ * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ * TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ * THE UNITED STATES.  
+ * 
+ * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+ */
+
+
+#ifndef __ATVGA_H__
+#define __ATVGA_H__
+
+/*
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:27 $ 
+**
+*/
+
+#define VGA_REGISTER_INPUT_STATUS_1_MONO                    0x3BA
+#define VGA_REGISTER_INPUT_STATUS_1_COLOR                   0x3DA
+#define VR_IS1_DISPLAY_INACTIVE                             (1 << 0)
+#define VR_IS1_DISPLAY_VRETRACE                             (1 << 3)
+
+#define VGA_REGISTER_SEQUENCER                              0x3C4
+#define AR_SEQ_REMAP_CONTROL                                        0x1B    /* 6 */
+#define AR_SEQ_FLAT_MODEL_CONTROL                                   0x1C    /* 6 */
+#define AR_SEQ_ALTERNATE_ACCESS_POINTER                     0x1D    /* 8 */
+#define AR_SEQ_ALTERNATE_ACCESS_DECODE_LO_INDEX             0x1E    /* 8 */
+#define AR_SEQ_ALTERNATE_ACCESS_DECODE_HI_INDEX             0x1F    /* 8 */
+
+
+#define MMEXT_REGISTER_WINDOW0_CONTROL                      0x082
+#define MMEXT_REGISTER_WINDOW0_BASE_ADDRESS                 0x084
+#define MMEXT_REGISTER_WINDOW0_STRETCH_FACTOR_HORIZONTAL_1  0x086
+#define MMEXT_REGISTER_WINDOW0_STRETCH_FACTOR_HORIZONTAL_2  0x088
+#define MMEXT_REGISTER_WINDOW0_STRETCH_FACTOR_VERTICAL_1    0x08A
+#define MMEXT_REGISTER_WINDOW0_STRETCH_FACTOR_VERTICAL_2    0x08C
+#define MMEXT_REGISTER_WINDOW_SEQUENCE_CONTROL              0x08E
+
+#define MMEXT_REGISTER_DISPLAY_MEMORY_CONFIGURATION         0x0C4   /* 12 */
+
+#define MMEXT_REGISTER_PIXEL_FIFO_REQUEST_POINT             0xD4    /* 24 */
+#define MMEXT_REGISTER_ENABLE_EXTENDED_REGISTERS            0x0DB   /* 4 */
+#define AR_ENABLE_DOS_SPACE                                 0x01
+#define AR_ENABLE_LINEAR_SPACE                              0x02
+#define AR_ENABLE_COPROCESSOR_APERTURE                      0x04
+#define AR_ENABLE_SECOND_LINEAR_APERTURE                    0x08
+
+#define MMEXT_REGISTER_MCLK_CONTROL                         0x0E8   /* 8 */
+#define MMEXT_REGISTER_MCLK_DENOMINATOR                     0x0E9   /* 8 */
+#define MMEXT_REGISTER_MCLK_NUMERATOR                       0x0EA   /* 8 */
+
+#define MMEXT_REGISTER_SERIAL_INPUT                         0x1F4   /* 16 */
+
+#define MMEXT_REGISTER_TILE                                 0x200
+#define TILE_REGISTER_CONTROL                               0x00
+#define TILE_REGISTER_DISPLAY_POSITION_LEFT                 0x02
+#define TILE_REGISTER_DISPLAY_POSITION_RIGHT                0x04
+#define TILE_REGISTER_DISPLAY_POSITION_BOTTOM               0x06
+#define TILE_REGISTER_DATA_WIDTH                            0x08
+#define TILE_REGISTER_DATA_BASE_LOCATION_LO                 0x0A
+#define TILE_REGISTER_DATA_BASE_LOCATION_HI                 0x0C
+
+#define VGA_CRTC_INDEX                          0x3D4
+#define VGA_CRTC_DATA                           0x3D5
+#define VCRTC_SERIAL_START_ADDRESS_HI           0x0C
+#define VCRTC_SERIAL_START_ADDRESS_LO           0x0D
+#define ATCRTC_SERIAL_OVERFLOW                  0x1C
+#define VGA_INPUT_STATUS_1C                     0x3DA
+#define VIS1C_PIXEL_DISPLAY_INACTIVE            BIT(0)
+#define VIS1C_VERTICAL_RETRACE_ACTIVE           BIT(3)
+
+#endif
+
Index: trunk/src/opengl/glide/sst1/init/init96/dxdrvr.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/init96/dxdrvr.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init96/dxdrvr.c	(revision 2885)
@@ -0,0 +1,1009 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Log: dxdrvr.c,v $
+** Revision 1.1  2000-02-25 00:31:28  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 34    1/12/98 10:22p Dow
+ * H3D Stereo Support
+ * 
+ * 33    11/06/97 9:51a Jdt
+ * Fixes window resize events to not crash/hang
+ * 
+ * 32    10/01/97 3:21p Atai
+ * fix 819, DOS tests flicker on glide
+ * 
+ * 31    9/08/97 12:05p Atai
+ * fixed resize problem in dxControl()
+ * 
+ * 30    8/28/97 10:24a Odo
+ * moved debugging varaible
+ * 
+ * 29    8/27/97 10:32a Dow
+ * added more debugging info
+ * 
+ * 28    8/21/97 4:24p Dow
+ * Fixed @#$%! C++ Comments, Added Debugging info
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:28 $ 
+**
+*/
+
+/* 3Dfx Headers */
+#include <3dfx.h>
+#include <fxpci.h>
+#include <gdebug.h>
+#include <sst.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <string.h>
+
+#ifdef __DOS32__
+#include <i86.h>
+#endif
+
+#include <init.h>
+
+/* Local Headers */
+#include "init96.h"
+#include "fxinit96.h"
+
+#define VG96_BUF_MAGIC  0x666
+
+FxBool tripleBuffering = 0;
+
+#ifdef GDBG_INFO_ON
+static char *bufTypeNames[] = {
+  "INIT_BUFFER_FRONTBUFFER",
+  "INIT_BUFFER_BACKBUFFER",
+  "INIT_BUFFER_AUXBUFFER",
+  "INIT_BUFFER_DEPTHBUFFER",
+  "INIT_BUFFER_ALPHABUFFER",
+  "INIT_BUFFER_TRIPLEBUFFER",
+  "INIT_BUFFER_FIFOBUFFER",
+  "INIT_BUFFER_SCREENBUFFER",
+  "INIT_BUFFER_TEXTUREBUFFER"
+};
+#endif
+
+#if defined( __WIN32__) && defined(INIT_ACCESS_DDRAW)
+#define WIN32_LEAN_AND_MEAN 
+#include <windows.h> 
+#include <ddraw.h> 
+
+#define NUM_BUFS 6
+
+static HWND                 hWndApp     = 0;
+static FxU32                FifoOffset  = 0;
+static FxU32                Width       = 0; 
+static FxU32                Height      = 0;
+static FxBool               IsFullScreen = 0;
+static InitBufDesc_t        BufDesc[NUM_BUFS]  = {0};
+#ifdef H3D
+static int                                      pageFlip        = 0;
+#endif
+
+/* Direct Draw stuff */
+static LPDIRECTDRAWCLIPPER  lpClipper   = NULL;
+static LPDIRECTDRAWSURFACE  lpFront     = NULL;
+static LPDIRECTDRAWSURFACE  lpBack      = NULL;
+static LPDIRECTDRAWSURFACE  lpAux       = NULL;
+static LPDIRECTDRAWSURFACE  lpTriple    = NULL;
+static LPDIRECTDRAW2        lpDD        = NULL;
+static LPDIRECTDRAW         lpDD1       = NULL;
+
+
+
+FxBool
+ErrorMessage(HWND hWnd, char *err)
+{
+  GDBG_INFO((0, "Error %s \n", err));
+//  MessageBox( hWnd, err, "ERROR", MB_OK );
+  return FALSE;
+} /* ErrorMessage */
+
+
+
+/*
+ * Takes a DirectDraw Surface object (LPDIRECTDRAWSURFACE), looks up its
+ * description (DDSURFACEDESC), and returns a pointer to the surface and its
+ * stride value in pDesc.
+ */
+FxBool
+_dxSurfaceToBufDesc(LPDIRECTDRAWSURFACE lpSurf, InitBufDesc_t *pDesc)
+{
+  DDSURFACEDESC   ddsd;
+  
+  ddsd.dwSize = sizeof(ddsd);
+  if (IDirectDrawSurface2_Lock(lpSurf, NULL, &ddsd, DDLOCK_WAIT, NULL) 
+      !=DD_OK) {
+    return ErrorMessage(hWndApp, "_dxSurfaceToBufDesc: DdrawSurface Lock failed\n");
+  }
+  
+  /* pDesc->bufType should be filled in by caller */
+  pDesc->bufOffset = (FxU32) (ddsd.lpSurface);        /* virtual address. */
+  pDesc->bufStride = (FxI32) (ddsd.lPitch);           /* in bytes         */
+  pDesc->bufBPP    = (FxI32) 16;
+  
+  IDirectDrawSurface2_Unlock(lpSurf, NULL);
+  return FXTRUE;
+} /* _dxSurfaceToBufDesc */
+
+
+
+/*
+ * Convert front, back and aux surfaces from DDraw to Glide bufDescriptors.
+ */
+FxBool
+_dxDDrawToGlideDesc(InitBufDesc_t *pDesc)
+{
+  InitBufDesc_t   *dFront  = &pDesc[0];
+  InitBufDesc_t   *dBack   = &pDesc[1];
+  InitBufDesc_t   *dAux    = &pDesc[2];
+  InitBufDesc_t   *dFifo   = &pDesc[3];
+  InitBufDesc_t   *dScreen = &pDesc[4];
+  InitBufDesc_t   *dTriple = &pDesc[5];
+  
+  GDBG_INFO((80, "_dxDDrawToGlide entry\n"));
+  
+  /* Initialize all descriptors. */
+  dScreen->bufMagic  = VG96_BUF_MAGIC;
+  dScreen->bufType   = INIT_BUFFER_SCREENBUFFER;
+  dScreen->bufOffset = 0;
+  dScreen->bufStride = 0;
+  dScreen->bufBPP    = 0;
+  
+  /* Get info about screen (primary display) */
+  dScreen->bufType  = INIT_BUFFER_SCREENBUFFER;
+  if (!_dxSurfaceToBufDesc( lpFront, dScreen))
+    return ErrorMessage(hWndApp, "Couldn't get Screen Info");
+  
+  *dFront = *dBack = *dAux = *dFifo =
+  *dTriple =
+  *dScreen;
+  
+  dFront->bufType   = INIT_BUFFER_FRONTBUFFER;
+
+  /* Get info about back buffer */
+  dBack->bufType  = INIT_BUFFER_BACKBUFFER;
+  if (!_dxSurfaceToBufDesc( lpBack, dBack))
+    return ErrorMessage(hWndApp, "Couldn't get Backbuffer Info");
+  
+  /* Get info about aux buffer */
+  dAux->bufType = INIT_BUFFER_AUXBUFFER;
+  if (!_dxSurfaceToBufDesc( lpAux, dAux)) 
+    return ErrorMessage(hWndApp, "Couldn't get AuxBuffer Info");
+  
+  /* Get info about triple buffer */
+  if (tripleBuffering) {
+    dTriple->bufType  = INIT_BUFFER_TRIPLEBUFFER;
+    if (!_dxSurfaceToBufDesc( lpTriple, dTriple))
+      return ErrorMessage(hWndApp, "Couldn't get triple buffer Info");
+  }
+
+  /* Get info about cmdFifo */
+  dFifo->bufType   = INIT_BUFFER_FIFOBUFFER;
+  dFifo->bufOffset = FifoOffset;
+  dFifo->bufStride = 65536 << 1; /* Fixme!!! what's this? */
+  
+  /* Now convert buf addresses for draw buffers into video memory offsets */
+  dFront->bufOffset -= dScreen->bufOffset;
+  dBack ->bufOffset -= dScreen->bufOffset;
+  dAux  ->bufOffset -= dScreen->bufOffset;
+  if (tripleBuffering)
+    dTriple->bufOffset -= dScreen->bufOffset;
+  
+  GDBG_INFO((80, "_dxDDrawToGlideDesc: dFront->bufOffset = 0x%x\n", dFront->bufOffset));
+  GDBG_INFO((80, "_dxDDrawToGlideDesc: dBack->bufOffset = 0x%x\n", dBack->bufOffset));
+  GDBG_INFO((80, "_dxDDrawToGlideDesc: dAux->bufOffset = 0x%x\n", dAux->bufOffset));
+  GDBG_INFO((80, "_dxDDrawToGlideDesc: dFifo->bufOffset = 0x%x\n", dFifo->bufOffset));
+  if (tripleBuffering)
+    GDBG_INFO((80, "_dxDDrawToGlideDesc: dTriple->bufOffset = 0x%x\n", dTriple->bufOffset));
+
+  GDBG_INFO((80,
+    "F:%.06x %5d B:%.06x %5d B2:%.06x %5d A:%.06x %5d, C:%.06x %5d\n",
+             dFront->bufOffset, dFront->bufStride,
+             dBack ->bufOffset, dBack ->bufStride,
+             dTriple->bufOffset, dTriple->bufStride,
+             dAux  ->bufOffset, dAux  ->bufStride,
+             dFifo ->bufOffset, dFifo ->bufStride));
+  return TRUE;
+} /* _dxDDrawToGlideDesc */
+
+
+
+/*
+ * Allocate (or re-allocate for WM_SIZE) buffers from DDraw.
+ */
+FxBool
+#ifdef H3D
+_dxAllocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc, int pageFlip)
+#else
+_dxAllocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc)
+#endif
+{
+  DDSURFACEDESC   ddsd;
+  
+#ifdef H3D
+  GDBG_INFO((80, "_dxAS: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d, pageFlip=%d\n", 
+             hWndApp, IsFullScreen, xRes, yRes, vRefresh, pageFlip));
+#else
+  GDBG_INFO((80, "_dxAS: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d\n", 
+             hWndApp, IsFullScreen, xRes, yRes, vRefresh));
+#endif
+  
+  if (lpDD1 == NULL) {
+    if (DirectDrawCreate( NULL, &lpDD1, NULL ) != DD_OK) {
+      return ErrorMessage(hWndApp, "DirectDrawCreate Failed!");
+    } else {
+      GDBG_INFO((80, "_dxAS: DDraw Obj created!\n"));
+    }
+  } else {
+    GDBG_INFO((80, "_dxAS: DDraw Obj already existed!\n"));
+  }
+
+  if (IDirectDraw_QueryInterface( lpDD1, &IID_IDirectDraw2, 
+                                   (LPVOID*)&lpDD) !=DD_OK) {
+
+    IDirectDraw_Release( lpDD1 );
+    lpDD1 = NULL;
+    lpDD  = NULL;
+    return ErrorMessage(hWndApp, "DDraw2 interface object failed!");
+  } else {
+    GDBG_INFO((80, "_dxAS: DDraw2 Obj created!\n"));
+  }
+  
+  /*
+   * Make sure this is done after creating direct draw object!!!
+   * First time, only one time, get ourselves a command fifo.
+   * Fix me - XXX
+   */
+  if (FifoOffset == 0) {
+    FifoOffset = init96GetFBVram() - 65536*3; /* fixme!!! why 3? */
+  }
+  
+  /*
+   * If there are any previously allocated surfaces, free them now
+   * before asking for more.
+   */
+  if( lpClipper) IDirectDrawSurface2_Release( lpClipper);
+  if( lpAux    ) IDirectDrawSurface2_Release( lpAux    );
+  if( lpBack   ) IDirectDrawSurface2_Release( lpBack   );
+  if( lpTriple ) IDirectDrawSurface2_Release( lpTriple    );
+  if( lpFront  ) IDirectDrawSurface2_Release( lpFront  );
+  
+  lpClipper = NULL;
+  lpFront   = NULL;
+  lpBack    = NULL;
+  lpTriple    = NULL;
+  lpAux     = NULL;
+  
+  if ( !IsFullScreen ) {        /* In a window */
+
+    GDBG_INFO((80, "_dxAS: Allocating buffers for a windowed mode\n"));
+
+    /* Verify screen pixel format is 16bpp, and set cooperative level */
+    ddsd.dwSize = sizeof( ddsd );
+    if (IDirectDraw2_GetDisplayMode( lpDD, &ddsd ) != DD_OK)
+      return ErrorMessage(hWndApp,  "Couldn't get display mode!");
+
+    if (ddsd.ddpfPixelFormat.dwRGBBitCount / 8 != 2) 
+      return ErrorMessage(hWndApp,  "Display is not in 16bpp format!");
+
+    if (IDirectDraw2_SetCooperativeLevel(lpDD,hWndApp, DDSCL_NORMAL ) != DD_OK)
+      return ErrorMessage(hWndApp, "Couldn't set cooperative level!");
+
+    /* Allocate Front Buffer Surface */
+    ddsd.dwSize         = sizeof( ddsd );
+    ddsd.dwFlags        = DDSD_CAPS;
+    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE;
+        
+    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) 
+      return ErrorMessage(hWndApp, "Couldn't allocate primary surface!");
+
+    GDBG_INFO((80, "_dxAS: Screen: xRes = %d, yRes = %d, stride = %d\n",
+               xRes, yRes, ddsd.lPitch));
+    /* From jdt */
+    if (IDirectDraw2_CreateClipper( lpDD, 0, &lpClipper, 0 ) != DD_OK) 
+      return ErrorMessage(hWndApp, "Create Clipper failed!\n");
+
+    if (IDirectDrawClipper_SetHWnd( lpClipper, 0, hWndApp ) != DD_OK) 
+      return ErrorMessage(hWndApp, "Clipper SethWnd failed!\n");
+
+    if (IDirectDrawSurface2_SetClipper( lpFront, lpClipper ) != DD_OK) 
+      return ErrorMessage(hWndApp, "Set Clipper failed!\n");
+
+    /* Always allocate back buffer.
+     */
+    ddsd.dwSize         = sizeof( ddsd );
+    ddsd.dwFlags        = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
+    ddsd.dwWidth        = xRes;
+    ddsd.dwHeight       = yRes;
+    ddsd.ddsCaps.dwCaps =
+      DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE;
+        
+    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK) 
+      return ErrorMessage(hWndApp,  "Couldn't allocate secondary surface!" );
+
+    GDBG_INFO((80, "_dxAS: Back buffer allocated!\n"));
+
+    /* 
+     * Always allocate Aux Buffer Surface 
+     * XXX - (use nAuxBuffers, and deal with 8bpp for alpha)
+     */
+    ddsd.dwSize         = sizeof( ddsd );
+    ddsd.dwFlags        = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
+    ddsd.dwWidth        = xRes;
+    ddsd.dwHeight       = yRes;
+    ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY
+        | DDSCAPS_3DDEVICE;
+        
+    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) 
+      return ErrorMessage(hWndApp,  "Couldn't allocate aux surface" );
+
+    GDBG_INFO((80, "_dxAS: Aux Buffer allocated!\n"));
+
+  } else {
+    
+    /* Full screen - Set Exclusive Mode, change resolution,  */
+    GDBG_INFO((80, "_dxAS: Setting Full screen exclusive mode!\n"));
+    
+    if (IDirectDraw2_SetCooperativeLevel(lpDD, hWndApp, 
+                                         DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ) != DD_OK)
+      return ErrorMessage(hWndApp, "Couldn't set cooperative level!");
+    
+    if (IDirectDraw2_SetDisplayMode( lpDD, xRes, yRes, 16, 0,0) != DD_OK)
+      return ErrorMessage(hWndApp,  "Couldn't set display mode!");
+    
+    /* Allocate Front/Back Buffer Surfaces, skip triple buffer XXX */
+    ddsd.dwSize            = sizeof( ddsd );
+    ddsd.dwFlags           = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
+    ddsd.dwBackBufferCount = 1;
+    ddsd.ddsCaps.dwCaps    = DDSCAPS_PRIMARYSURFACE | 
+      DDSCAPS_FLIP | 
+        DDSCAPS_COMPLEX |
+          DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE;
+    
+    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) 
+      return ErrorMessage(hWndApp, "Couldn't allocate primary surface!");
+    
+    /* Get back buffer information */
+    ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
+    if (IDirectDrawSurface2_GetAttachedSurface( lpFront, &ddsd.ddsCaps, 
+                                               &lpBack) != DD_OK)
+      return ErrorMessage(hWndApp, "Couldn't get back buffer info!\n");
+    
+    GDBG_INFO((80, "_dxAS: Full Screen: front/back buffer allocated!\n"));
+    
+    /* Allocate Aux Buffer Surface - XXX */
+    ddsd.dwSize         = sizeof( ddsd );
+    ddsd.dwFlags        = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
+    ddsd.dwWidth        = xRes;
+    ddsd.dwHeight       = yRes;
+    ddsd.ddsCaps.dwCaps = 
+      DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE;
+    
+    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) 
+      return ErrorMessage(hWndApp,  "Couldn't allocate aux surface" );
+
+    GDBG_INFO((80, "_dxAS: Full Screen: aux buffer allocated!\n"));
+    
+/*
+ * Triple buffer hack: full-screen only for now.  Allocate as Aux DD surf,
+ * after everything else N.B. Allocation order may be important!!!
+ * god knows how DD would implement dwBackBufferCount == 2
+ */
+    if (tripleBuffering) {
+      if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpTriple, 0 ) != DD_OK) 
+        return ErrorMessage(hWndApp,  "Couldn't allocate triple buffer" );
+
+      GDBG_INFO((80, "_dxAS: Triple buffer allocated!\n"));
+    }
+  }
+  
+  /* Convert direct draw surfaces to Glide's idea of buffer descriptors */
+  return _dxDDrawToGlideDesc(pDesc);
+} /* _dxAllocSurfaces */
+
+FxBool
+_dxReallocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc)
+
+{
+  DDSURFACEDESC   ddsd;
+  const char      *errorMessage = "no error";
+
+  /* for now this is a goddamn baseball bat 
+     it can be trimmed down */
+  if ( !IsFullScreen ) { /* this *REALLY* should be called for fullscreen */
+    if( lpClipper) IDirectDrawClipper_Release( lpClipper);
+    if( lpAux    ) IDirectDrawSurface2_Release( lpAux    );
+    if( lpBack   ) IDirectDrawSurface2_Release( lpBack   );
+    if( lpTriple ) IDirectDrawSurface2_Release( lpTriple    );
+    if( lpFront  ) IDirectDrawSurface2_Release( lpFront  );
+    
+    lpClipper = NULL;
+    lpFront   = NULL;
+    lpBack    = NULL;
+    lpTriple  = NULL;
+    lpAux     = NULL;
+  
+    /* Verify screen pixel format is 16bpp, and set cooperative level */
+    ddsd.dwSize = sizeof( ddsd );
+
+    /* Allocate Front Buffer Surface */
+    ddsd.dwSize         = sizeof( ddsd );
+    ddsd.dwFlags        = DDSD_CAPS;
+    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE;
+        
+    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) {
+      errorMessage =  "Couldn't allocate primary surface!";
+      goto FUBAR;
+    }
+
+    /* From jdt */
+    if (IDirectDraw2_CreateClipper( lpDD, 0, &lpClipper, 0 ) != DD_OK) {
+      errorMessage = "Create Clipper failed!\n";
+      goto FUBAR;
+    }
+
+    if (IDirectDrawClipper_SetHWnd( lpClipper, 0, hWndApp ) != DD_OK) {
+      errorMessage = "Clipper SethWnd failed!\n";
+      goto FUBAR;
+    }
+
+    if (IDirectDrawSurface2_SetClipper( lpFront, lpClipper ) != DD_OK) {
+      errorMessage = "Set Clipper failed!\n";
+      goto FUBAR;
+    }
+
+    /* Always allocate back buffer.
+     */
+    ddsd.dwSize         = sizeof( ddsd );
+    ddsd.dwFlags        = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
+    ddsd.dwWidth        = xRes;
+    ddsd.dwHeight       = yRes;
+    ddsd.ddsCaps.dwCaps =
+      DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE;
+        
+    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK) {
+      errorMessage = "Couldn't allocate secondary surface!";
+      goto FUBAR;
+    }
+
+    /* 
+     * Always allocate Aux Buffer Surface 
+     * XXX - (use nAuxBuffers, and deal with 8bpp for alpha)
+     */
+    ddsd.dwSize         = sizeof( ddsd );
+    ddsd.dwFlags        = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
+    ddsd.dwWidth        = xRes;
+    ddsd.dwHeight       = yRes;
+    ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY
+        | DDSCAPS_3DDEVICE;
+        
+    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) {
+      errorMessage = "Couldn't allocate aux surface";
+      goto FUBAR;
+    }
+  }
+  return _dxDDrawToGlideDesc(pDesc);
+FUBAR:
+  /* if you don't free these you can't make another attempt */
+  if( lpClipper) IDirectDrawClipper_Release( lpClipper);
+  if( lpAux    ) IDirectDrawSurface2_Release( lpAux    );
+  if( lpBack   ) IDirectDrawSurface2_Release( lpBack   );
+  if( lpTriple ) IDirectDrawSurface2_Release( lpTriple    );
+  if( lpFront  ) IDirectDrawSurface2_Release( lpFront  );
+  lpClipper = NULL;
+  lpFront   = NULL;
+  lpBack    = NULL;
+  lpTriple  = NULL;
+  lpAux     = NULL;
+  return ErrorMessage( hWndApp, (char*)errorMessage );
+} /* _dxReallocSurfaces */
+
+/*
+ * Restore lost surfaces, or move the window.
+ * Note: Resizing is done by deleting and re-allocation, and is done in
+ * _dxAllocSurfaces();
+ */
+static FxBool
+_dxRestoreSurfaces(InitBufDesc_t *pDesc)
+{
+  if (lpDD == NULL) return TRUE;
+  
+  if (IDirectDrawSurface2_IsLost(lpFront) == DDERR_SURFACELOST) {
+    if (IDirectDrawSurface2_Restore(lpFront) != DD_OK) 
+      return ErrorMessage(hWndApp, "Front Buffer restore failure\n");
+  }
+  
+  if (!IsFullScreen) {
+    if (IDirectDrawSurface2_IsLost(lpBack) == DDERR_SURFACELOST) {
+      if (IDirectDrawSurface2_Restore(lpBack) != DD_OK) 
+        return ErrorMessage(hWndApp, "Back  Buffer restore failure\n");
+    }
+  }
+  
+  if (IDirectDrawSurface2_IsLost(lpAux) == DDERR_SURFACELOST) {
+    if (IDirectDrawSurface2_Restore(lpAux) != DD_OK) 
+      return ErrorMessage(hWndApp, "Aux   Buffer restore failure\n");
+  }
+  
+  if (!IsFullScreen) {
+    if (IDirectDrawSurface2_IsLost(lpTriple) == DDERR_SURFACELOST) {
+      if (IDirectDrawSurface2_Restore(lpTriple) != DD_OK) 
+        return ErrorMessage(hWndApp, "Back  Buffer restore failure\n");
+    }
+  }
+  
+  GDBG_INFO((80, "_dxRS: restore surfaces OK\n"));
+  return _dxDDrawToGlideDesc(pDesc);
+} /* _dxRestoreSurfaces */
+
+FxBool
+dxOpen(
+    FxU32                hWindow,
+    GrScreenResolution_t sRes,
+    GrScreenRefresh_t    vRefresh,
+    InitColorFormat_t    cFormat,
+    InitOriginLocation_t yOrigin,
+    int                  nColBuffers,
+    int                  nAuxBuffers,
+    InitBufDesc_t        *pBufDesc,         // return values
+    int                  *width,
+    int                  *height,
+    InitSwapType_t       *swapType
+)
+{
+  int     i;
+
+#ifdef H3D
+  pageFlip = GR_RESOLUTION_IS_AUTOFLIPPED(sRes);
+  GDBG_INFO((80, "dxOpen: hWnd = %x, sRes=%d, yOrg=%d, ncb=%d, nab=%d, pageFlip=%d\n",
+            hWindow, sRes, yOrigin, nColBuffers, nAuxBuffers, pageFlip ));
+#else
+  GDBG_INFO((80, "dxOpen: hWnd = %x, sRes=%d, yOrg=%d, ncb=%d, nab=%d\n",
+             hWindow, sRes, yOrigin, nColBuffers, nAuxBuffers));
+#endif
+
+  /*
+   * Get ourselves a valid window handle 
+   */
+  hWndApp = (hWindow == 0) ? GetActiveWindow() : (HWND) hWindow;
+
+  if (hWndApp == NULL) {
+    return ErrorMessage(hWndApp, "VRush needs a valid window handle!\n");
+  }
+
+  if (sRes == GR_RESOLUTION_NONE ) { /* In a window */
+    RECT    rect;
+
+    /* Find out how big the window is */
+    GetClientRect(hWndApp, &rect);
+    IsFullScreen = FXFALSE;
+    Width = rect.right;
+    Height = rect.bottom;
+  } else {
+    /* Full screen mode - convert resolution to Width, Height */
+    static int _w[] = {320,320,400,512,640,640,640,640,800,960,856,512};
+    static int _h[] = {200,240,256,384,200,350,400,480,600,720,480,256};
+#ifdef H3D
+    static int _w1[] = {640,800};
+    static int _h1[] = {480,600};
+#endif
+
+#ifdef H3D
+    if ((sRes <  GR_RESOLUTION_MIN) ||
+        (sRes >  GR_RESOLUTION_MAX) &&
+        (!GR_RESOLUTION_IS_AUTOFLIPPED(sRes)) ) 
+#else
+    if ((sRes <  GR_RESOLUTION_320x200) ||
+        (sRes >  GR_RESOLUTION_512x256)) 
+#endif
+      return ErrorMessage(hWndApp, "Bad Fullscreen resolution");
+
+    tripleBuffering = (nColBuffers == 3);
+
+    IsFullScreen = FXTRUE;
+#ifdef H3D
+    if (GR_RESOLUTION_IS_AUTOFLIPPED(sRes)) {
+      Width   = _w1[sRes-GR_RESOLUTION_AUTOFLIPPED_MIN];
+      Height  = _h1[sRes-GR_RESOLUTION_AUTOFLIPPED_MIN];
+    } else {
+      Width   = _w[sRes];
+      Height  = _h[sRes];
+    }
+#else
+    Width   = _w[sRes];
+    Height  = _h[sRes];
+#endif
+  }
+
+  GDBG_INFO((80, "dxOpen: W=%d, H=%d, FullScr=%d, vRefresh=%d\n",
+             Width, Height, IsFullScreen, vRefresh));
+
+#ifdef H3D
+  if (!_dxAllocSurfaces(Width, Height, vRefresh, BufDesc, pageFlip))
+    return ErrorMessage(hWndApp, "failed dxOpen");
+#else
+  if (!_dxAllocSurfaces(Width, Height, vRefresh, BufDesc))
+    return ErrorMessage(hWndApp, "failed dxOpen");
+#endif
+
+
+  GDBG_INFO((80, "_dxAllocSurfaces OK!!!\n"));
+
+  for (i=0; i< NUM_BUFS; i++) {
+    pBufDesc[i] = BufDesc[i];
+    GDBG_INFO((80, "dxOpen: pBufDesc[%d]: \n", i));
+    GDBG_INFO((80, "\tbufMagic = 0x%x\n", pBufDesc[i].bufMagic));
+    GDBG_INFO((80, "\tbufType = 0x%x\n", pBufDesc[i].bufType));
+    GDBG_INFO((80, "\tbufOffset = 0x%x\n", pBufDesc[i].bufOffset));
+    GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride));    
+    GDBG_INFO((80, "\tbufBPP = 0x%x\n", pBufDesc[i].bufBPP));
+  }
+
+  *width = Width;
+  *height = Height;
+  *swapType = (IsFullScreen) ? INIT_SWAP_FLIP : INIT_SWAP_BLT;
+
+  if ( curHALData->initSetVideo ) {
+    curHALData->initSetVideo( sRes, vRefresh, 
+                             (FxU32*)width, (FxU32*)height );
+  }
+
+  GDBG_INFO((80, "dxOpen:  Returning TRUE\n"));
+
+  return FXTRUE;
+
+} /* dxOpen */
+
+FxBool
+dxControl(FxU32 code, InitBufDesc_t *pBufDesc, int *width, int *height)
+{
+  RECT    rect;
+  int     i;
+  
+  GDBG_INFO((80, "dxControl: code = %d\n", code));
+  
+  /* dx is not initizized */
+  if ( lpDD== NULL ) {
+    return TRUE;
+  }
+  
+  /* Why was I called? */
+  switch(code) {
+  case INIT_CONTROL_RESIZE:     /* recreate surfaces */
+    GetClientRect(hWndApp, &rect);
+    if ((Width != (FxU32) rect.right) || (Height != (FxU32) rect.bottom)) {
+      Width = rect.right;
+      Height = rect.bottom;
+      GDBG_INFO((120, "W and H changed to %d %d\n", 
+                 Width, Height)); 
+
+      if (!_dxReallocSurfaces(Width, Height, 0, BufDesc)) {
+        /*
+           Let's find some other way to do this!
+           ErrorMessage(hWndApp, "dxControl: Resize failed\n"); */
+        return FXFALSE;
+      }
+    }
+    break;
+
+  case INIT_CONTROL_MOVE:
+    break;
+
+  case INIT_CONTROL_ACTIVATE:
+    GDBG_INFO((120, "dxControl: Activate\n"));
+    break;
+
+  case INIT_CONTROL_DEACTIVATE:
+    GDBG_INFO((120, "dxControl: DeActivate\n"));
+    break;
+
+  default:
+    GDBG_INFO((120, "dxControl: Strange control %d\n", code));
+    return FXFALSE;
+    break;
+  }
+  for (i=0; i<5; i++) pBufDesc[i] = BufDesc[i];
+  *width = Width;
+  *height = Height;
+  GDBG_INFO((80, "dxControl: code = %d, w = %d, h = %d\n", code,
+             Width, Height));
+  
+  return FXTRUE;
+} /* dxControl */
+
+FxBool
+dxClose()
+{
+  GDBG_INFO((80, "dxClose:\n"));
+/*
+ * fixme! nulling out this code fixes bug 541... why is unclear??? XXX
+ *  A little more information... the problem is releasing lpDD1, and
+ *  only in fullscreen mode.  Temporary refined hack is to not release
+ *  lpDD1 in fullscreen mode.  Also rearrange code in dxAllocSurfaces
+ *  to only create lpDD1 once per application execution. /PGJ
+ */
+#if 1
+  // Release any allocated buffers
+  if( lpClipper) IDirectDrawSurface2_Release( lpClipper);
+  if( lpFront  ) IDirectDrawSurface2_Release( lpFront  );
+  if(!IsFullScreen) {
+    if( lpBack   ) IDirectDrawSurface2_Release( lpBack   );
+  }
+  if( lpAux    ) IDirectDrawSurface2_Release( lpAux    );
+  if( lpDD     ) IDirectDraw2_Release( lpDD );
+  if (1 /* !IsFullScreen */) {
+    if( lpDD1    ) IDirectDraw_Release( lpDD1 );
+    lpDD1     = NULL;
+  }
+  
+  lpClipper = NULL;
+  lpFront   = NULL;
+  lpBack    = NULL;
+  lpTriple   = NULL;
+  lpAux     = NULL;
+  lpDD      = NULL;
+  
+#endif /* 0 */
+  GDBG_INFO((80, "dxClose:  Returning TRUE\n"));
+  return FXTRUE;
+} /* dxClose */
+
+void
+dxSwap(FxU32 code)
+{
+  static RECT    dest, src;
+  static POINT   point;
+  static HRESULT hr;
+  
+  GDBG_INFO((80, "dxSwap:\n"));
+  if ( !IsFullScreen ) {
+    GDBG_INFO((120, "Swap: using BLTs\n"));
+
+    src.left   = 0;
+    src.right  = Width-1;
+    src.top    = 0;
+    src.bottom = Height-1;
+        
+    dest = src;
+    point.x = 0;
+    point.y = 0;
+    ClientToScreen( hWndApp, &point );
+    dest.left   += point.x;
+    dest.right  += point.x;
+    dest.top    += point.y;
+    dest.bottom += point.y;
+
+    hr = IDirectDrawSurface_Blt( lpFront, 
+                                &dest,
+                                lpBack,
+                                &src,
+                                DDBLT_WAIT,
+                                NULL );
+        
+    while( IDirectDrawSurface_GetBltStatus( lpFront, DDGBS_ISBLTDONE ) !=
+          DD_OK );
+        
+    if ( hr != DD_OK ) {
+      ErrorMessage(hWndApp, "Couldn't blit!\n");
+    }
+  }
+  return;
+  
+} /* dxSwap */
+#else /* it's either DOS or the Hoopti Lab Setup */
+FxBool
+dxOpen(
+    FxU32                hWindow,
+    GrScreenResolution_t sRes,
+    GrScreenRefresh_t    vRefresh,
+    InitColorFormat_t    cFormat,
+    InitOriginLocation_t yOrigin,
+    int                  nColBuffers,
+    int                  nAuxBuffers,
+    InitBufDesc_t        *pBufDesc,         // return values
+    int                  *width,
+    int                  *height,
+    InitSwapType_t       *swapType
+)
+{
+#define FN_NAME "dxOpen"
+  InitBufDesc_t   *dFront  = &pBufDesc[0];
+  InitBufDesc_t   *dBack   = &pBufDesc[1];
+  InitBufDesc_t   *dAux    = &pBufDesc[2];
+  InitBufDesc_t   *dFifo   = &pBufDesc[3];
+  InitBufDesc_t   *dScreen = &pBufDesc[4];
+  InitBufDesc_t   *dTriple = &pBufDesc[5];
+  FxBool rv = FXTRUE;
+  FxU32 endAddr;
+
+  /* !!! FIXME - this is a hack to get murali's bufferdesc into the code
+   * this whole file needs to be subsumed into init96.c.
+   * Still a hack, but I put some rouge on it /PGJ
+   */
+
+  GDBG_INFO((80, "%s:  Resolution == 0x%x\n", FN_NAME, sRes));
+
+  switch (sRes) {
+  case GR_RESOLUTION_640x480:
+    *width = 640;
+    *height = 480;
+    break;
+  case GR_RESOLUTION_800x600:
+    *width = 800;
+    *height = 600;
+    break;
+  case GR_RESOLUTION_320x200:
+    *width = 320;
+    *height = 200;
+    break;
+  case GR_RESOLUTION_320x240:
+    *width = 320;
+    *height = 240;
+    break;
+  case GR_RESOLUTION_512x384:
+    *width = 512;
+    *height = 384;
+    break;
+  case GR_RESOLUTION_400x256:
+  case GR_RESOLUTION_640x200:
+  case GR_RESOLUTION_640x350:
+  case GR_RESOLUTION_640x400:
+  case GR_RESOLUTION_960x720:
+  case GR_RESOLUTION_856x480:
+  case GR_RESOLUTION_512x256:
+  case GR_RESOLUTION_NONE:
+  default:
+    GDBG_INFO((80, "%s:  Unimplemented resolution\n", FN_NAME));
+    break;
+  }
+  
+
+#define WAITLOOP {\
+  volatile int waitfoo;\
+  int waitcount;\
+  for (waitcount = 0; waitcount < 500000; waitcount++){waitfoo = waitcount;}\
+}
+
+/* AT3D buffers need to be 4K (Intel) page-aligned */
+#define BUMP(x, y) (((x) + ((y)-1)) & ~((y)-1))
+#define BUMP_PAGE(x) (BUMP(x, 1<<12))
+
+  if ( curHALData->initSetVideo ) {
+    rv = curHALData->initSetVideo( sRes, vRefresh, 
+                                  (FxU32*)width, (FxU32*)height );
+    if ( !rv ) goto BAIL;
+  }
+  
+  /* Initialize all descriptors. */
+  dFront->bufMagic  = VG96_BUF_MAGIC;
+  dFront->bufType   = INIT_BUFFER_FRONTBUFFER;
+  dFront->bufOffset = 0;
+  dFront->bufStride = (*width)*2;
+  dFront->bufBPP    = 16;
+  endAddr           = BUMP_PAGE((*width)*(*height)*2);
+
+  dBack->bufMagic  = VG96_BUF_MAGIC;
+  dBack->bufType   = INIT_BUFFER_BACKBUFFER;
+  dBack->bufOffset = endAddr;
+  dBack->bufStride = (*width)*2;
+  dBack->bufBPP    = 16;
+  endAddr          = BUMP_PAGE(endAddr + (*width)*(*height)*2);
+
+  tripleBuffering = (nColBuffers == 3);
+  if (tripleBuffering) {
+    dTriple->bufMagic  = VG96_BUF_MAGIC;
+    dTriple->bufType   = INIT_BUFFER_TRIPLEBUFFER;
+    dTriple->bufOffset = endAddr;
+    dTriple->bufStride = (*width)*2;
+    dTriple->bufBPP    = 16;
+    endAddr          = BUMP_PAGE(endAddr + (*width)*(*height)*2);
+  }
+
+  dAux->bufMagic  = VG96_BUF_MAGIC;
+  dAux->bufType   = INIT_BUFFER_AUXBUFFER;
+  dAux->bufOffset = endAddr;
+  dAux->bufStride = (*width)*2;
+  dAux->bufBPP    = 16;
+  endAddr         = BUMP_PAGE(endAddr + (*width)*(*height)*2);
+
+  dFifo->bufMagic  = VG96_BUF_MAGIC;
+  dFifo->bufType   = INIT_BUFFER_FIFOBUFFER;
+  dFifo->bufOffset = endAddr;
+  dFifo->bufStride = 65536;
+  dFifo->bufBPP    = 16;
+
+  dScreen->bufMagic  = VG96_BUF_MAGIC;
+  dScreen->bufType   = INIT_BUFFER_SCREENBUFFER;
+  dScreen->bufOffset = 0;
+  dScreen->bufStride = 0;
+  dScreen->bufBPP    = 0;
+
+  GDBG_INFO((80, "%s:  dFront = 0x%x, dBack = 0x%x, dAux = 0x%x\n",
+             FN_NAME, dFront, dBack, dAux, dFifo));
+  GDBG_INFO((80, "dxOpen: F:%.06x %5d B:%.06x %5d A:%.06x %5d, C:%.06x %5d\n",
+       dFront->bufOffset, dFront->bufStride,
+       dBack ->bufOffset, dBack ->bufStride,
+       dAux  ->bufOffset, dAux  ->bufStride,
+       dFifo ->bufOffset, dFifo ->bufStride));
+
+#ifdef GDBG_INFO_ON
+  {
+    int i;  
+
+    for (i = 0; i < 5; i++) {
+      GDBG_INFO((80, "%s:  pBufDesc[%d] = 0x%x:\n",
+                 FN_NAME, i, &pBufDesc[i]));
+      GDBG_INFO((80, "%s:  pBufDesc.bufType = %s\n",
+                 FN_NAME, bufTypeNames[pBufDesc[i].bufType]));
+      GDBG_INFO((80, "%s:  pBufDesc.bufOffset = 0x%x\n", 
+                 FN_NAME, pBufDesc[i].bufOffset ));
+      GDBG_INFO((80, "%s:  pBufDesc.bufStride = 0x%x\n", 
+                 FN_NAME, pBufDesc[i].bufStride));
+      GDBG_INFO((80, "%s:  pBufDesc.bufBPP = 0x%x\n",
+                 FN_NAME, pBufDesc[i].bufBPP));
+    }
+  }
+#endif
+
+  *swapType = INIT_SWAP_FLIP;
+
+BAIL:
+  return rv;
+#undef FN_NAME
+} /* dxOpen */
+
+FxBool
+dxControl(FxU32 code, InitBufDesc_t *pBufDesc, int *width, int *height)
+{
+  return FXTRUE;
+} /* dxControl */
+FxBool
+dxClose()
+{
+#define FN_NAME "dxClose"
+  GDBG_INFO((80, "%s:  Setting up VESA mode 640*480*\n", FN_NAME));
+#ifdef __DOS32__
+  {
+    union REGS r;
+
+    memset(&r, 0, sizeof(r));
+
+    r.w.ax = 0x4f02;
+    r.w.bx = 0x3;
+    int386( 0x10, &r, &r );
+  }
+#endif
+  return FXTRUE;
+#undef FN_NAME
+} /* dxClose */
+
+void
+dxSwap(FxU32 code)
+{
+} /* dxSwap */
+#endif  /* __DOS32__ || (defined(__WIN32__)  && !defined(INIT_ACCESS_DDRAW) */
+
+
Index: trunk/src/opengl/glide/sst1/init/init96/fxinit96.h
===================================================================
--- trunk/src/opengl/glide/sst1/init/init96/fxinit96.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init96/fxinit96.h	(revision 2885)
@@ -0,0 +1,136 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:28 $ 
+**
+*/
+
+
+#ifndef _FXINIT96_H_
+#define _FXINIT96_H_
+
+#include <3dfx.h>
+#include <sst.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __linux__
+FxBool dxOpen(
+        FxU32                   hWindow,
+        GrScreenResolution_t    sRes,
+        GrScreenRefresh_t       vRefresh,
+        InitColorFormat_t       cFormat,
+        InitOriginLocation_t    yOrigin,
+        int                     nCol,
+        int                     nAux,
+        InitBufDesc_t           *pBufDesc,
+        int                     *width,
+        int                     *height, 
+        InitSwapType_t          *swapType
+);
+FxBool dxControl(FxU32 control, InitBufDesc_t *pDesc, int *w, int *h);
+FxBool dxClose();
+void   dxSwap(FxU32 code);
+
+#else
+
+FxBool linOpen(
+        FxU32                   hWindow,
+        GrScreenResolution_t    sRes,
+        GrScreenRefresh_t       vRefresh,
+        InitColorFormat_t       cFormat,
+        InitOriginLocation_t    yOrigin,
+        int                     nCol,
+        int                     nAux,
+        InitBufDesc_t           *pBufDesc,
+        int                     *width,
+        int                     *height, 
+        InitSwapType_t          *swapType
+);
+FxBool linControl(FxU32 control, InitBufDesc_t *pDesc, int *w, int *h);
+FxBool linClose();
+void   linSwap(FxU32 code);
+void   linFlip(FxU32 buffer);
+
+#endif
+
+typedef struct {
+  FxU32  memSize;
+  FxBool (FX_CSTYLE *initAperture) (InitRegisterDesc *rd);
+  FxBool (FX_CSTYLE *initSetVideo)( GrScreenResolution_t res, GrScreenRefresh_t refresh, FxU32 *xr, FxU32 *yr );
+  FxBool (FX_CSTYLE *initEnableRegs)(InitRegisterDesc*rd);
+  FxBool (FX_CSTYLE *initDisableRegs)(InitRegisterDesc*rd);
+  FxBool (FX_CSTYLE *wrapFIFO) (InitRegisterDesc *rd, InitFIFOData *fifoData );
+#ifdef H3D
+  int    (FX_CSTYLE *initUseTiles) (InitRegisterDesc *rd, FxU32 *buffers, FxU32 nBuffers, FxU32 stride, FxU32 Width, FxU32 Height, FxU32 AutoFlipped);
+#else
+  int    (FX_CSTYLE *initUseTiles) (InitRegisterDesc *rd, FxU32 *buffers, FxU32 nBuffers, FxU32 stride, FxU32 Width, FxU32 Height);
+#endif
+  FxBool (FX_CSTYLE *initGetInfo)(VG96Info *info);
+  FxBool (FX_CSTYLE *initSwapTiles) (InitRegisterDesc *rd);
+  void *devPriv;                /* Just in case */
+} Init96HALData;
+
+extern Init96HALData *curHALData;
+
+extern char *iRegNames[];
+
+extern volatile FxU32   *sstHW;
+extern volatile Sstregs *sstPtr;
+
+/*----------------- SST96 access macros----------------------*/
+
+/* NOTE:
+
+   This code is HIGHLY important to debugging.  Delete it at your
+   extreme peril.
+ */
+#define GETINDEX(a) ((((FxU32) &a) - (((FxU32) sstHW) + 0x400000)) >> 2)
+/* This is the ONE TRUE WAY to read FBI Jr. registers.  Don't mess
+   with it!!! */
+#define GETREADADDR(s) ((FxU32 *) (((FxU32) sstHW) + 0x400000 + (GETINDEX(s) << 12)))
+#define GETINDEXFROMADDR(a) ((((FxU32) a) - (((FxU32) sstHW + 0x400000))) >> 2)
+#define GETREADADDR2(s) ((FxU32 *) (((FxU32) sstHW) + 0x400000 + (GETINDEXFROMADDR(s) << 12)))
+
+#undef SET
+#undef GET
+#undef SETF
+#undef GETF
+
+#ifdef GDBG_INFO_ON
+#define SET(d,s)\
+GDBG_INFO((80, "SET:  Register:  %s (0x%x) = 0x%x\n",\
+           iRegNames[GETINDEX(d)], GETINDEX(d), s));\
+(d) = (s);
+#define GET(s) get96(&s)
+
+#else
+#define SET(d,s) (d) = (s)
+#define GET(s) *(GETREADADDR(s))
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Index: trunk/src/opengl/glide/sst1/init/init96/init96.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/init96/init96.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init96/init96.c	(revision 2885)
@@ -0,0 +1,2241 @@
+/*
+ ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ ** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ ** 
+ ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ ** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ ** THE UNITED STATES.  
+ ** 
+ ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+ ** $Revision: 1.1 $ 
+ ** $Date: 2000-02-25 00:31:28 $ 
+ **
+ */
+static char revString[] = "@#%$Workfile: INIT96.C $ $Revision: 1.1 $";
+
+/* ANSI Headers */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#if defined(__DOS32__) || defined(INIT96VGASWAP)
+#include <conio.h>
+#endif
+
+#ifdef __DOS32__
+#include <i86.h>
+#endif
+
+#ifdef __WIN32__
+#include <windows.h>
+#endif
+
+#ifdef INIT96VGASWAP
+#include "initvga.h"
+#endif
+
+#if defined(__WATCOMC__)
+#define _inp inp
+#define _outp outp
+#endif
+
+/* 3Dfx Headers */
+#include <3dfx.h>
+#include <fxpci.h>
+#include <gdebug.h>
+#include <sst.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+
+#include <init.h>
+
+/* Local Headers */
+#include "init96.h"
+#include "fxinit96.h"
+
+#include "initat3d.h"
+#if 0
+#include "init9685.h"
+#include "initmrti.h"
+#endif
+#include "initmcrx.h"
+
+#ifdef GDBG_INFO_ON
+static char *bufTypeNames[] = {
+  "INIT_BUFFER_FRONTBUFFER",
+  "INIT_BUFFER_BACKBUFFER",
+  "INIT_BUFFER_AUXBUFFER",
+  "INIT_BUFFER_DEPTHBUFFER",
+  "INIT_BUFFER_ALPHABUFFER",
+  "INIT_BUFFER_TRIPLEBUFFER",
+  "INIT_BUFFER_FIFOBUFFER",
+  "INIT_BUFFER_SCREENBUFFER",
+  "INIT_BUFFER_TEXTUREBUFFER"
+};
+#endif
+
+
+/*==================== Local Constants ====================*/
+#define NUM_BUFS 6
+
+#define SST96_MEMMAP_TEXTURE_MEMORY_OFFSET  (0x6 << 20)     /* +5 MB */
+
+#define SST96_COMMAND_REGS(X) ( ((char*)(X))+(4<<20) )
+
+#define MAXTRIES        10000
+
+#define FIFOLAG         128
+
+/*-------------------------------------------------------------------
+  Module Data
+  -------------------------------------------------------------------*/
+volatile FxU32   *sstHW;
+volatile Sstregs *sstPtr;
+
+typedef struct _BufInfo {
+  /* DISPLAY Stuff */
+  FxI32 dfb;                    /* Was fbN */
+  FxI32 dfbBase;                /* Base of Buffers */
+  FxI32 dfbTop;                 /* Tops of Buffers */
+  FxI32 dfbStride;              /* Strides */
+  /* RENDER stuff */
+  FxI32 rfb;                    /* was rfbN */
+} BufInfo, *BufInfoPtr;
+
+
+#define RFB 0 
+#define DFB 1
+
+  
+extern FxBool tripleBuffering;
+
+#define ADVANCE_BUFFERS(kind)\
+{\
+  kind##FrontIdx = (kind##FrontIdx < maxBufIdx) ?  kind##FrontIdx + 1 : 0;\
+  kind##BackIdx  = (kind##BackIdx  < maxBufIdx) ?  kind##BackIdx + 1 : 0;\
+  kind##RenderIdx = (kind##RenderIdx < maxBufIdx) ? kind##RenderIdx + 1 : 0;\
+}
+
+#define rfbTripleIdx ((rfbBackIdx + 1) % maxBuffer)
+#define MAX_BUF 3
+
+BufInfo bI[MAX_BUF];
+
+static FxI32
+  maxBuffer = 2,
+  maxBufIdx,
+  /* DISPLAY Stuff */
+  /* The following two are indices into the above */
+  dfbFrontIdx =  0,
+  dfbBackIdx  =  1,
+  dfbRenderIdx = 1,
+  /* RENDER stuff */
+  rfbFrontIdx =  0,
+  rfbBackIdx  =  1,
+  rfbRenderIdx = 1;
+
+static FxI32
+ab0, ab0Top, ab0Base, ab0Stride;
+
+static InitOriginLocation_t cachedYOrigin;
+static InitSwapType_t       cachedSwapType;
+
+static FxU32           fifoStart, fifoEnd;
+volatile FxU32 *fifovirt; /* start virtual address */
+volatile FxU32  fifophys; /* start physical address  */
+volatile FxU32  fifomax;  /* in bytes */
+volatile FxU32  fifocur;  /* how much used up so far */
+volatile FxU32 *fifoptr;  /* current pointer */
+volatile FxU32  fifosize; /* how much of 4kbytes used up */
+volatile FxU32  fifolfb;  /* use LFB, use hostblt if 0. */
+
+#if SST96_ALT_FIFO_WRAP && GDBG_INFO_ON
+/* Statistics about how many times we wrapped/waited for
+ * the fifo.
+ */
+static FxU32 numWraps;
+static FxU32 numJuJuStalls;
+static FxU32 numStalls;
+#endif /* GDBG_INFO_ON && SST96_ALT_FIFO_WRAP */
+
+Init96HALData *curHALData;
+
+static FxU16
+oldVidMode;
+
+static FxU32 
+devNum, 
+physAddr,
+fifoMTRRNum = 0xffffffff;
+
+/*-----------Debuging Info Data------------------------------*/
+#ifdef GDBG_INFO_ON
+/* NOTE:
+   
+   This array is HIGHLY important to debugging.  Delete it at your
+   extreme peril.
+   */
+char *iRegNames[] = {
+  "status",                     /* 0x00 */
+  "reserved001",                /* 0x01 */
+  "vAx",                        /* 0x02 */
+  "vAy",                        /* 0x03 */
+  "vBx",                        /* 0x04 */
+  "vBy",                        /* 0x05 */
+  "vCx",                        /* 0x06 */
+  "vCy",                        /* 0x07 */
+  "r",                          /* 0x08 */
+  "drdx",                       /* 0x09 */
+  "drdy",                       /* 0x0a */
+  "g",                          /* 0x0b */
+  "dgdx",                       /* 0x0c */
+  "dgdy",                       /* 0x0d */
+  "b",                          /* 0x0e */
+  "dbdx",                       /* 0x0f */
+  "dbdy",                       /* 0x10 */
+  "z",                          /* 0x11 */
+  "dzdx",                       /* 0x12 */
+  "dzdy",                       /* 0x13 */
+  "a",                          /* 0x14 */
+  "dadx",                       /* 0x15 */
+  "dady",                       /* 0x16 */
+  "s",                          /* 0x17 */
+  "dsdx",                       /* 0x18 */
+  "dsdy",                       /* 0x19 */
+  "t",                          /* 0x1a */
+  "dtdx",                       /* 0x1b */
+  "dtdy",                       /* 0x1c */
+  "w",                          /* 0x1d */
+  "dwdx",                       /* 0x1e */
+  "dwdy",                       /* 0x1f */
+  "triangleCMD",                /* 0x20 */
+  "reserved021",                /* 0x21 */
+  "FvAx",                       /* 0x22 */
+  "FvAy",                       /* 0x23 */
+  "FvBx",                       /* 0x24 */
+  "FvBy",                       /* 0x25 */
+  "FvCx",                       /* 0x26 */
+  "FvCy",                       /* 0x27 */
+  "Fr",                         /* 0x28 */
+  "Fdrdx",                      /* 0x29 */
+  "Fdrdy",                      /* 0x2a */
+  "Fg",                         /* 0x2b */
+  "Fdgdx",                      /* 0x2c */
+  "Fdgdy",                      /* 0x2d */
+  "Fb",                         /* 0x2e */
+  "Fdbdx",                      /* 0x2f */
+  "Fdbdy",                      /* 0x30 */
+  "Fz",                         /* 0x31 */
+  "Fdzdx",                      /* 0x32 */
+  "Fdzdy",              /* 0x33 */
+  "Fa",                 /* 0x34 */
+  "Fdadx",              /* 0x35 */
+  "Fdady",              /* 0x36 */
+  "Fs",                 /* 0x37 */
+  "Fdsdx",              /* 0x38 */
+  "Fdsdy",              /* 0x39 */
+  "Ft",                 /* 0x3a */
+  "Fdtdx",              /* 0x3b */
+  "Fdtdy",              /* 0x3c */
+  "Fw",                 /* 0x3d */
+  "Fdwdx",              /* 0x3e */
+  "Fdwdy",              /* 0x3f */
+  "FtriangleCMD",       /* 0x40 */
+  "reserved041",        /* 0x41 */
+  "nopCMD",             /* 0x42 */
+  "reserved043",        /* 0x43 */
+  "fastfillCMD",        /* 0x44 */
+  "reserved045",        /* 0x45 */
+  "swapbufferCMD",      /* 0x46 */
+  "reserved047",        /* 0x47 */
+  "swappendCMD",        /* 0x48 */
+  "reserved049",        /* 0x49 */
+  "reserved04A",        /* 0x4a */
+  "reserved04B",        /* 0x4b */
+  "reserved04C",        /* 0x4c */
+  "reserved04D",        /* 0x4d */
+  "reserved04E",        /* 0x4e */
+  "reserved04F",        /* 0x4f */
+  "fbzColorPath",       /* 0x50 */
+  "fogMode",            /* 0x51 */
+  "alphaMode",          /* 0x52 */
+  "reserved053",        /* 0x53 */
+  "fbzMode",            /* 0x54 */
+  "stipple",            /* 0x55 */
+  "color0",             /* 0x56 */
+  "color1",             /* 0x57 */
+  "fogColor",           /* 0x58 */
+  "zaColor",            /* 0x59 */
+  "chromaKey",          /* 0x5a */
+  "chromaRange",        /* 0x5b */
+  "reserved05C",        /* 0x5c */
+  "reserved05D",        /* 0x5d */
+  "reserved05E",        /* 0x5e */
+  "reserved05F",        /* 0x5f */
+  "colBufferSetup",     /* 0x60 */
+  "auxBufferSetup",     /* 0x61 */
+  "clipLeftRight0",     /* 0x62 */
+  "clipTopBottom0",     /* 0x63 */
+  "clipLeftRight1",     /* 0x64 */
+  "clipTopBottom1",     /* 0x65 */
+  "reserved066",        /* 0x66 */
+  "reserved067",        /* 0x67 */
+  "reserved068",        /* 0x68 */
+  "reserved069",        /* 0x69 */
+  "reserved06A",        /* 0x6a */
+  "reserved06B",        /* 0x6b */
+  "reserved06C",        /* 0x6c */
+  "reserved06D",        /* 0x6d */
+  "reserved06E",        /* 0x6e */
+  "reserved06F",        /* 0x6f */
+  "fogTable0001",       /* 0x70 */
+  "fogTable0203",       /* 0x71 */
+  "fogTable0405",       /* 0x72 */
+  "fogTable0607",       /* 0x73 */
+  "fogTable0809",       /* 0x74 */
+  "fogTable0A0B",       /* 0x75 */
+  "fogTable0C0D",       /* 0x76 */
+  "fogTable0E0F",       /* 0x77 */
+  "fogTable1011",       /* 0x78 */
+  "fogTable1213",       /* 0x79 */
+  "fogTable1415",       /* 0x7a */
+  "fogTable1617",       /* 0x7b */
+  "fogTable1819",       /* 0x7c */
+  "fogTable1A1B",       /* 0x7d */
+  "fogTable1C1D",       /* 0x7e */
+  "fogTable1E1F",       /* 0x7f */
+  "fogTable2021",       /* 0x80 */
+  "fogTable2223",       /* 0x81 */
+  "fogTable2425",       /* 0x82 */
+  "fogTable2627",       /* 0x83 */
+  "fogTable2829",       /* 0x84 */
+  "fogTable2A2B",       /* 0x85 */
+  "fogTable2C2D",       /* 0x86 */
+  "fogTable2E2F",       /* 0x87 */
+  "fogTable3031",       /* 0x88 */
+  "fogTable3233",       /* 0x89 */
+  "fogTable3435",       /* 0x8a */
+  "fogTable3637",       /* 0x8b */
+  "fogTable3839",       /* 0x8c */
+  "fogTable3A3B",       /* 0x8d */
+  "fogTable3C3D",       /* 0x8e */
+  "fogTable3E3F",       /* 0x8f */
+  "fbijrInit0",         /* 0x90 */
+  "fbijrInit1",         /* 0x91 */
+  "fbijrInit2",         /* 0x92 */
+  "fbijrInit3",         /* 0x93 */
+  "fbijrInit4",         /* 0x94 */
+  "fbijrInit5",         /* 0x95 */
+  "reserved096",        /* 0x96 */
+  "reserved097",        /* 0x97 */
+  "reserved098",        /* 0x98 */
+  "reserved099",        /* 0x99 */
+  "reserved09A",        /* 0x9a */
+  "reserved09B",        /* 0x9b */
+  "reserved09C",        /* 0x9c */
+  "reserved09D",        /* 0x9d */
+  "reserved09E",        /* 0x9e */
+  "reserved09F",        /* 0x9f */
+  "fbijrVersion",       /* 0xa0 */
+  "fbiPixelsIn",        /* 0xa1 */
+  "fbiChromaFail",      /* 0xa2 */
+  "fbiZfuncFail",       /* 0xa3 */
+  "fbiAfuncFail",       /* 0xa4 */
+  "fbiPixelsOut",       /* 0xa5 */
+  "reserved0A6",        /* 0xa6 */
+  "reserved0A7",        /* 0xa7 */
+  "reserved0A8",        /* 0xa8 */
+  "reserved0A9",        /* 0xa9 */
+  "reserved0AA",        /* 0xaa */
+  "reserved0AB",        /* 0xab */
+  "reserved0AC",        /* 0xac */
+  "reserved0AD",        /* 0xad */
+  "reserved0AE",        /* 0xae */
+  "reserved0AF",        /* 0xaf */
+  "reserved0B0",        /* 0xb0 */
+  "reserved0B1",        /* 0xb1 */
+  "reserved0B2",        /* 0xb2 */
+  "reserved0B3",        /* 0xb3 */
+  "reserved0B4",        /* 0xb4 */
+  "reserved0B5",        /* 0xb5 */
+  "reserved0B6",        /* 0xb6 */
+  "reserved0B7",        /* 0xb7 */
+  "reserved0B8",        /* 0xb8 */
+  "reserved0B9",        /* 0xb9 */
+  "reserved0BA",        /* 0xba */
+  "reserved0BB",        /* 0xbb */
+  "reserved0BC",        /* 0xbc */
+  "reserved0BD",        /* 0xbd */
+  "reserved0BE",        /* 0xbe */
+  "texChipSel",         /* 0xbf */
+  "textureMode",        /* 0xc0 */
+  "tLOD",               /* 0xc1 */
+  "tDetail",            /* 0xc2 */
+  "texBaseAddr",        /* 0xc3 */
+  "texBaseAddr1",       /* 0xc4 */
+  "texBaseAddr2",       /* 0xc5 */
+  "texBaseAddr38",      /* 0xc6 */
+  "trexInit0",          /* 0xc7 */
+  "trexInit1",          /* 0xc8 */
+  "nccTable0_0",        /* 0xc9 */
+  "nccTable0_1",        /* 0xca */
+  "nccTable0_2",        /* 0xcb */
+  "nccTable0_3",        /* 0xcc */
+  "nccTable0_4",        /* 0xcd */
+  "nccTable0_5",        /* 0xce */
+  "nccTable0_6",        /* 0xcf */
+  "nccTable0_7",        /* 0xd0 */
+  "nccTable0_8",        /* 0xd1 */
+  "nccTable0_9",        /* 0xd2 */
+  "nccTable0_A",        /* 0xd3 */
+  "nccTable0_B",        /* 0xd4 */
+  "nccTable1_0",        /* 0xd5 */
+  "nccTable1_1",        /* 0xd6 */
+  "nccTable1_2",        /* 0xd7 */
+  "nccTable1_3",        /* 0xd8 */
+  "nccTable1_4",        /* 0xd9 */
+  "nccTable1_5",        /* 0xda */
+  "nccTable1_6",        /* 0xdb */
+  "nccTable1_7",        /* 0xdc */
+  "nccTable1_8",        /* 0xdd */
+  "nccTable1_9",        /* 0xde */
+  "nccTable1_A",        /* 0xdf */
+  "nccTable1_B",        /* 0xe0 */
+  "reserved0E1",        /* 0xe1 */
+  "reserved0E2",        /* 0xe2 */
+  "reserved0E3",        /* 0xe3 */
+  "reserved0E4",        /* 0xe4 */
+  "reserved0E5",        /* 0xe5 */
+  "reserved0E6",        /* 0xe6 */
+  "reserved0E7",        /* 0xe7 */
+  "reserved0E8",        /* 0xe8 */
+  "reserved0E9",        /* 0xe9 */
+  "reserved0EA",        /* 0xea */
+  "reserved0EB",        /* 0xeb */
+  "reserved0EC",        /* 0xec */
+  "reserved0ED",        /* 0xed */
+  "reserved0EE",        /* 0xee */
+  "reserved0EF",        /* 0xef */
+  "reserved0F0",        /* 0xf0 */
+  "reserved0F1",        /* 0xf1 */
+  "reserved0F2",        /* 0xf2 */
+  "reserved0F3",        /* 0xf3 */
+  "reserved0F4",        /* 0xf4 */
+  "reserved0F5",        /* 0xf5 */
+  "reserved0F6",        /* 0xf6 */
+  "reserved0F7",        /* 0xf7 */
+  "reserved0F8",        /* 0xf8 */
+  "reserved0F9",        /* 0xf9 */
+  "reserved0FA",        /* 0xfa */
+  "reserved0FB",        /* 0xfb */
+  "reserved0FC",        /* 0xfc */
+  "reserved0FD",        /* 0xfd */
+  "reserved0FE",        /* 0xfe */
+  "reserved0FF"         /* 0xff */
+};
+#endif
+
+#define VG96STRIDE(stride)  (((stride >> 3) & 0x1ff )<< 22)
+
+#ifdef GDBG_INFO_ON
+FxU32
+get96(FxU32 *addr) 
+{
+  FxU32
+    index,
+    ret;
+  char *regName;
+
+  ret = *GETREADADDR2(addr);
+
+  index = GETINDEXFROMADDR(addr);
+
+  regName = iRegNames[index];
+
+  GDBG_INFO((120, "GET:  Register:  %s (0x%x) Address: 0x%x Value: 0x%x\n",
+             regName, GETINDEXFROMADDR(addr), addr, ret));
+
+  return ret;
+} /* get96 */
+#endif
+
+/* structure offset */
+#define SETO(base,offset,value)     (*(((FxU32 *)(base))+((offset) >> 2)) = (value))
+#define GETO(base,offset)           (*(((FxU32 *)(base))+((offset) << 8)))
+
+/* register indices */
+#define SETI(base,index,value)      (*(((FxU32 *)(base))+(index)) = (value))
+#define GETI(base,index)            (*(((FxU32 *)(base))+((index) << 10)))
+
+/* structure field names */
+#define SETF(base2,field,value)      (((Sstregs*)(base2))->field = (value))
+#define GETF(base,field)            (GETO(base,offsetof(Sstregs,field)))
+
+
+#define GETREGVALFROMENV(val, envStr, constant)\
+{\
+  const char *envVal;\
+  val = constant;\
+  if ((envVal = myGetenv(envStr)) != NULL) {\
+    sscanf(envVal, "%x", &val);\
+    GDBG_INFO((80,\
+               "%s:  The environment variable %s == 0x%x overloaded a register value\n", \
+               FN_NAME, envStr, val));\
+  }\
+}
+
+static FxBool
+init96LoadBufRegs(int nBuffers, 
+                  InitBufDesc_t *pBufDesc, 
+                  int xRes, int yRes, 
+                  InitRegisterDesc *rd);
+
+#define XY_ONE (1<<SST_XY_FRACBITS)
+
+/* draw a right angle triangle */
+static void
+drawTriangle(volatile Sstregs *sst, int x, int y, int tSize)
+{
+  SET(sstPtr->vA.x, x);
+  SET(sstPtr->vA.y, y);
+  SET(sstPtr->vB.x, x+XY_ONE*tSize);
+  SET(sstPtr->vB.y, y);
+  SET(sstPtr->vC.x, x);
+  SET(sstPtr->vC.y, y+XY_ONE*tSize/2);
+  
+  SET(sstPtr->s, 0);
+  SET(sstPtr->t, 0);
+  SET(sstPtr->w, 1);
+  SET(sstPtr->dsdx, 255);
+  SET(sstPtr->dtdx, 0);
+  SET(sstPtr->dwdx, 0);
+  SET(sstPtr->dsdy, 255);
+  SET(sstPtr->dtdy, 0);
+  SET(sstPtr->dwdy, 0);
+  SET(sstPtr->triangleCMD, 1);
+}
+
+#define SENSE0 0xbaaf
+#define SENSE1 0xabcd
+
+#define VG96_TEXTURE_OFFSET     0x600000
+#define SST96_TEX_PTR(a) \
+        ((FxU32 *) (((FxU32) a) + VG96_TEXTURE_OFFSET))
+
+static FxBool sense(FxU32 *sstbase, VG96Info *info, FxU32 tmu,
+                   FxU32 mem, FxU32 init)
+{
+  volatile Sstregs *sst = (Sstregs *) sstbase;
+  FxU32 *texAddr = (FxU32 *)SST96_TEX_PTR(sstbase);
+  FxBool same = FXFALSE;
+  FxU16 fmem, orgmem;
+
+
+  /* set the Init0 register to enable ? MBytes of memory */
+#define WAITLOOP {\
+int nWaits;\
+  FxU32 waitRes;\
+  for (nWaits = 0; nWaits < 50000; nWaits++) {\
+    waitRes = sstHW[0x100000];\
+    if (waitRes & 0x80000000) break;\
+  }\
+}
+
+  orgmem = *(FxU16 *)sstbase;
+
+  WAITLOOP;
+
+  /* base address for lod0 */
+  mem = mem - ((FXBIT(14) + FXBIT(12) + FXBIT(10) + FXBIT(8) + FXBIT(6) + FXBIT(4) + FXBIT(2) + 1)*8); /* 8X */
+
+  SET(sstPtr->texBaseAddr, mem>>3);
+
+  *(texAddr + (8 << 15)) = init;
+  /* 
+     write to 2 consequtive locations in lod0 to alter the data
+     on the memory signals 
+  */
+  WAITLOOP;
+  *(texAddr + (0)) = 0xffffffff;        
+  WAITLOOP;
+  *(texAddr + (1)) = 0xffffffff;
+  
+  WAITLOOP;
+
+  drawTriangle(sst,0,0,2);              /* draw a 4x4 right triangle */
+  WAITLOOP;
+
+  fmem = *(FxU16 *)sstbase;
+
+  WAITLOOP;
+
+  if (fmem == init)
+    same = FXTRUE;
+
+  *(FxU16 *)sstbase = orgmem;
+
+  return same;
+}
+
+FX_EXPORT FxBool FX_CSTYLE
+Init96GetTmuMemory(FxU32 *sstbase, VG96Info *info, FxU32 tmu,
+        FxU32 *TmuMemorySize)
+{
+  FxU32 data;
+  
+  if(myGetenv(("SST96_TMUMEM_SIZE"))) {
+    *TmuMemorySize = atoi(myGetenv(("SST96_TMUMEM_SIZE")));
+    return(FXTRUE);
+  }
+  SET(sstPtr->trexInit0, 0x05441);
+
+  SET(sstPtr->colBufferSetup, 0x28000000); /* color buffer */
+  SET(sstPtr->fbzMode, SST_RGBWRMASK);
+  SET(sstPtr->fbzColorPath, SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
+  SET(sstPtr->textureMode, SST_RGB565 | SST_TC_REPLACE | SST_TCA_REPLACE);
+  /* set lod8 */
+  SET(sstPtr->tLOD, ((8 << 2) | (8 << 7)));
+    
+  /* 
+     first see if we have 4 Mbytes by writing a texel at 2MB followed by
+     a texel at 1MB and 0MB and then rendering using the texel at 2MB
+     if we have less memory it should not render correctly since we trash
+     the memory locations it would wrap to
+  */
+
+  data = sense(sstbase,info,tmu,0x200000, SENSE0);
+  if (data) {
+    data = sense(sstbase,info,tmu,0x200000, SENSE1);
+    if (data) {
+      *TmuMemorySize = 4; 
+      return(FXTRUE);
+    }
+  }
+
+  data = sense(sstbase,info,tmu,0x100000, SENSE0);
+  if (data) {
+    data = sense(sstbase,info,tmu,0x100000, SENSE1);
+    if (data) {
+      *TmuMemorySize = 2;
+      return(FXTRUE);
+    }
+  }
+  
+  data = sense(sstbase,info,tmu,0x000000, SENSE0);
+  if (data) {
+    data = sense(sstbase,info,tmu,0x000000, SENSE1);
+    if (data) {
+      *TmuMemorySize = 1; 
+      return(FXTRUE);
+    }
+  }
+
+#undef WAITLOOP
+  
+  return(FXFALSE);
+}
+
+/*---------------------------------------------------------------------------
+   NOTES:
+        assumes that board and registers are initialized
+        destroys part of the framebuffer
+  ---------------------------------------------------------------------------*/
+FX_EXPORT FxBool FX_CSTYLE
+sst96InitGetTmuInfo(FxU32 *sstbase, VG96Info *info)
+{
+  sstPtr = 
+    (volatile Sstregs *)(SST96_COMMAND_REGS(sstbase));
+
+  if(Init96GetTmuMemory(sstbase, info, 0, &info->tfxRam) == FXFALSE)
+    return(FXFALSE);
+  return(FXTRUE);
+}
+
+/*-------------------------------------------------------------------
+  Function: init96MapBoard
+  Date: 10/17
+  Implementor(s): jdt, dow
+  Library: init96
+  Description:
+  Looks for an SST-96 enabled VGA board on the system and maps that
+  boards physical address into linear memory.
+  Arguments:
+  rd:     Register descriptions
+  vID:    Vendor ID
+  dID:    Device ID
+  Return:
+  linear pointer to base of VGA board. 0 if fail
+  -------------------------------------------------------------------*/
+INITVG96ENTRY(init96MapBoard, FxBool , (void *rd, void *info, FxU16 vID, FxU16 dID) )
+{
+#define FN_NAME "init96MapBoard"
+
+  InitRegisterDesc
+    *regDesc = (InitRegisterDesc *) rd;
+
+  VG96Info *vg96Info = (VG96Info *) info;
+  
+  FxU32
+    vendorID = vID,
+    deviceID = dID;
+  
+  GDBG_INFO((80, "SST-96 Initialization code %s\n", revString));
+  
+  /* Watcom warning suppression */
+  revString[0] = revString[0];
+
+  /* !!! FIXME hack for vxd bug */
+  putenv( "SST_DUALHEAD=1" );
+  
+  switch (vID) {
+  case AT3DVID:
+#if 0
+    curHALData = initAT3DGetHALData();
+#endif
+    break;
+  case MCRXVID:
+    curHALData = initMCRXGetHALData();
+    break;
+  }
+
+
+  GDBG_INFO((80, "init96MapBoard:  Mapping card into linear memory\n"));
+  
+  regDesc->hwDep.VG96RegDesc.baseAddress =
+    pciMapCardMulti( vendorID, deviceID, curHALData->memSize, &devNum, 0 , 0);
+
+
+  if (regDesc->hwDep.VG96RegDesc.baseAddress == NULL) {
+#ifdef __WIN32__
+    MessageBox(NULL, pciGetErrorString(), NULL, MB_OK);
+#else
+    {
+#ifdef __linux__
+      fprintf(stderr, "Failed to map board: %s\n", pciGetErrorString());
+      exit(1);
+#else
+      /* Set Mode 3 before going */
+      union REGS
+        inR, outR;
+
+      inR.w.ax = 0x0003;
+      int386(0x10, &inR, &outR);
+      fprintf(stderr, "%s\n", pciGetErrorString());
+#endif
+    }
+#endif /* __WIN32__ */
+    exit(1);
+    return FXFALSE;
+  }
+
+  /* need to initialize sstHW ASAP */
+  sstHW  = regDesc->hwDep.VG96RegDesc.baseAddress;
+
+  GDBG_INFO((80, "%s:  Mapped Voodoo Rush board at 0x%x\n", 
+             FN_NAME, regDesc->hwDep.VG96RegDesc.baseAddress));
+
+  if (curHALData->initGetInfo)
+    (*curHALData->initGetInfo)(vg96Info);
+
+  fifoptr = regDesc->hwDep.VG96RegDesc.fifoApertureBase;
+
+  GDBG_INFO((88, "init96MapBoard sstHW = %x\n", sstHW));
+  
+  /* CHD NOTE:  The routine init96SetupRendering MUST Be called from this
+     routine or all hell brakes loose.
+     */
+
+  /* detect tmu memory size */
+#ifdef __linux__
+  {
+    FxBool rv=FXTRUE;
+    GrScreenResolution_t    res = GR_RESOLUTION_640x480;
+    static void init96SetupRendering(InitRegisterDesc *regDesc,
+				     GrScreenResolution_t sRes);
+
+    if (curHALData->initAperture)
+      (*curHALData->initAperture)(regDesc);
+       if ( curHALData->initEnableRegs )
+       rv = curHALData->initEnableRegs( regDesc );
+    if ( !rv )
+      return FXFALSE;
+    
+    init96SetupRendering(regDesc, res);
+    
+    sst96InitGetTmuInfo((FxU32 *)sstHW, vg96Info);
+    }
+#else
+#ifdef(__DOS32__)
+  {
+    /* In dos mode, we do it the way it is supposed to be.
+       In windows mode, calling initEnableRegs() will change the clock
+       rate and it makes the refresh looks bad. So we still use the 
+       init96SetVideo() to set up the rendering mode etc.
+       */
+    GrScreenResolution_t    res = GR_RESOLUTION_640x480;
+    FxBool rv = FXTRUE;
+
+    if (curHALData->initAperture)
+      (*curHALData->initAperture)(regDesc);
+
+    {
+      union REGS
+        inR, outR;
+      
+      inR.w.ax = 0x4f03;
+      int386(0x10, &inR, &outR);
+      
+      oldVidMode = outR.w.bx;
+      GDBG_INFO((80, "%s:  Saving Current video mode (0x%x).\n",
+                 FN_NAME, oldVidMode)); 
+    }
+    
+    if ( !rv )
+      return FXFALSE;
+    
+    if ( curHALData->initEnableRegs )
+      rv = curHALData->initEnableRegs( regDesc );
+    if ( !rv )
+      return FXFALSE;
+    
+    init96SetupRendering(regDesc, res);
+    
+    sst96InitGetTmuInfo((FxU32 *)sstHW, vg96Info);
+  }
+#else
+  {
+    int xres=1, yres=1, fbStride;
+    GrScreenResolution_t    res = GR_RESOLUTION_NONE;
+    init96SetVideo(0, res,
+                   0, 2, 1, 
+                   2, 1, regDesc,
+                   &xres, &yres, &fbStride );
+    sst96InitGetTmuInfo((FxU32 *)sstHW, vg96Info);
+    init96RestoreVideo(regDesc);
+  }
+#endif
+#endif
+
+  GDBG_INFO((80, "init96MapBoard:  returning FXTRUE\n"));
+  
+  return FXTRUE;
+
+#undef FN_NAME
+} /* init96MapBoard */
+
+
+#ifndef GDBG_INFO_ON
+#define WAITLOOP {\
+int nWaits;\
+volatile FxU32 waitRes;\
+  for (nWaits = 0; nWaits < 100000; nWaits++) {\
+   waitRes = GET(sstHW[0x90 + 0x100000]);\
+    if (waitRes & 0x80000000) break;\
+  }\
+}
+#else
+#define WAITLOOP {\
+int nWaits;\
+  volatile FxU32 waitRes;\
+    for (nWaits = 0; nWaits < 50000; nWaits++) {\
+      waitRes = sstHW[0x100000];\
+      if (waitRes & 0x80000000) break;\
+  }\
+}
+#endif  
+
+#define SWAPPENDING(status) ((status & 0x70) >> 4)
+
+/*-------------------------------------------------------------------
+  Function: init96SetupRendering
+  Date: 03-Sep-97
+  Implementor(s): dow
+  Library: Init Code for 96
+  Description:
+  
+  Arguments:
+  
+  Return:
+  -------------------------------------------------------------------*/
+static void
+init96SetupRendering(InitRegisterDesc *regDesc, GrScreenResolution_t sRes)
+{
+#define FN_NAME "init96SetupRendering"
+  FxU32 regVal;
+
+  sstHW  = regDesc->hwDep.VG96RegDesc.baseAddress;
+  sstPtr = 
+    (volatile Sstregs *)(SST96_COMMAND_REGS(regDesc->hwDep.VG96RegDesc.baseAddress));
+
+  /*------------------------------------------------------------
+    Initialize Jr and TMU
+    ------------------------------------------------------------*/
+  GDBG_INFO((80, "%s:  Software reset\n", FN_NAME));
+  SET(sstHW[0x90 + 0x100000], 0xf601); /* (0xf601) init0, sw reset. */
+    
+  WAITLOOP;
+
+  GDBG_INFO((80, "%s:  Zero Out CMD FIFO registers\n", FN_NAME));
+  SET(sstHW[0x100000 + 0x95], 0);
+  SET(sstHW[0x100000 + 0x94], 0);
+  SET(sstHW[0x100000 + 0x93], 0);
+    
+  GDBG_INFO((80, "%s:  Setting up Mem FIFO\n", FN_NAME));
+
+  GETREGVALFROMENV(regVal, "SST96_FBIJRINIT2", 0x70d20);
+
+  SET(sstHW[0x92 + 0x100000], regVal);
+    
+  /* Off for Host Blt, On for LFB command traffic 
+     Low Priority Request Aging - wait 64 cycles
+     before answering low priority requests from
+     AT3D on PUMA - 3F may not be optimal, should
+     be tweaked later, !!JDT
+     [24]   - PUMA Texture Address Space Mode      - 0x1 - 2MB
+     [23]   - PUMA Texture Base Address Mode       - 0x1 - 6MB
+     [12:7] - PUMA Low Priority Grant Limit Cnt    - 0x0 
+     [6]    - PUMA Low Prorirty Grant Limit Enable - 0x0 
+     [5:0]  - PUMA Low Priority Request Delay Cnt  - 0x1f - 32 ccls
+     Setting to 0x3f ( max ) seems to cripple windows/d3d
+     maybe blt operations suffer???
+     */
+  GDBG_INFO((80, "%s:  Setting low priority request aging.\n", FN_NAME));
+  /* 
+   * If we're running at a high resolution, don't starve AT3D's 
+   * video refresh.   XXX FIXME for AT3d only
+   */
+  if (sRes == GR_RESOLUTION_NONE) {
+    /* set the lpr delay to 0. It was 0x10 and the video refresh was not correct */
+    GETREGVALFROMENV(regVal, "SST96_FBIJRINIT1", 0x01800000);
+    SET(sstHW[0x91 + 0x100000], regVal);
+  } else {
+    GETREGVALFROMENV(regVal, "SST96_FBIJRINIT1", 0x0180003f);
+
+    if (myGetenv("SST96_MEMORYHINT")) {
+      regVal |= (0x1f << 13);
+    }
+    SET(sstHW[0x91 + 0x100000],regVal);
+  }
+    
+  /* Come out of Reset 
+     [17]    - Serial Status Xfer Mode     - 0x0 - rising edge
+     [16:12] - TREX-To-FBI High Water Mark - 0xf
+     [11:8]  - TREX-To-FBI Bus Clock Delay - 0x6
+     */    
+  
+  GDBG_INFO((80, "%s:  Coming out of FBI reset\n", FN_NAME));
+  GETREGVALFROMENV(regVal, "SST96_FBIJRINIT0", 0xf600);
+  SET(sstHW[0x90 + 0x100000], regVal); /* Bit 1 disables tmu */
+    
+  WAITLOOP;
+
+  GDBG_INFO((80, "%s:  Setting TMU FT & TF delays\n", FN_NAME));
+  {
+    FxU32 trexinit0, trexinit1;
+        
+    if(myGetenv(("SST_TREX0INIT0"))) {
+      sscanf(myGetenv(("SST_TREX0INIT0")), "%i", &trexinit0);
+    } else {
+      trexinit0 = 0x05441;      /* TREXINIT0 */
+    }
+        
+    if(myGetenv(("SST_TREX0INIT1"))) {
+      sscanf(myGetenv(("SST_TREX0INIT1")), "%i", &trexinit1);
+    } else {
+      trexinit1 = 0x3643c; /* TREXINIT1 */
+    }
+        
+    SET(sstHW[0xc7 + 0x100000], trexinit0); /* TREXINIT0 */
+    SET(sstHW[0xc8 + 0x100000], trexinit1); /* TREXINIT1 */
+  }
+  
+  WAITLOOP;
+  
+#undef FN_NAME
+} /* init96SetupRendering */
+
+/*-------------------------------------------------------------------
+  Function: initSet96Video
+  Date: 10/17
+  Implementor(s): jdt, murali
+  Library: init96
+  Description:
+  
+  1 - Set video mode
+  2 - Enable Direct Writes to Jr
+  3 - Put Jr registers in Reset
+  3 - Set up Color Buffer Registers
+  
+  Arguments
+  
+  Return:
+  FXFALSE - fail 
+  FXTRUE  - pass
+  -------------------------------------------------------------------*/
+INITVG96ENTRY(init96SetVideo, FxBool , 
+              (  FxU32                   hWnd,
+               GrScreenResolution_t    sRes,
+               GrScreenRefresh_t       vRefresh,
+               InitColorFormat_t       cFormat,
+               InitOriginLocation_t    yOrigin,
+               int                     nColBuffers,
+               int                     nAuxBuffers,
+               InitRegisterDesc        *regDesc,
+               int                     *xres,
+               int                     *yres,
+               int                     *fbStride) )
+{
+#define FN_NAME "init96SetVideo"
+  FxBool rv = FXTRUE;
+  InitSwapType_t swapType = 0;
+  InitBufDesc_t  bufDesc[NUM_BUFS];
+  FxU32 nTries = 0, status;
+  FxU32 regVal;
+  int i;
+
+  for (i = 0; i < NUM_BUFS; i++)
+    bufDesc[i].bufType = INIT_BUFFER_NONE;
+
+  if (myGetenv("SST96_FORCE_TRIPLE"))
+    nColBuffers = 3;
+
+  GDBG_INFO((80, "%s:  %d Color Buffers\n", FN_NAME, nColBuffers));
+
+  GDBG_INFO((80, "(%s) hWnd=%x, sRes=%d, yOrg=%d, ncb=%d, nab=%d\n", 
+             FN_NAME, hWnd, sRes, yOrigin, nColBuffers, nAuxBuffers));
+
+  /* YO!  Fix this comment
+     XXX this needs to be moved to post SetVideo code ??? */
+  GDBG_INFO((80, "%s:  Initializing Command Aperture\n", FN_NAME));
+
+  if (curHALData->initAperture)
+    (*curHALData->initAperture)(regDesc);
+  
+#if defined( __DOS32__ )
+  {
+    union REGS
+      inR, outR;
+
+    inR.w.ax = 0x4f03;
+    int386(0x10, &inR, &outR);
+
+    oldVidMode = outR.w.bx;
+    GDBG_INFO((80, "%s:  Saving Current video mode (0x%x).\n",
+               FN_NAME, oldVidMode)); 
+  }
+#endif
+  
+  /*-------------------------------------
+    Set Video Mode
+    -------------------------------------*/
+  /* this goes through the dxdrvr.c which is a misnomer
+     which will persist for the time being, in dos
+     this does not have anything to do with directX */
+#ifdef __linux__
+  if (!linOpen(hWnd, sRes, vRefresh, cFormat, yOrigin, 
+              nColBuffers, nAuxBuffers, bufDesc, 
+              xres, yres, &swapType)) {
+#else
+  if (!dxOpen(hWnd, sRes, vRefresh, cFormat, yOrigin, 
+              nColBuffers, nAuxBuffers, bufDesc, 
+              xres, yres, &swapType)) {
+#endif
+    GDBG_INFO((80, "Failed dxOpen\n"));
+    rv = FXFALSE;
+    goto BAIL;
+  }
+    
+#ifdef GDBG_INFO_ON  
+  for (i = 0; i < nColBuffers; i++) {
+    GDBG_INFO((80, "%s:  bufDesc[%d]:\n", FN_NAME, i));
+    GDBG_INFO((80, "%s:  bufDesc.bufType = %s\n",
+               FN_NAME, bufTypeNames[bufDesc[i].bufType]));
+    GDBG_INFO((80, "%s:  bufDesc.bufOffset = 0x%x\n", 
+               FN_NAME, bufDesc[i].bufOffset ));
+    GDBG_INFO((80, "%s:  bufDesc.bufStride = 0x%x\n", 
+               FN_NAME, bufDesc[i].bufStride));
+    GDBG_INFO((80, "%s:  bufDesc.bufBPP = 0x%x\n",
+               FN_NAME, bufDesc[i].bufBPP));
+  }
+#endif
+
+  if ( !rv ) goto BAIL;
+
+  /*-------------------------------------
+    Enable Direct Writes to JR
+    -------------------------------------*/
+  if ( curHALData->initEnableRegs )
+    rv = curHALData->initEnableRegs( regDesc );
+  if ( !rv ) goto BAIL;
+
+
+  init96SetupRendering(regDesc, sRes);
+
+  cachedYOrigin  = yOrigin;     /* Used later for init96Control */
+  cachedSwapType = swapType;
+
+  /*
+  **  Set Up Color Buffer Registers & triple buffering if necessary.
+  */
+  maxBuffer = (nColBuffers < 2) ? 2 : nColBuffers;
+  maxBufIdx = maxBuffer - 1;
+
+  GDBG_INFO((80, "%s:  maxBuffer = %d, maxBufIdx = %d\n",
+             FN_NAME, maxBuffer, maxBufIdx));
+
+  /* Send as many swapbuffers as status says are necessary */
+  {
+    FxU32
+      pending = 7;              /* # Swaps pending */
+            
+    GDBG_INFO((80, 
+               "%s:  Sending %d swapbufferCMDs\n", 
+               FN_NAME, 
+               pending));
+    while (pending) {
+      FxU32
+        tries = 0;
+                
+      GDBG_INFO((80, "%s: %d swaps pending\n", FN_NAME, pending))  ;
+
+      status =  sstHW[0x100000];
+      pending = SWAPPENDING(status);
+
+      while (pending--) {
+        SET(sstPtr->swapbufferCMD, 1);
+        status =  sstHW[0x100000];              /* bug #1152 */
+        ADVANCE_BUFFERS(dfb);
+        WAITLOOP;
+      }
+                
+      do {
+        ++tries;
+        status =  sstHW[0x100000];
+                    
+        GDBG_INFO((120, "%s:  Serial status = 0x%x\n", FN_NAME, status));
+        pending = SWAPPENDING(status);
+        if (tries > MAXTRIES) {
+          GDBG_INFO((80, "%s:  Bailing out after %d tries to get swap buffer pending to decrement\n", FN_NAME, tries));
+          rv = FXFALSE;
+          goto BAIL;
+        }
+      } while (pending);
+    }
+            
+    /* Clear counters with a NOP */
+    SET(sstHW[0x42 + 0x100000], 1); /* NOP cmd */
+
+    /* Wait for idle */
+    do {
+      if (nTries > MAXTRIES) {
+        GDBG_INFO((80, 
+                   "%s: Bailing out and returning false after %d checks for idle.\n", FN_NAME, nTries-1));
+        return FXFALSE;
+      }
+      ++nTries;
+      status = sstHW[0x100000];
+                
+      GDBG_INFO((80, 
+                 "%s: Serial status after soft reset: 0x%x\n", 
+                 FN_NAME, 
+                 status));
+    } while (status & 0x1);
+  } /* end of swap buffer block */
+
+  
+  if (tripleBuffering) {
+    GETREGVALFROMENV(regVal, "SST96_FBIJRINIT0", 0xf600);
+    regVal |= (1 << 2);
+    GDBG_INFO((80, "%s:  Enabling triple buffering.\n", FN_NAME));
+    /* dram read to write fast timing enable. bit 7 */
+    if (myGetenv("SST96_MEMORYHINT")) {
+      regVal |= (0x1 << 7);
+    }
+    SET(sstHW[0x90 + 0x100000], regVal); /* Bit 1 disables tmu */
+  }
+
+  /* Need to be converted to indices dfbFront.... rfbFront.... */
+
+  dfbFrontIdx =   0;
+  dfbBackIdx  =   1; 
+  dfbRenderIdx =  dfbBackIdx;
+
+  rfbFrontIdx =   0;
+  rfbBackIdx  =   1; 
+  rfbRenderIdx =  rfbBackIdx;
+
+  rv = init96LoadBufRegs(NUM_BUFS, bufDesc, *xres, *yres, regDesc);
+  if ( !rv ) {
+    GDBG_INFO((80, "Failed init96LoadBufRegs\n"));
+    goto BAIL;
+  }
+  
+  /*-------------------------------------
+    Set up Page Flipping
+    -------------------------------------*/
+  WAITLOOP;
+#if !defined( INIT96VGASWAP ) && !defined( __linux__ )
+  {
+    FxU32 buf[MAX_BUF];
+    int i;
+
+    for (i=0; i<maxBuffer; i++) buf[i] = bI[i].dfb;
+
+    /* Explicitly clear swap control things */
+    curHALData->initSwapTiles = NULL;
+
+    if (curHALData->initUseTiles && (swapType == INIT_SWAP_FLIP)) {
+#ifdef H3D
+      (*curHALData->initUseTiles)(regDesc, 
+                                buf,
+                                maxBuffer,
+                                bI[0].dfbStride,
+                                *xres, 
+                                *yres,
+                                GR_RESOLUTION_IS_AUTOFLIPPED(sRes) );
+#else
+      (*curHALData->initUseTiles)(regDesc, 
+                                buf,
+                                maxBuffer,
+                                bI[0].dfbStride,
+                                *xres, 
+                                *yres );
+#endif
+    }
+  }
+#endif
+  
+  *fbStride = (bI[1].dfbStride>>1);
+  GDBG_INFO(( 200, "frame buffer stride: %d\n", *fbStride ));
+  
+ BAIL:
+  return rv;
+#undef FN_NAME
+} /* init96SetVideo */
+
+
+/*-------------------------------------------------------------------
+  Function: init96RestoreVideo
+  Date: 3/16
+  Implementor(s): jdt
+  Library: init96
+  Description:
+  
+  Disable Direct Hardware Access
+  Restore the video to it's initial state
+  
+  Arguments:
+  none
+  Return:
+  none
+  -------------------------------------------------------------------*/
+INITVG96ENTRY(init96RestoreVideo, void, ( InitRegisterDesc *regDesc )) {
+#define FN_NAME "init96RestoreVideo" 
+  if ( curHALData->initDisableRegs )
+    curHALData->initDisableRegs( regDesc );
+  
+#if  defined( __WIN32__ ) && !defined( INIT_HOOPTI ) 
+  dxClose();
+#elif defined( __DOS32__ ) 
+  {
+    static union REGS
+      inR, outR;
+
+    GDBG_INFO((80, "%s:  Restoring VESA Mode 0x%x\n", FN_NAME, oldVidMode));
+    inR.w.ax = 0x4f02;
+    inR.w.bx = oldVidMode;
+
+    int386( 0x10, &inR, &outR );
+  }
+#elif defined( __linux__ )
+  linClose();
+#endif
+#undef FN_NAME
+} /* init96RestoreVideo */
+
+
+/*-------------------------------------------------------------------
+  Function: init96EnableTransport
+  Date: 3/17
+  Implementor(s): jdt
+  Library: init96
+  Description:
+  
+  Enable the JR command transport and return pertinant fifo 
+  information to the caller
+  
+  Arguments:
+  info - structure to fill with info about the FIFO
+  Return:
+  FXTRUE  - succeed
+  FXFALSE - fail
+  -------------------------------------------------------------------*/
+INITVG96ENTRY(init96EnableTransport, FxBool, ( InitFIFOData *info, InitRegisterDesc* regDesc)) 
+{
+#define FN_NAME "init96EnableTransport"
+  FxBool rv = FXTRUE;
+  FxU32 lo, hi, sz, th;
+  FxU32
+    fifoPhysBaseAddress,
+    fifoPhysSize;
+  FxBool
+    res;
+  PciMemType
+    fifoMemType;
+  
+  GDBG_INFO((80, "%s\n", FN_NAME));
+  
+  /*------------------------------------------------------------
+    Enable the Off Chip Fifo
+    ------------------------------------------------------------*/
+  
+  /* These are defined in sst.c for now */
+  lo = (fifoStart >> 12);     /* physaddr of 1st 4k page */
+  hi = (fifoEnd   >> 12);     /* physaddr of last 4k page */
+  sz = (hi - lo + 1) << 12;   /* bytes */
+  th = (hi - lo) - 3;         /* threshold, in 4k pages. */
+  
+  /* Generate virtual addresses for the pointers. */
+  fifovirt = (FxU32 *)&sstHW[lo << 10];
+  fifophys = lo << 12;
+  fifomax  = sz;
+  fifocur  = 0;
+  
+  fifoptr  = fifovirt;
+  fifosize = 4096;            /* initially, set to 4k */
+  
+  fifolfb = 1;
+  
+  /* First disable the off-chip fifo */
+  GDBG_INFO((80, "%s:  Disabling off-chip FIFO\n", FN_NAME));
+  SET(sstHW[0x100000 + 0x93], 0);
+  
+  /* FbijrInit4 - 0x94 - entry count */
+  SET(sstHW[0x100000 + 0x94], 0);
+  
+  /* FbijrInit5 - 0x95 - read pointer */
+  SET(sstHW[0x100000 + 0x95], lo << 9);
+
+  /* Default size to page checking mode. 
+   *
+   * NB: This will get overwritten later if we're using
+   * the other wrapping code.
+   */
+  info->hwDep.vg96FIFOData.fifoSize = fifosize;
+
+  /* Store fifo data to info */
+  info->hwDep.vg96FIFOData.fifoVirt = (FxU32*)fifovirt;
+  info->hwDep.vg96FIFOData.fifoMax  = fifomax;
+  info->hwDep.vg96FIFOData.fifoPhys = fifophys;
+  info->hwDep.vg96FIFOData.fifoCur  = fifocur;
+  info->hwDep.vg96FIFOData.fifoLfb  = fifolfb;
+
+  /* Set up alternate wrapping values. 
+   *
+   * NB: This *MUST* come before the processor dependent
+   * fifo ptr advancing that we do below.
+   */
+#if SST96_ALT_FIFO_WRAP
+  /* Assume hw is still at the start of the fifo */
+  info->hwDep.vg96FIFOData.fifoRead      = (FxU32)fifovirt;
+
+  info->hwDep.vg96FIFOData.roomToEnd     = fifomax;
+
+  info->hwDep.vg96FIFOData.fifoSize      =
+  info->hwDep.vg96FIFOData.roomToReadPtr = fifomax - sizeof(FxU32);
+
+  info->hwDep.vg96FIFOData.regDesc = regDesc;
+#endif /* SST96_ALT_FIFO_WRAP */
+
+  if (info->cpuType == 6) {
+    /*
+     **  Now, write 128 DWORDS of NULL to the FIFO, so the FIFO read
+     **  pointer trails the FIFO write pointer by 128 DWORDS.  The state
+     **  setting code fences every 128 DWORDS.
+     */
+    GDBG_INFO((125, "%s:  Advancing write pointer 128 DWORDS beyond read.\n",
+               FN_NAME));
+    do {
+      *fifoptr++ = 0L;
+      info->hwDep.vg96FIFOData.fifoSize -= 4;
+    } while (((FxU32) fifoptr) & 0xff);
+  } else {
+    GDBG_INFO((125, "%s:  No need for write pointer advance.\n",
+               FN_NAME));
+  }
+
+  /*
+  **  NOTE TO ALL FOOLS WHO TREAD HERE     
+  ** 
+  **  It is VITALLY important to enable the FIFO AFTER the
+  **  P6 Lag Of Love(tm), instead of before, otherwise the FIFO will
+  **  become horribly corrupted.
+  */
+
+    /* FbiJrInit3 - 0x93 - Load up offchip fifo register */
+    GDBG_INFO((80, "%s:  Loading up of offchip fifo register\n", FN_NAME));
+  SET(sstHW[0x100000 + 0x93], 1 | (lo <<  1) | (hi << 11) | (th << 21));
+
+  /* Set the fifo ptr now that we really know where its going to start
+   * for the client code. 
+   */
+  info->hwDep.vg96FIFOData.fifoPtr  = (FxU32*)fifoptr;
+
+  /* Turn on Write combining for the FIFO  */
+  pciGetConfigData(PCI_BASE_ADDRESS_0, devNum, &physAddr);
+
+  fifoPhysBaseAddress = physAddr + fifoStart;
+  fifoPhysSize = fifoEnd - fifoStart;
+  fifoMemType = PciMemTypeWriteCombining;
+
+  res = pciFindMTRRMatch(fifoPhysBaseAddress, fifoPhysSize,
+                         fifoMemType, &fifoMTRRNum);
+
+  if (!res) {
+    res = pciFindFreeMTRR(&fifoMTRRNum);
+  }
+
+  if (res)
+    pciSetMTRR(fifoMTRRNum, fifoPhysBaseAddress, fifoPhysSize, fifoMemType);
+  else
+    GDBG_INFO((80, "%s:  Couldn't get free or used MTRR!\n"));
+
+
+  return rv;
+
+#undef FN_NAME
+} /* init96EnableTransport */
+
+/*-------------------------------------------------------------------
+    Function: init96DisableTransport
+    Date: 3/16
+    Implementor(s): jdt
+    Library: init96
+    Description:
+    Put the command transport in a safe state
+    Arguments:
+    Return:
+    -------------------------------------------------------------------*/
+INITVG96ENTRY(init96DisableTransport, void, ( void )) 
+{
+#define FN_NAME "init96DisableTransport"
+  while (*(volatile FxU32 *)sstPtr & 1);
+  
+  SET(sstHW[0x100000 + 0x90], 0xf601); /* (0xf601) init0, sw reset. */
+  SET(sstHW[0x100000 + 0x95], 0);
+  SET(sstHW[0x100000 + 0x94], 0);
+  SET(sstHW[0x100000 + 0x93], 0);
+
+#if SST96_ALT_FIFO_WRAP
+  GDBG_INFO((80, "%s: Fifo Statistics - Wrapped:%ld Stalled:%ld\n",
+             numWraps, numStalls));
+#endif /* SST96_ALT_FIFO_WRAP */
+
+  /* Clear the MTRR */
+  pciSetMTRR(fifoMTRRNum, 0, 0, 0);
+#undef FN_NAME
+} /* init96DisableTransport */
+
+/*-------------------------------------------------------------------
+  Function: init96Swap
+  Date: 13-Feb-97
+  Implementor(s): jdt, dow, murali
+  Library: Init Code for VG96
+  Description:
+  Performs VG96 buffer swap
+  Arguments:
+  code:           usually vsync wait option
+  wcb:            method for writing to hardware
+  Return:
+  -------------------------------------------------------------------*/
+INITVG96ENTRY(init96Swap, void ,
+              (FxU32 code, InitRegisterDesc *rd, Init96WriteMethod *wcb) )
+{
+#define FN_NAME "init96Swap"
+  FxU32 status;
+
+  static FxBool gotEnv;
+  static FxBool overrideSwap;
+  static FxU32 overrideVal;
+
+  GDBG_INFO((80, "init96Swap()\n"));
+
+  /*
+   * For improved speed we take the following steps
+   * 1. remove the status checking
+   * 2. modify grBufferNumPending so it does not need to do P6 nudge code
+   * 3. add one p6 nudge code
+   * Here is step 1. Goto grBufferNumPending() in gglide.c to continue.
+   *
+   do {
+   GDBG_INFO((120, "%s:  Serial status = 0x%x\n", FN_NAME, status));
+   status = *rd->hwDep.VG96RegDesc.serialStatus;
+   } while (status & 0x1);
+   */
+
+  if (cachedSwapType == INIT_SWAP_FLIP) {
+#ifdef __linux__
+
+    FxU32
+      offset;
+    /* Wait for idle */
+    do {
+      status = sstHW[0x100000];
+    } while (status & 0x1);
+
+    offset = bI[rfbRenderIdx].dfbBase;
+    linFlip(offset);
+
+#else
+#ifndef INIT96VGASWAP
+    /* Direct Write to the Swap Pending register */
+    GDBG_INFO((80, "init96Swap: Sending sapppendCMD\n"));
+    GDBG_INFO((80, "  Direct Write of register 0x%x with value 0x%x\n", ((((FxU32) (&sstPtr->swappendCMD)) - (((FxU32) sstPtr) + 0x100000)) >> 2), 1));
+
+    sstPtr->swappendCMD = 0x1;
+    
+
+    if (gotEnv == FXFALSE) {
+      const char *envVal;
+      if ((envVal = myGetenv("SST96_INITSWAPCOUNT")) != NULL) {
+        sscanf(envVal, "%x", &overrideVal);
+        GDBG_INFO((80, "%s:  environment SST96_INITSWAPCOUNT (0x%x) overrode code\n",
+                   FN_NAME, overrideVal));
+        overrideSwap = FXTRUE;
+
+      }
+      gotEnv = FXTRUE;
+    }
+
+    if (overrideSwap == FXTRUE)
+      code = overrideVal;
+
+    GDBG_INFO((80, "%s:  Sending swapbufferCMD (0x%x) via FIFO callback\n",
+               FN_NAME, code));
+
+    wcb( (FxU32*)&(sstPtr->swapbufferCMD), 1 );
+    status =  sstHW[0x100000];          /* bug #1152 */
+
+    /* Use arrays & rotate for triple buffering */
+
+#else  /* Swapping With VGA */
+    /*
+     * This is for swapping by changing the VGA serial start register.
+     * a.k.a "Page flipping"
+     */
+    FxU32
+      offset;
+    FxU8
+      tmp,
+      serialOverflow;
+
+    GDBG_INFO((210, "%s: Swapping With VGA\n", FN_NAME));
+
+    /* Wait for idle */
+    do {
+      status = sstPtr->status & 0x1;
+    } while (status & 0x1);
+
+    offset = bI[rfbRenderIdx].dfb;
+
+    GDBG_INFO((80, "%s:  Swapping to offset 0x%x\n", FN_NAME, offset));
+    /* Fetch serial overflow and clear low nibble for serial start */
+    CRTC_GET(AR_CRTC_SERIAL_OVERFLOW_INDEX, serialOverflow);
+    serialOverflow &= 0xF0;
+    
+    /* Make sure scanout within active display */
+    do {
+      INP(VGA_INPUT_STATUS_1C, tmp);
+    } while (tmp & VIS1C_PIXEL_DISPLAY_INACTIVE);
+    
+    /* Set serial address */
+    /* For some reason unknown to me, this is set to the byte offset / 4,
+       or perhaps the offset in dwords */
+    
+    /* Top nibble */
+    tmp = (FxU8) ((offset >> (2+16)) & 0x0F);
+    CRTC_SET(AR_CRTC_SERIAL_OVERFLOW_INDEX, serialOverflow | tmp);
+    
+    /* Middle byte */
+    tmp = (FxU8) ((offset >> (2+8)) & 0xFF);
+    CRTC_SET(VR_CRTC_SERIAL_START_ADDRESS_HI_INDEX, tmp);
+    
+    /* Low byte */
+    tmp = (FxU8) ((offset >> 2) & 0xFF);
+    CRTC_SET(VR_CRTC_SERIAL_START_ADDRESS_LO_INDEX, tmp);
+    
+    /* Save away */
+    do {
+      INP(VGA_INPUT_STATUS_1C, tmp);
+    } while (tmp & VIS1C_VERTICAL_RETRACE_ACTIVE);
+
+    do {
+      INP(VGA_INPUT_STATUS_1C, tmp);
+    } while (!(tmp & VIS1C_VERTICAL_RETRACE_ACTIVE));
+#endif
+#endif
+    
+    /* dpc - 26 jan 1998
+     * Some hw, macronix, requires that we diddle w/ even more bits
+     * when we do the swap. 
+     */
+    if(curHALData->initSwapTiles != NULL) (*curHALData->initSwapTiles)(rd);
+    
+    ADVANCE_BUFFERS(rfb);
+
+    GDBG_INFO((80, "%s:  Setting colBufferSetup (0x%x, 0%x) via FIFO callback\n",
+               FN_NAME, bI[rfbRenderIdx].rfb,
+               bI[rfbRenderIdx].rfb));
+    wcb( (FxU32*)&(sstPtr->colBufferSetup), bI[rfbRenderIdx].rfb );
+    
+
+  } else {
+    while ((*rd->hwDep.VG96RegDesc.serialStatus) & 0x1);
+#ifdef __linux__
+    do {
+      status = sstHW[0x100000];
+    } while (status & 0x1);
+    linSwap(code);
+#else
+    dxSwap(code);
+#endif
+  }
+  GDBG_INFO((80, "%s:  returning\n", FN_NAME));
+  return;
+#undef FN_NAME
+} /* init96Swap */
+
+
+
+/*-------------------------------------------------------------------
+  Function: init96Idle
+  Date: 13-Feb-97
+  Implementor(s): dow, jdt, murali
+  Library: Init Code for VG96
+  Description:
+  
+  Arguments:
+  
+  Return:
+  -------------------------------------------------------------------*/
+INITVG96ENTRY(init96Idle, void , (Init96WriteMethod *wcb) )
+{
+#define FN_NAME "init96Idle"
+
+  volatile FxU32 *statReg = (volatile FxU32 *) &sstPtr->status;
+
+  wcb((FxU32*)&sstPtr->nopCMD, 0);
+
+  while ( (*statReg) & 0x1 ) { };
+
+#undef FN_NAME
+} /* init96Idle */
+
+/*-------------------------------------------------------------------
+  Function: init96GetBufferPtr
+  Date: 2/25
+  Implementor(s): jdt
+  Library: init code for vg96
+  Description:
+  Get a pointer to a specified buffer ( changes at swaps )
+  Arguments:
+  buffer - constant defining buffer
+  Return:
+  void opinter to buffer
+  -------------------------------------------------------------------*/
+#define LFB_OFFSET( X ) ( X & 0x3fffff )
+
+INITVG96ENTRY(init96GetBufferPtr, void*, (InitBuffer_t buffer, int *strideBytes)) 
+{
+#define FN_NAME "init96GetBufferPtr"
+  void *rv = 0;
+
+  GDBG_INFO((80,"%s\n", FN_NAME));
+
+  switch( buffer ) {
+  case INIT_BUFFER_FRONTBUFFER:
+    GDBG_INFO((80, "  get front buffer pointer" ));
+    rv = (void*)(((char*)sstHW)+bI[rfbFrontIdx].dfbBase);
+    *strideBytes = bI[rfbFrontIdx].dfbStride;
+    break;
+  case INIT_BUFFER_TRIPLEBUFFER:
+    rv = (void*)(((char*)sstHW)+bI[rfbTripleIdx].dfbBase);
+    *strideBytes = bI[rfbTripleIdx].dfbStride;
+    GDBG_INFO((80, "  get triple buffer pointer" ));
+    break;
+  case INIT_BUFFER_BACKBUFFER:
+    rv = (void*)(((char*)sstHW)+bI[rfbBackIdx].dfbBase);
+    *strideBytes = bI[rfbBackIdx].dfbStride;
+    GDBG_INFO((80, "  get back buffer pointer" ));
+    break;
+
+  case INIT_BUFFER_AUXBUFFER:
+    rv = (void*)(((char*)sstHW) + LFB_OFFSET(ab0));
+    *strideBytes = ab0Stride;
+    GDBG_INFO((80, "  get aux buffer pointer" ));
+    break;
+  }
+
+  GDBG_INFO((80, "%s:  strideBytes %.05d\n", FN_NAME, *strideBytes ));
+  GDBG_INFO((80, "%s:  returning   0x%x\n", FN_NAME, rv ));
+
+  return rv;
+#undef FN_NAME
+} /* init96GetBufferPtr */
+#undef LFB_OFFSET
+
+/*-------------------------------------------------------------------
+  Function: init96RenderBuffer
+  Date: 2/25
+  Implementor(s): jdt
+  Library: init96 
+  Description:
+  Set the current render buffer
+  Arguments:
+  buffer - which buffer to send render ops to
+  Return:
+  none
+  -------------------------------------------------------------------*/
+INITVG96ENTRY(init96RenderBuffer, void, (InitBuffer_t buffer,Init96WriteMethod *wcb)) 
+{
+#define FN_NAME "init96RenderBuffer"
+  GDBG_INFO((80,"%s\n", FN_NAME));
+
+  /* Mess around with indeces here i.e. rfbRender = rfbBack ....*/
+  switch( buffer ) {
+  case INIT_BUFFER_BACKBUFFER:
+    rfbRenderIdx = rfbBackIdx;
+    break;
+  case INIT_BUFFER_FRONTBUFFER:
+    rfbRenderIdx = rfbFrontIdx;
+    break;
+  }
+  wcb( (FxU32*)&(sstPtr->colBufferSetup), bI[rfbRenderIdx].rfb );
+
+#undef FN_NAME
+} /* init96RenderBuffer */
+
+/*-------------------------------------------------------------------
+  Function: init96Origin
+  Date: 2/26
+  Implementor(s): jdt
+  Library: init96
+  Description:
+  Set the yOrigin
+  Arguments:
+  origin
+  Return:
+  none
+  -------------------------------------------------------------------*/
+INITVG96ENTRY(init96Origin, void, (InitOriginLocation_t origin,Init96WriteMethod *wcb)) 
+{
+#define FN_NAME "init96Origin"
+  int i;
+  GDBG_INFO((80,"%s\n", FN_NAME));
+
+  /* Once the bases and tops are set, this is pretty straight forward */
+  switch ( origin ) {
+  case INIT_ORIGIN_UPPER_LEFT:
+    for (i=0; i<maxBuffer; i++) {
+      bI[i].rfb = bI[i].dfbBase | VG96STRIDE(bI[i].dfbStride);
+    }
+    ab0 = ab0Base | VG96STRIDE(ab0Stride);
+    break;
+  case INIT_ORIGIN_LOWER_LEFT:
+    for (i=0; i<maxBuffer; i++) {
+      bI[i].rfb = bI[i].dfbTop | VG96STRIDE(bI[i].dfbStride);
+    }
+    ab0 = ab0Top | VG96STRIDE(ab0Stride);
+    break;
+  }
+
+  wcb( (FxU32*)&(sstPtr->colBufferSetup), bI[rfbRenderIdx].rfb);
+  wcb( (FxU32*)&(sstPtr->auxBufferSetup), ab0 );
+#undef FN_NAME
+} /* init96Origin */
+
+/*-------------------------------------------------------------------
+  Function: init96ResyncBuffers
+  Date: 07-Mar-97
+  Implementor(s): murali
+  Library: Init Code for VG96
+  Description:
+  Performs VG96 buffer resync buffers
+  Arguments:
+  Return:
+  -------------------------------------------------------------------*/
+INITVG96ENTRY(init96Control, FxBool , ( FxU32 code, InitRegisterDesc *regDesc))
+{
+#define FN_NAME "init96Control"
+  int           xRes, yRes;
+  InitBufDesc_t bufDesc[5];
+
+  GDBG_INFO((80, "(%s)\n", FN_NAME));
+  
+  if ( !sstHW ) return FXFALSE;
+
+#ifdef __linux__
+  if (!linControl(code, bufDesc, &xRes, &yRes)) {
+#else
+  if (!dxControl(code, bufDesc, &xRes, &yRes)) {
+#endif
+    GDBG_INFO((80, "dxControl failed!\n"));
+    return FXFALSE;
+  }
+
+  if (!init96LoadBufRegs(NUM_BUFS, bufDesc,  xRes, yRes, regDesc)) {
+    GDBG_INFO((80, "init96LoadBufRegs failed\n"));
+  }
+
+  GDBG_INFO((80, "%s:  Returning TRUE\n", FN_NAME));
+  return (yRes << 16) | (xRes);
+#undef FN_NAME
+} /* init96Control */
+
+#if SST96_ALT_FIFO_WRAP
+
+#define MIN(__x, __y) (((__x) < (__y)) ? (__x) : (__y))
+#define MAX(__x, __y) (((__x) < (__y)) ? (__y) : (__x))
+
+/* Macro to get the hw's read ptr located somewhere in the frame
+ * buffer address space.
+ */
+#define SST96_HW_FIFO(__hwP, __regP) ((FxU32)(__hwP) + \
+                                      (*((volatile FxU32*)(((FxU32)(__regP)) + (0x95 << 12))) << 3))
+
+INITVG96ENTRY(init96WrapFIFO, 
+              FxBool, 
+              (InitRegisterDesc* rd, InitFIFOData* fifoP))
+{
+#define FN_NAME "init96WrapFIFO"
+  const FxI32 blockSize = fifoP->hwDep.vg96FIFOData.blockSize;
+
+#if GDBG_INFO_ON
+  /* no ASSERT macro. Just die if debugging is on. */
+  if (blockSize == 0xDEADBEEF) *(FxU32*)NULL = 0x00;
+#endif
+
+  {
+    const FxI32 writes = (MIN(fifoP->hwDep.vg96FIFOData.roomToReadPtr, 
+                              fifoP->hwDep.vg96FIFOData.roomToEnd) -
+                          fifoP->hwDep.vg96FIFOData.fifoSize);
+    
+    fifoP->hwDep.vg96FIFOData.roomToReadPtr -= writes;
+    fifoP->hwDep.vg96FIFOData.roomToEnd -= writes;
+  }
+
+again:
+  /* do we need to stall? */
+  {
+    FxU32 lastHwRead = fifoP->hwDep.vg96FIFOData.fifoRead;
+    FxI32 roomToReadPtr = fifoP->hwDep.vg96FIFOData.roomToReadPtr;
+
+    while (roomToReadPtr < blockSize) {
+      const FxU32 curReadPtr = SST96_HW_FIFO(sstHW, sstPtr);
+      const FxU32 curReadDist = curReadPtr - lastHwRead;
+      
+      roomToReadPtr += curReadDist;
+      if (lastHwRead > curReadPtr) roomToReadPtr += fifoP->hwDep.vg96FIFOData.fifoMax;
+
+      lastHwRead = curReadPtr;
+    }
+
+    GDBG_INFO((80, FN_NAME"_Wait : (0x%X : 0x%X) : (0x%X : 0x%X)\n", 
+               (FxU32)fifoP->hwDep.vg96FIFOData.fifoPtr, blockSize,
+               fifoP->hwDep.vg96FIFOData.roomToReadPtr,
+               fifoP->hwDep.vg96FIFOData.roomToEnd));
+
+    fifoP->hwDep.vg96FIFOData.fifoRead = lastHwRead;
+    fifoP->hwDep.vg96FIFOData.roomToReadPtr = roomToReadPtr;
+  }
+
+  /* wrap to front */
+  if (fifoP->hwDep.vg96FIFOData.roomToEnd <= blockSize) {
+      /* Pad out all of the fifo, save the last entry, w/ NUL ops. The
+       * last entry is written once we know that we are not going to
+       * overflow the entry count. Oh, for the cvg JMP packet type.
+       */
+#define kFifoPadDelay (sizeof(FxU32) << 1)
+#if GDBG_INFO_ON
+#define JU_JU_STALL numJuJuStalls++
+#else
+#define JU_JU_STALL /* Do Nothing */
+#endif      
+      {
+         volatile FxU32* fifoPtr = fifoP->hwDep.vg96FIFOData.fifoPtr;
+         const FxU32 wrapAddr = ((FxU32)fifoP->hwDep.vg96FIFOData.fifoVirt +
+                                 fifoP->hwDep.vg96FIFOData.fifoMax);
+
+         /* Do the padding up to the last entry or so. */
+         while((FxU32)fifoPtr < wrapAddr - kFifoPadDelay) *fifoPtr++ = 0x00UL;
+
+         /* Bad ju-ju awaits the person who wraps the fifo when the hw
+          * ptr is at the start of the fifo. (I've seen it happen, and
+          * it is not pretty.)
+          */
+         {
+            volatile FxU32* serialStatus =
+              fifoP->hwDep.vg96FIFOData.regDesc->hwDep.VG96RegDesc.serialStatus;
+            
+            if ((*serialStatus & 0x80) != 0x00) {
+               GDBG_INFO((85, FN_NAME": fifo close to full. Waiting(0x%X)...\n", numJuJuStalls));
+               while((*serialStatus & 0x80) != 0x00) JU_JU_STALL;
+               GDBG_INFO((85, FN_NAME": fifo drained (0x%X)\n", numJuJuStalls));
+            }
+         }
+
+         /* Finish the padding of the rest of the fifo to the end */
+         while((FxU32)fifoPtr < wrapAddr) *fifoPtr++ = 0x00UL;
+      }
+#undef JU_JU_STALL
+#undef kFifoPadDelay
+
+      GDBG_INFO((80, FN_NAME"_Wrap : (0x%X : 0x%X) : (0x%X : 0x%X)\n", 
+                 (FxU32)fifoP->hwDep.vg96FIFOData.fifoPtr, blockSize,
+                 fifoP->hwDep.vg96FIFOData.roomToReadPtr,
+                 fifoP->hwDep.vg96FIFOData.roomToEnd));
+      
+      fifoP->hwDep.vg96FIFOData.roomToReadPtr -= fifoP->hwDep.vg96FIFOData.roomToEnd;
+      fifoP->hwDep.vg96FIFOData.roomToEnd = fifoP->hwDep.vg96FIFOData.fifoMax;
+      
+      /* Reset fifo ptr to start */ 
+      fifoP->hwDep.vg96FIFOData.fifoPtr = fifoP->hwDep.vg96FIFOData.fifoVirt;
+      goto again;
+  }
+  
+  /* compute room left */
+  fifoP->hwDep.vg96FIFOData.roomToEnd -= blockSize;
+  fifoP->hwDep.vg96FIFOData.roomToReadPtr -= blockSize;
+  fifoP->hwDep.vg96FIFOData.fifoSize = MIN(fifoP->hwDep.vg96FIFOData.roomToReadPtr,
+                                           fifoP->hwDep.vg96FIFOData.roomToEnd) + blockSize;
+  
+  GDBG_INFO((80, FN_NAME": (0x%X : 0x%X) : (0x%X : 0x%X) : 0x%X\n",
+             (FxU32)fifoP->hwDep.vg96FIFOData.fifoPtr, blockSize,
+             fifoP->hwDep.vg96FIFOData.roomToReadPtr,
+             fifoP->hwDep.vg96FIFOData.roomToEnd,
+             fifoP->hwDep.vg96FIFOData.fifoSize));
+
+#if GDBG_INFO_ON
+  fifoP->hwDep.vg96FIFOData.blockSize = 0xDEADBEEF;
+#endif
+
+  return FXTRUE;
+#undef FN_NAME
+} 
+#else /* !SST96_ALT_FIFO_WRAP */
+
+/*-------------------------------------------------------------------
+  Function: init96FIFOWait
+  Date: 12-Jun-97
+  Implementor(s): dow
+  Library: Init Code for VG96
+  Description:
+  Waits for 0x80 in status
+  Arguments:
+  rd:     Description of registers.
+  Return:
+  Nothing
+  -------------------------------------------------------------------*/
+static void
+init96FIFOWait(InitRegisterDesc *rd)
+{
+#define FN_NAME "init96FIFOWait"
+  volatile FxU32 *pstatus;
+  
+
+  /* Check for more room. */
+  pstatus = (volatile FxU32 *) rd->hwDep.VG96RegDesc.serialStatus;
+  
+  if (*pstatus & 0x80) {        /* 0x80 is the FIFO threshold */
+    int  timeout;
+
+  again:
+    for (timeout = 0; timeout < 10000000; timeout++) {
+      if ((*pstatus & 0x80) == 0) break;
+    }
+    if (*pstatus & 0x80) {
+      GDBG_INFO((80, "Lost patience in %s.  Status is 0x%x\n",
+                 FN_NAME, *pstatus)); 
+      goto again;
+    }
+  }
+#undef FN_NAME  
+} /* init96FIFOWait */
+
+/*-------------------------------------------------------------------
+  Function: init96WrapFIFO
+  Date: 13-Feb-97
+  Implementor(s): dow
+  Library: Init Code for VG96
+  Description:
+  Wraps the VG96 FIFO
+  Arguments:
+  rd:     Description of registers.
+  Return:
+  FXTRUE if successful.
+  -------------------------------------------------------------------*/
+INITVG96ENTRY(init96WrapFIFO, FxBool , (InitRegisterDesc *rd, InitFIFOData *fifoData) )
+{
+#define FN_NAME "init96WrapFIFO"
+  FxBool rVal;
+  
+  GDBG_INFO((80,"%s\n", FN_NAME));
+  
+  while (fifoData->hwDep.vg96FIFOData.fifoSize > 0) {
+    *fifoData->hwDep.vg96FIFOData.fifoPtr++ = 0L;
+    fifoData->hwDep.vg96FIFOData.fifoSize -= 4;
+  }
+  
+  
+  fifoData->hwDep.vg96FIFOData.fifoCur += 4096;
+  
+  /* Wrap back to beginning? */
+  if (fifoData->hwDep.vg96FIFOData.fifoCur >= fifoData->hwDep.vg96FIFOData.fifoMax ) {
+    static int fifowraps = 0;
+    
+    fifoData->hwDep.vg96FIFOData.fifoCur = 0;
+    if ((fifowraps = (fifowraps + 1) & 0xf) == 0) {
+      GDBG_INFO((80, "%s:  Wrapping %s FIFO\n", 
+                 FN_NAME, 
+                 (fifoData->hwDep.vg96FIFOData.fifoLfb 
+                  ? "LFB" 
+                  : "Video Aperture")));
+    }
+
+    if (fifoData->hwDep.vg96FIFOData.fifoLfb) 
+      fifoData->hwDep.vg96FIFOData.fifoPtr = fifoData->hwDep.vg96FIFOData.fifoVirt;
+  }
+  
+  /*  */
+  {
+    FxU32
+      fbiJrInit5;
+    
+    GDBG_INFO((125, "%s:  Write = 0x%x\n", FN_NAME,
+               (FxU32) fifoData->hwDep.vg96FIFOData.fifoPtr -
+               (FxU32) fifoData->hwDep.vg96FIFOData.fifoVirt));
+    
+    fbiJrInit5 = *((volatile FxU32 *) (((FxU32) sstPtr) + (0x95 << 12)));
+
+    GDBG_INFO((125, "%s:  Read  = 0x%x\n", FN_NAME,
+               (fbiJrInit5 << 3) -
+               (
+                (FxU32) fifoData->hwDep.vg96FIFOData.fifoVirt -
+                (FxU32) rd->hwDep.VG96RegDesc.baseAddress
+                )
+               ));
+
+  }
+
+  GDBG_INFO((80, "%s:  Waiting for more room.\n", FN_NAME));
+  init96FIFOWait(rd);
+
+  /*
+  **   if we get here, then there's room in the FIFO
+  */
+
+  GDBG_INFO((80, "%s:  Got more room.\n", FN_NAME));
+  
+  /* At this point, we have atleast 1 more page of fifo. */
+  fifoData->hwDep.vg96FIFOData.fifoSize = 4096;
+  
+  rVal = FXTRUE;
+  
+  GDBG_INFO((80, "%s:  returning %s\n", FN_NAME, rVal ? "FXTRUE" : "FXFALSE"));
+  
+  return rVal;
+  
+#undef FN_NAME
+} /* init96WrapFIFO */
+
+#endif /* !SST96_ALT_FIFO_WRAP */
+
+/* 
+ * This function is used only locally, so none of Chris's decorations 
+ * Load colbufSetup and auxBufSetup registers, given a InitBufDesc_t
+ */
+static FxBool 
+init96LoadBufRegs(int nBuffers, InitBufDesc_t *pBufDesc, int xRes,
+                  int yRes, InitRegisterDesc *rd) 
+{
+#define FN_NAME "init96LoadBufRegs"
+  InitBufDesc_t   *pFront  = NULL;
+  InitBufDesc_t   *pBack   = NULL;
+  InitBufDesc_t   *pTriple = NULL;
+  InitBufDesc_t   *pAux    = NULL;
+  InitBufDesc_t   *pFifo   = NULL;
+  int i;
+    
+  GDBG_INFO((80, "(%s) w = %d, h = %d, n = %d\n",
+             FN_NAME, xRes, yRes, nBuffers));
+    
+  if ( !sstHW ) return FXFALSE;
+    
+  /* Take pBufDesc apart */
+  while (nBuffers-- > 0) {
+    switch (pBufDesc->bufType) {
+    case INIT_BUFFER_FRONTBUFFER:
+      GDBG_INFO((80, "%s: %s: 0x%x\n", 
+                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
+      pFront = pBufDesc;
+      break;
+    case INIT_BUFFER_BACKBUFFER:
+      GDBG_INFO((80, "%s: %s: 0x%x\n", 
+                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
+      pBack  = pBufDesc;
+      break;
+    case INIT_BUFFER_AUXBUFFER:
+      GDBG_INFO((80, "%s: %s: 0x%x\n", 
+                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
+      pAux   = pBufDesc; 
+      break;
+    case INIT_BUFFER_FIFOBUFFER:    
+      GDBG_INFO((80, "%s: %s: 0x%x\n", 
+                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
+      pFifo  = pBufDesc;
+      break;
+    case INIT_BUFFER_TRIPLEBUFFER:
+      GDBG_INFO((80, "%s: %s: 0x%x\n", 
+                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
+      pTriple = pBufDesc;
+      break;
+    default:
+      break;
+    }
+    pBufDesc++;
+ }
+  if (pFront  == NULL) return FXFALSE;
+  if (pBack   == NULL) pBack = pFront;
+  if (pTriple == NULL) pTriple = pFront;
+  if (pAux    == NULL) pAux  = pFront;
+
+  GDBG_INFO((80,"pFront = %.08x, pBack = %.08x, pTriple = %.08x, pAux = %.08x, pFifo = %.08x\n",
+             pFront, pBack, pTriple, pAux, pFifo));
+    
+  if (myGetenv("SST96_FORCEALIGN")) {
+    FxU32 F, B, T, A;
+    
+    sscanf(myGetenv("SST96_FORCEALIGN"), "%x,%x,%x,%x", &F, &B, &T, &A);
+    GDBG_INFO((80, "!!!!!GROSS HACK... forcing values!!!!!\n"));
+    pFront->bufOffset = F;
+    pBack->bufOffset = B;
+    pTriple->bufOffset = T;
+    pAux->bufOffset = A;
+  }
+
+  if (pFront)
+  GDBG_INFO((80,"F = %.08x, s= %6d\n", pFront->bufOffset, pFront->bufStride));
+  if (pBack)
+    GDBG_INFO((80,"B = %.08x, s= %6d\n", pBack ->bufOffset, pBack ->bufStride));
+  if (pTriple)
+    GDBG_INFO((80,"T = %.08x, s= %6d\n", pTriple ->bufOffset, pTriple ->bufStride));
+  if (pAux)
+    GDBG_INFO((80,"A = %.08x, s= %6d\n", pAux  ->bufOffset, pAux  ->bufStride));
+  if (pFifo)
+    GDBG_INFO((80,"C = %.08x, s= %6d\n", pFifo ->bufOffset, pFifo ->bufStride));
+    
+  /* Fill the arrays here */
+  bI[0].dfbBase   = pFront->bufOffset; 
+  bI[0].dfbStride = pFront->bufStride;
+  bI[0].dfbTop    = pFront->bufOffset + (yRes-1) * pFront->bufStride;
+    
+  bI[1].dfbBase   = pBack->bufOffset;
+  bI[1].dfbStride = pBack->bufStride;
+  bI[1].dfbTop    = pBack->bufOffset + (yRes-1) * pBack->bufStride;
+
+  if (pTriple) {
+    bI[2].dfbBase   = pTriple->bufOffset;
+    bI[2].dfbStride = pTriple->bufStride;
+    bI[2].dfbTop    = pTriple->bufOffset + (yRes-1) * pTriple->bufStride;
+  }
+
+  ab0Base   = pAux->bufOffset;
+  ab0Stride = pAux ->bufStride;
+  ab0Top    = pAux->bufOffset + (yRes-1) * pAux->bufStride;
+
+  for (i=0; i<maxBuffer; i++) {
+    bI[i].dfb = bI[i].dfbBase | VG96STRIDE(bI[i].dfbStride);
+  }
+
+  if (cachedYOrigin == INIT_ORIGIN_UPPER_LEFT) {
+    for (i=0; i<maxBuffer; i++) {
+      bI[i].rfb = bI[i].dfbBase | VG96STRIDE(bI[i].dfbStride);
+    }
+    ab0 = ab0Base | VG96STRIDE(ab0Stride);
+  } else { /* cachedYOrigin == INIT_ORIGIN_LOWER_LEFT */
+    for (i=0; i<maxBuffer; i++) {
+      GDBG_INFO((80, "%s:  Buffer %d stride = 0x%x\n",
+                 FN_NAME, i, bI[i].dfbStride));
+      bI[i].rfb = bI[i].dfbTop | VG96STRIDE(bI[i].dfbStride);
+      GDBG_INFO((80, "%s: setting render buffer %d = 0x%x\n",
+                 FN_NAME, i, bI[i].rfb));
+    }
+    ab0 = ab0Top | VG96STRIDE(ab0Stride);
+  }
+
+  GDBG_INFO((80,"%s: dfb0 = %.08x, dfb1 = %.08x, dfb2 = %.08x, ab0 = %.08x\n",
+             FN_NAME, bI[0].dfb, bI[1].dfb, bI[2].dfb, ab0));
+
+  GDBG_INFO((80,"%s: rfb0 = %.08x, rfb1 = %.08x, rfb2 = %.08x, ab0 = %.08x\n",
+             FN_NAME, bI[0].rfb, bI[1].rfb, bI[2].rfb, ab0));
+
+  GDBG_INFO((80,"%s:  Setting 0x60 to %.08x, 0x61 to %.08x\n",
+             FN_NAME, bI[dfbRenderIdx].dfb, ab0));
+
+  SET(sstHW[0x60 + 0x100000], bI[rfbRenderIdx].rfb);
+  SET(sstHW[0x61 + 0x100000], ab0);
+
+  if (pFifo == NULL) {
+    GDBG_INFO((80, "init96LoadBufRegs: Bad pFifo\n"));
+    return FXFALSE;
+  }
+
+  if (pFifo) {
+    fifoStart = pFifo->bufOffset;
+    fifoEnd   = pFifo->bufOffset + pFifo->bufStride;
+  }
+  
+  GDBG_INFO((80, "%s:  Returning TRUE\n", FN_NAME));
+  return FXTRUE;
+#undef FN_NAME
+} /* init96LoadBufRegs */
+
+/*-------------------------------------------------------------------
+  Function: init96GetFBVram
+  Date: 24-Apr-97
+  Implementor(s): pgj
+  Library: Test for 2Mb or 4Mb board
+  Description: This routine returns the number of bytes of VRAM
+  on the board.  Currently only 2 or 4 MB are returned on
+  success. Zero is returned of the board is not mapped.
+  XXX This should be refined in the future. XXX
+  
+  Arguments: none
+  
+  Return: n, where n == available VRAM in bytes on the board
+  -------------------------------------------------------------------*/
+INITVG96ENTRY(init96GetFBVram, FxU32 , (void) )
+{
+#define FN_NAME "init96GetFBVram"
+  VG96Info info;
+
+  if (curHALData->initGetInfo) {
+    (*curHALData->initGetInfo)(&info);
+    GDBG_INFO((80, "%s:  returning %d bytes\n", FN_NAME, info.vg96Ram));
+    return info.vg96Ram;
+  } else {
+    GDBG_INFO((80, "%s:  curHALData not valid!!!\n", FN_NAME));
+    return 0;
+  }
+
+#undef FN_NAME
+} /* init96GetFBVram */
Index: trunk/src/opengl/glide/sst1/init/init96/init96.h
===================================================================
--- trunk/src/opengl/glide/sst1/init/init96/init96.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init96/init96.h	(revision 2885)
@@ -0,0 +1,69 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:29 $
+**
+** SST-96 Initialization library
+*/
+
+
+#ifndef __INIT96_H__
+#define __INIT96_H__
+
+/* Partners' Chips */
+#define AT3D            1       /* Alliance Semiconductor AT3D*/
+#define T9685           2       /* Trident 9685 */
+#define MR510           3       /* MRTI MR510 */
+#define MX86251         4       /* Macronics MX 86251 */
+
+#ifndef INIT96_LIB
+#define INITVG96ENTRY(name, retType, args) FX_ENTRY retType FX_CALL name args
+#else
+#define INITVG96ENTRY(name, retType, args) FX_EXPORT retType FX_CSTYLE name args
+#endif
+
+typedef void Init96WriteMethod( FxU32 *addr, FxU32 data );
+
+INITVG96ENTRY(init96MapBoard, FxBool,
+              (void *rD, void *info, FxU16 vID, FxU16 dID) );
+INITVG96ENTRY(init96SetVideo, FxBool ,
+              (FxU32 hWnd, GrScreenResolution_t sRes,
+               GrScreenRefresh_t vRefresh, InitColorFormat_t cFormat,
+               InitOriginLocation_t yOrigin,int nColBuffers,
+               int nAuxBuffers, InitRegisterDesc *rd, int *xres, 
+               int *yres, int *fbStride)); 
+INITVG96ENTRY(init96RestoreVideo, void, ( InitRegisterDesc *regDesc ));
+INITVG96ENTRY(init96EnableTransport, FxBool, ( InitFIFOData *info, InitRegisterDesc* regDesc));
+INITVG96ENTRY(init96DisableTransport, void, ( void ));
+INITVG96ENTRY(init96Swap, void ,
+              (FxU32 code, InitRegisterDesc *regDesc, 
+               Init96WriteMethod *wcb) );
+INITVG96ENTRY(init96Idle, void , (Init96WriteMethod *wcb) );
+INITVG96ENTRY(init96GetBufferPtr, void*,
+              (InitBuffer_t buffer, int *strideBytes )); 
+INITVG96ENTRY(init96RenderBuffer, void,
+              (InitBuffer_t buffer,Init96WriteMethod *wcb));
+INITVG96ENTRY(init96Origin, void,
+              (InitOriginLocation_t origin, Init96WriteMethod *wcb));
+INITVG96ENTRY(init96Control, FxBool , (FxU32 code, InitRegisterDesc *rd) );
+INITVG96ENTRY(init96WrapFIFO, FxBool ,
+              (InitRegisterDesc *rd, InitFIFOData *fifoData) );
+INITVG96ENTRY(init96GetFBVram, FxU32 , (void) );
+#endif /* __INIT96_H__ */
Index: trunk/src/opengl/glide/sst1/init/init96/initat3d.h
===================================================================
--- trunk/src/opengl/glide/sst1/init/init96/initat3d.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init96/initat3d.h	(revision 2885)
@@ -0,0 +1,51 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:31 $ 
+**
+*/
+#ifndef __INITAT3D_H__
+#define __INITAT3D_H__
+
+#define AT3D_IN_VSYNC (_inp(INPUT_STATUS_1) & VERTICAL_RETRACE_ACTIVE)
+
+#ifdef INIT_AT3D_LIB
+#define INITAT3DENTRY(fun, type, args) FX_EXPORT type FX_CALL fun args
+#else
+#define INITAT3DENTRY(fun, type, args) FX_ENTRY type FX_CSTYLE fun args
+#endif
+INITAT3DENTRY(initAT3DGetHALData, Init96HALData *, (void) );
+INITAT3DENTRY(initAT3DAperture, FxBool, (InitRegisterDesc *rd) );
+INITAT3DENTRY(initAT3DSetVideo, FxBool, ( GrScreenResolution_t res, GrScreenRefresh_t refresh, FxU32 *xr, FxU32 *yr ));
+INITAT3DENTRY(initAT3DEnableRegs, FxBool,(InitRegisterDesc *rd));
+INITAT3DENTRY(initAT3DDisableRegs,FxBool,(InitRegisterDesc *rd));
+#ifdef H3D
+INITAT3DENTRY(initAT3DUseTiles, int, (InitRegisterDesc *rd,
+        FxU32 *buffers, FxU32 nBuffers,
+        FxU32 strideInBytes, FxU32 width, FxU32 height, FxU32 pageFlipping)); 
+#else
+INITAT3DENTRY(initAT3DUseTiles, int, (InitRegisterDesc *rd,
+        FxU32 *buffers, FxU32 nBuffers,
+        FxU32 strideInBytes, FxU32 width, FxU32 height)); 
+#endif
+INITAT3DENTRY(initAT3DGetInfo, FxBool,(VG96Info *info));
+#endif /* __INITAT3D_H__ */
+
Index: trunk/src/opengl/glide/sst1/init/init96/initmcrx.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/init96/initmcrx.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init96/initmcrx.c	(revision 2885)
@@ -0,0 +1,612 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:31 $ 
+**
+*/
+static char revString[] = "@#%$Workfile: initmcrx.c $ $Revision: 1.1 $";
+
+#include <3dfx.h>
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#ifndef __linux__
+#include <conio.h>
+#else
+#include <fxpci.h>
+#define _inp(port) pioInByte(port);
+#define _outp(port,data) pioOutByte(port, data);
+#define _outpw(port,data) pioOutWord(port, data);
+#endif
+#ifdef __DOS32__
+#include <i86.h>
+#endif
+
+#ifdef __WIN32__
+#include <windows.h>
+#endif /* __WIN32__ */
+
+#define INIT_MCRX_LIB
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <gdebug.h>
+#include <init.h>
+
+
+#include <initvga.h>
+#include "fxinit96.h"
+#include "initmcrx.h"
+
+#ifndef BIT
+#define BIT(a)       (1 << a)
+#endif
+
+/* Global Data */
+static Init96HALData mcrxHALData = {
+  0x2000000,
+  initMCRXAperture,
+  initMCRXSetVideo,
+  initMCRXEnableRegs,
+  initMCRXDisableRegs,
+  initMCRXWrapFIFO,
+  initMCRXUseTiles,
+  initMCRXGetInfo,
+  NULL /* initMCRXSwapTiles */
+};
+
+
+#if 0 /* ??? needed??? XXX */
+static FxBool tiling;
+#endif
+
+/*-------------------------------------------------------------------
+  Function: intiMCRXGetHALData
+  Date: 09-May-97
+  Implementor(s): dow
+  Library: Init Code for MCRX
+  Description:
+  
+  Arguments:
+  
+  Return:
+        address of mcrxHALData
+  -------------------------------------------------------------------*/
+INITMCRXENTRY(initMCRXGetHALData, Init96HALData *, (void) )
+{
+#define FN_NAME "intiMCRXGetHALData"
+  return &mcrxHALData;
+#undef FN_NAME
+} /* intiMCRXGetHALData */
+
+/*-------------------------------------------------------------------
+  Function: initMCRXAperture
+  Date: 3-May-97
+  Implementor(s): dow
+  Library: Init Code for MCRX
+  Description:
+  Initialize rd pointers to access apertures
+  Arguments:
+  
+  Return:
+  -------------------------------------------------------------------*/
+INITMCRXENTRY(initMCRXAperture, FxBool , (InitRegisterDesc *rd) )
+{
+#define FN_NAME "initMCRXAperture"
+  FxBool
+    rVal = FXTRUE;
+
+  GDBG_INFO((80, "%s:\n", FN_NAME));
+
+  rd->hwDep.VG96RegDesc.partnerRegPtr = (FxU32 *)
+    ((FxU32) rd->hwDep.VG96RegDesc.baseAddress +
+     0x2000000 - 0x20000);
+
+  GDBG_INFO((80, "%s:  Setting partnerRegPtr to 0x%x\n", 
+             FN_NAME, rd->hwDep.VG96RegDesc.partnerRegPtr));
+  
+#if 1
+  rd->hwDep.VG96RegDesc.serialStatus = (FxU32 *)
+    ((FxU32) rd->hwDep.VG96RegDesc.partnerRegPtr + 0x700);
+#else
+  GDBG_INFO((80, "%s:  Working around invalid serial status\n", FN_NAME));
+  rd->hwDep.VG96RegDesc.serialStatus =
+    &rd->hwDep.VG96RegDesc.baseAddress[0x100000];
+#endif
+  GDBG_INFO((80, "%s:  Setting seial status to 0x%x\n", FN_NAME, rd->hwDep.VG96RegDesc.serialStatus));
+
+  /* BOGUS */
+  rd->hwDep.VG96RegDesc.fifoApertureBase =
+    (FxU32 *) (((FxU32)rd->hwDep.VG96RegDesc.baseAddress) + 0x400000);
+  
+  GDBG_INFO((80, "%s:  returning TRUE\n", FN_NAME));
+  
+  return rVal;
+
+#undef FN_NAME
+} /* initMCRXAperture */
+
+/* FIXME !! jdt - need to add more resolutions to dos */
+INITMCRXENTRY(initMCRXSetVideo, FxBool, (GrScreenResolution_t res, GrScreenRefresh_t refresh, FxU32 *xr, FxU32 *yr )) 
+{
+#define FN_NAME "initMCRXSetVideo"
+  FxBool rv = FXTRUE;
+#if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ ) 
+  union REGS r0, r1;
+#endif
+  
+  GDBG_INFO((80, "%s: \n", FN_NAME));
+
+#if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ ) 
+  switch( res ) {
+  case GR_RESOLUTION_320x200:
+    /* Set up VESA Mode 0x136 - 320x200x16 */
+    r1.w.ax = 0x4f02;
+    r1.w.bx = 0x0136;
+    *xr = 320;
+    *yr = 200;
+    rv = FXTRUE;
+    break;
+  case GR_RESOLUTION_320x240:
+    /* Set up VESA Mode 0x137 - 320x240x16 */
+    r1.w.ax = 0x4f02;
+    r1.w.bx = 0x0137;
+    *xr = 320;
+    *yr = 240;
+    rv = FXTRUE;
+    break;
+  case GR_RESOLUTION_512x384:
+    /* Set up VESA Mode 0x139 - 512x384x16 */
+    r1.w.ax = 0x4f02;
+    r1.w.bx = 0x0139;
+    *xr = 512;
+    *yr = 384;
+    rv = FXTRUE;
+    break;
+  case GR_RESOLUTION_640x480:
+    /* Set up VESA Mode 0x111 - 640x480x16 */
+    r1.w.ax = 0x4f02;
+    r1.w.bx = 0x0111;
+    *xr = 640;
+    *yr = 480;
+    rv = FXTRUE;
+    break;
+  case GR_RESOLUTION_800x600:
+    /* Set up VESA Mode 0x114 - 800x600x16 */
+    r1.w.ax = 0x4f02;
+    r1.w.bx = 0x0114;
+    *xr = 800;
+    *yr = 600;
+    rv = FXTRUE;
+    break;
+  default:
+    rv = FXFALSE;
+    break;
+  }
+
+  if (rv == FXTRUE) {
+    GDBG_INFO((80, "initMCRXSetVideo: Enabling VESA modes\n"));
+    r0.w.ax = 0x6483;
+    r0.w.bx = 0x0060;
+    int386( 0x10, &r0, &r0 );
+
+    GDBG_INFO((80, "initMCRXSetVideo: Setting video mode %dx%dx16\n",
+                                                        *xr, *yr));
+    int386( 0x10, &r1, &r1 );
+  }
+
+#endif
+  GDBG_INFO((80, "%s: returning %s\n", FN_NAME, rv?"TRUE":"FALSE"));  
+  return rv;
+#undef FN_NAME  
+} /* initMCRXSetVideo */
+
+/*-------------------------------------------------------------------
+  Function: initMCRXEnableRegs
+  Date: 07-Feb-97
+  Implementor(s): dow
+  Library: Init Code for MCRX
+  Description:
+
+  Do all setup necessary to enable direct writes to JR Space
+  
+  Arguments:
+  rd - pointer to register description
+  
+  Return:
+  True if success, False if Failure
+  -------------------------------------------------------------------*/
+INITMCRXENTRY(initMCRXEnableRegs, FxBool, (InitRegisterDesc *rd))  
+{
+#define FN_NAME "initMCRXEnableRegs"
+  FxU32 
+    tmp;
+  FxU8
+    crtcIndex;
+  FxU16
+    protState;
+
+  const char *envVal;
+
+  GDBG_INFO((80, "%s:\n", FN_NAME));
+
+  GDBG_INFO((80, "%s:  Unprotect\n", FN_NAME));
+
+  GDBG_INFO((80, "%s:    Save CRTC Index\n", FN_NAME));
+  INP(0x3c4, crtcIndex);
+
+  GDBG_INFO((80, "%s:    Save Extended Registers Protection State\n",
+             FN_NAME));
+  
+  OUTP(0x3d4, 0x19);
+  INP(0x3d5, protState);
+
+  protState <<= 8;
+  protState |= 0x19;
+
+  GDBG_INFO((80, "%s:  Enabling Access to Extended Registers\n", FN_NAME));
+  OUTPW(0x3d4, 0x8819);
+
+  /* Getting initial values of the mclock for later restore */
+  GDBG_INFO((80, "%s: Getting macronix mclock registers\n", FN_NAME));
+  OUTP(0x3C4, 0x1A);
+  INP(0x3C5, rd->hwDep.VG96RegDesc.mclockHi);
+
+  OUTP(0x3C4, 0x1B);
+  INP(0x3C5, rd->hwDep.VG96RegDesc.mclockLo);
+  GDBG_INFO((80, "%s: mclock registers: (0x%X : 0x%X)\n", FN_NAME, 
+             (FxU32)rd->hwDep.VG96RegDesc.mclockHi, (FxU32)rd->hwDep.VG96RegDesc.mclockHi));
+  
+  GDBG_INFO((80, "%s:  Enabling FBI Jr.\n", FN_NAME));
+  OUTPW(0x3C4, 0x001F);
+
+  GDBG_INFO((80, "%s:  Setting clock to 50MHz\n", FN_NAME));
+  OUTPW(0x3c4, 0x011a);
+  OUTPW(0x3c4, 0x061b);
+
+  /* Macronix reset propogation */
+  GDBG_INFO((80, "%s:  Macronix reset\n", FN_NAME));
+  OUTPW(0x3c4, 0x081c);
+  OUTPW(0x3c4, 0x001c);
+
+  GDBG_INFO((80, "%s:  Hard Reset of FBI Jr.\n", FN_NAME));
+  OUTPW(0x3d4, 0x0029);
+  OUTPW(0x3d4, 0x0129);
+
+  GDBG_INFO((80, "%s:  Enabling PUMA\n", FN_NAME));
+  CRTC_GET(0x28, tmp);
+  tmp |= 1;
+  if (envVal = myGetenv("MCRX_28")) sscanf(envVal, "%x", &tmp);
+  CRTC_SET(0x28, tmp);
+
+  GDBG_INFO((80, "%s:  Restoring Protection\n", FN_NAME));
+  OUTP(0x3d4, protState);
+
+  GDBG_INFO((80, "%s:  Restoring Sequencer Index\n", FN_NAME));
+  OUTP(0x3c4, crtcIndex);
+
+  return FXTRUE;
+
+#undef FN_NAME
+} /* initMCRXEnableRegs */
+
+
+/* FIXME!!! jdt - puma/ram timing fixes need to go here */
+INITMCRXENTRY(initMCRXDisableRegs,FxBool,(InitRegisterDesc *rd)) 
+{
+#define FN_NAME "initMCRXDisableRegs"
+  FxU8
+    seqSave, crtcSave;
+  
+  FxU16
+    protState;
+
+  FxU32
+    tmp;
+
+  GDBG_INFO((80, "%s:\n", FN_NAME));
+
+  GDBG_INFO((80, "%s:  Saving Sequencer Index\n", FN_NAME));
+  INP(0x3c4, seqSave);
+
+  GDBG_INFO((80, "%s:  Saving CRTC Index\n", FN_NAME));
+  INP(0x3d4, crtcSave);
+
+  GDBG_INFO((80, "%s:  Saving Protection State\n", FN_NAME));
+  OUTP(0x3d4, 0x19);
+  INP(0x3d5, protState);
+
+  protState <<= 9;
+  protState |= 0x19;
+
+  GDBG_INFO((80, "%s:  Enabling access to extended registers\n", FN_NAME));
+  OUTPW(0x3d4, 0x8819);
+
+  /* Reset 3Dfx chip via macronix */
+  GDBG_INFO((80, "%s:  Reset 3Dfx via macronix\n", FN_NAME));
+  OUTPW(0x3d4, 0x0029);
+  OUTPW(0x3d4, 0x0129);
+
+  GDBG_INFO((80, "%s:  Disabling PUMA\n", FN_NAME));
+  CRTC_GET(0x28, tmp);
+  GDBG_INFO((80, "%s:  crtc 0x28: 0x%X\n", FN_NAME, tmp));
+  tmp &= ~1; 
+  CRTC_SET(0x28, tmp);
+
+  GDBG_INFO((80, "%s:  Turning off FBI Jr.\n", FN_NAME));
+  OUTPW(0x3c4, 0x061f);
+
+  /* Restore the mclock */
+  {
+    FxU16 tempMclock;
+    
+    GDBG_INFO((80, "%s:  Restoring mclock\n", FN_NAME));
+    tempMclock = (0x1A | (rd->hwDep.VG96RegDesc.mclockHi << 8));
+    OUTPW(0x3C4, tempMclock);
+    
+    tempMclock = (0x1B | (rd->hwDep.VG96RegDesc.mclockLo << 8));
+    OUTPW(0x3C4, tempMclock);
+
+    /* Macronix MCLK reset propogation */
+    OUTPW(0x3C4, 0x081C);
+    OUTPW(0x3C4, 0x001C);
+  }
+  
+  GDBG_INFO((80, "%s:  Restoring Protection\n", FN_NAME));
+  OUTPW(0x3df, protState);
+
+  GDBG_INFO((80, "%s: Restoring CRTC Index\n", FN_NAME));
+  OUTP(0x3d4, crtcSave);
+
+  GDBG_INFO((80, "%s: Restoring Sequencer Index\n", FN_NAME));
+  OUTP(0x3c4, seqSave);
+
+  return FXTRUE;
+  
+#undef FN_NAME
+} /* initMCRXDisableRegs */
+
+/*-------------------------------------------------------------------
+  Function: initMCRXWrapFIFO
+  Date: 20-Feb-97
+  Implementor(s): tarolli
+  Library: Init Code for MCRX
+  Description:
+  
+  Arguments:
+  
+  Return:
+  -------------------------------------------------------------------*/
+INITMCRXENTRY(initMCRXWrapFIFO, FxBool, (InitRegisterDesc *rd, InitFIFOData *fd) )
+{
+#define FN_NAME "initMCRXWrapFIFO"
+  return FXFALSE;
+#undef FN_NAME
+} /* initMCRXWrapFIFO */
+
+#define MAX_BUF 3
+
+static unsigned char magic[MAX_BUF][3] = {
+  { 0x0d, 0x0c, 0x21 },
+  { 0x71, 0x72, 0x73 },
+  /* chd - Fixme! 
+   * Bogus numbers.  Does triple buffering work on Macronix?
+   * 
+   * dpc - 23 jan 1998 - 
+   * Donny just told me this so hopefully this will work.
+   */
+  { 0x74, 0x75, 0x76 }
+};
+
+INITMCRXENTRY(initMCRXSwapTiles, FxBool, (InitRegisterDesc* rd))
+{
+#define FN_NAME "initMCRXSwapTiles"
+  FxU8 crtcSwapStatus;
+  FxU8 crtcSwapControl;
+
+  /* Get the # of buffers swapping */
+  OUTP(0x3D4, 0x70);
+  INP(0x3D5, crtcSwapControl);
+
+  /* Get the current active buffer setting */
+  OUTP(0x3D4, 0x7A);
+  INP(0x3D5, crtcSwapStatus);
+
+  /* Bits 0-1 indicate the current active buffer.  Check to see if we
+   * need to wrap this and go to the next buffer.
+   */
+  {
+    const FxU8 bufferBits = (crtcSwapStatus & 0x03);
+    const FxU8 maxBufferBits = (((crtcSwapControl & 0x08) == 0) ? 1 : 2);
+
+    crtcSwapStatus = ((crtcSwapStatus & ~0x03) | 
+                      ((bufferBits == maxBufferBits) ? 0x00 : bufferBits + 1));
+    CRTC_SET(0x7A, crtcSwapStatus);
+  }
+  
+  /* We have no way of knowing that this worked so of course we always
+   * return success.
+   */
+  return FXTRUE;
+#undef FN_NAME
+}
+
+/*-------------------------------------------------------------------
+  Function: initMCRXUseTiles
+  Date: 07-Feb-97 (Moved into initMCRX from init96)
+  Implementor(s): pgj, dow
+  Library: Init Code for MCRX
+  Description:
+  
+  Arguments:
+  atmm:                 Pointer to base of MCRX
+  buffers:              Pointer to array of offsets to buffers
+  nBuffers:             Total number of buffers
+  backBuffer:           FB offset of back buffer
+  strideInBytes:        Tile width in bytes
+
+  Return:
+  1 if successful, 2 if renderbuffers need to be swapped.
+  -------------------------------------------------------------------*/
+#ifdef H3D
+INITMCRXENTRY(initMCRXUseTiles, int, (InitRegisterDesc *rd,
+                                      FxU32 *buffers,
+                                      FxU32 nBuffers,
+                                      FxU32 strideInBytes,
+                                      FxU32 Width, FxU32 Height, FxU32 PageFlipping)) 
+#else
+INITMCRXENTRY(initMCRXUseTiles, int, (InitRegisterDesc *rd,
+                                      FxU32 *buffers,
+                                      FxU32 nBuffers,
+                                      FxU32 strideInBytes,
+                                      FxU32 Width, FxU32 Height)) 
+#endif
+{
+#define FN_NAME "initMCRXUseTiles"
+
+  int ret = 1;
+  unsigned int i;
+
+  FxU32
+    dwordOffset;
+
+  FxU8
+    regVal;
+
+  FxU32
+    tmp;
+
+  const char *envVal;
+  
+  GDBG_INFO((80, "%s:\n", FN_NAME));
+
+  regVal = _inp(VGA_MISC_OUTPUT_READ);
+  /* Mask off bit 7 */
+  regVal |= (1<<7);
+  _outp(VGA_MISC_OUTPUT_WRITE, regVal);
+
+  /*---------------------------------
+    CONFIGURE TILES
+    ---------------------------------*/
+  for (i=0; i < nBuffers; i++) {
+    FxU32
+      buf = buffers[i];
+
+    GDBG_INFO((80, "%s:  Setting up buffer %d\n", FN_NAME, i));
+
+    dwordOffset = buf >> 2;
+
+    GDBG_INFO((80, "%s:  Buffer[%d] = 0x%x, dwordOffset = 0x%x\n",
+             FN_NAME, i, buf, dwordOffset));
+
+    GDBG_INFO((80, "%s:  Writing bits 0-7 of buffer 0 offset\n", FN_NAME));
+    tmp = (FxU8) (dwordOffset & 0xff);
+
+    CRTC_SET(magic[i][0], tmp);
+
+    GDBG_INFO((80, "%s:  Writing bits 8-15 of buffer 0 offset\n", FN_NAME));
+    tmp = (FxU8) ((dwordOffset >> 8) & 0xff);
+    CRTC_SET(magic[i][1], tmp);
+
+    GDBG_INFO((80, "%s:  Writing bits 16-19 of buffer 0 offset\n", FN_NAME));
+    tmp = (FxU8) ((dwordOffset >> 16) & 0xf);
+    CRTC_SET(magic[i][2], tmp);
+  }
+
+  GDBG_INFO((80, "%s:  Setting up Swap Control\n", FN_NAME));
+  tmp = 0x01;
+
+  /* dpc - 26 han 1998
+   * If we are triple buffering we need to enable this on the actual
+   * macronix part as well. This is set by enabling bit 3 of the crtc
+   * register.  
+   */
+  if (nBuffers == 3) tmp |= 0x08;
+  mcrxHALData.initSwapTiles = initMCRXSwapTiles;
+
+  if (envVal = myGetenv("MRCX_71")) 
+    sscanf(envVal, "%x", &tmp);
+  CRTC_SET(0x70, tmp);
+
+  /* Reset the current display buffer bits (0-1) */
+  {
+    FxU8 crtcSwapBuffer;
+
+    OUTP(0x3D4, 0x7A);
+    INP(0x3D5, crtcSwapBuffer);
+
+    crtcSwapBuffer &= ~0x03;
+    CRTC_SET(0x7A, crtcSwapBuffer);
+  }
+
+  return ret;
+
+#undef FN_NAME
+} /* initMCRXUseTiles */
+ 
+
+/*-------------------------------------------------------------------
+  Function: initMCRXGetInfo
+  Date: 28-Apr-97
+  Implementor(s): pgj, dow
+  Library: Init Code for MCRX
+  Description:
+
+  get information about MCRX
+  
+  Arguments:
+  info - pointer to info struct
+  
+  Return:
+  True if success, False if Failure
+  -------------------------------------------------------------------*/
+INITMCRXENTRY(initMCRXGetInfo,FxBool,(VG96Info *info))  
+{
+#define FN_NAME "initMCRXGetInfo"
+  FxU32 mBytesPow;
+  FxU8 res;
+
+  GDBG_INFO((80, "%s:\n", FN_NAME));
+
+  CRTC_GET(0x1a, res);
+
+  /* We care about bit 5 & 6 */
+  mBytesPow = ((res >> 5) & 3);
+
+  /* Watcom warning suppression */
+  revString[0] = revString[0];
+  
+  info->vgaChip = 0;
+  info->vg96Rev = 0;
+  info->nTFX    = 1;
+  info->tfxRev  = 1;
+  info->tfxRam  = 2;
+  
+  info->vg96Ram = (0x100000 << mBytesPow);
+
+  GDBG_INFO((80, "%s: frame buffer has 0x%x bytes\n", FN_NAME, info->vg96Ram));
+  
+  return FXTRUE;
+  
+#undef FN_NAME
+} /* initMCRXGetInfo */
+
+
Index: trunk/src/opengl/glide/sst1/init/init96/initmcrx.h
===================================================================
--- trunk/src/opengl/glide/sst1/init/init96/initmcrx.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init96/initmcrx.h	(revision 2885)
@@ -0,0 +1,52 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:31 $ 
+**
+*/
+#ifndef __INITMCRX_H__
+#define __INITMCRX_H__
+#define SETMCRX(d,s) d = s
+#define GETMCRX(s) s 
+
+#ifdef INIT_MCRX_LIB
+#define INITMCRXENTRY(fun, type, args) FX_EXPORT type FX_CALL fun args
+#else
+#define INITMCRXENTRY(fun, type, args) FX_ENTRY type FX_CSTYLE fun args
+#endif
+INITMCRXENTRY(initMCRXGetHALData, Init96HALData *, (void) );
+INITMCRXENTRY(initMCRXAperture, FxBool, (InitRegisterDesc *rd) );
+INITMCRXENTRY(initMCRXSetVideo, FxBool, ( GrScreenResolution_t res, GrScreenRefresh_t refresh, FxU32 *xr, FxU32 *yr ));
+INITMCRXENTRY(initMCRXEnableRegs, FxBool,(InitRegisterDesc *rd));
+INITMCRXENTRY(initMCRXDisableRegs,FxBool,(InitRegisterDesc *rd));
+INITMCRXENTRY(initMCRXWrapFIFO, FxBool , (InitRegisterDesc *rd, InitFIFOData *fd) );
+#ifdef H3D
+INITMCRXENTRY(initMCRXUseTiles, int, (InitRegisterDesc *rd,
+        FxU32 *buffers, FxU32 nBuffers,
+        FxU32 strideInBytes, FxU32 width, FxU32 height, FxU32 PageFlipped));
+#else
+INITMCRXENTRY(initMCRXUseTiles, int, (InitRegisterDesc *rd,
+        FxU32 *buffers, FxU32 nBuffers,
+        FxU32 strideInBytes, FxU32 width, FxU32 height));
+#endif
+INITMCRXENTRY(initMCRXGetInfo, FxBool,(VG96Info *info));
+#endif /* __INITMCRX_H__ */
+
Index: trunk/src/opengl/glide/sst1/init/init96/initvga.h
===================================================================
--- trunk/src/opengl/glide/sst1/init/init96/initvga.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init96/initvga.h	(revision 2885)
@@ -0,0 +1,121 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:31 $ 
+**
+*/
+
+#ifndef _INITPIO_H_
+#define _INITPIO_H_
+
+#if defined(__WATCOMC__)
+#define _inp inp
+#define _outp outp
+#define _outpw outpw
+#endif
+
+/* 
+** Some Standard VGA Registers 
+*/
+/* Reading */
+#define VGA_MISC_OUTPUT_READ    0x3cc
+
+/* Writing */
+#define VGA_MISC_OUTPUT_WRITE    0x3c2
+
+/* Read/Write */
+#define VGA_REGISTER_INPUT_STATUS_1_MONO                    0x3BA
+#define VGA_REGISTER_INPUT_STATUS_1_COLOR                   0x3DA
+#define VGA_INPUT_STATUS_1C                     0x3DA
+#define VIS1C_PIXEL_DISPLAY_INACTIVE            BIT(0)
+#define VIS1C_VERTICAL_RETRACE_ACTIVE           BIT(3)
+
+#define VGA_REGISTER_CRTC                                   0x3D4
+#define VR_CRTC_SERIAL_START_ADDRESS_HI_INDEX               0x0C
+#define VR_CRTC_SERIAL_START_ADDRESS_LO_INDEX               0x0D
+#define AR_CRTC_SERIAL_OVERFLOW_INDEX                       0x1C
+
+/* General Port I/O */
+#ifdef GDBG_INFO_ON
+
+#define OUTP(port,val)\
+GDBG_INFO((80, "%s:  Writing 0x%x to port 0x%x\n", FN_NAME, val, port));\
+_outp(port, val)
+
+#define OUTPW(port,val)\
+GDBG_INFO((80, "%s:  Writing 0x%x to port 0x%x\n", FN_NAME, val, port));\
+_outpw(port, val)
+
+
+#define INP(port, val)\
+val = _inp(port);\
+GDBG_INFO((80, "%s:  Read 0x%x from port 0x%x\n", FN_NAME, val, port))
+
+#define INPW(port, val)\
+val = _inpW(port);\
+GDBG_INFO((80, "%s:  Read 0x%x from port 0x%x\n", FN_NAME, val, port))
+
+#else
+
+#define OUTP(port, val) _outp(port, val)
+#define INP(port, val)  val = _inp(port)
+
+#define OUTPW(port, val) _outpw(port, val)
+#define INPW(port, val)  val = _inpw(port)
+
+#endif
+
+/* Macros for Sequencer registers */
+#define SEQU_INDEX               0x3c4
+#define SEQU_DATA                0x3c5
+
+/* Macros for CRTC registers */
+#define CRTC_INDEX              0x3d4
+#define CRTC_DATA               0x3d5
+
+#ifdef GDBG_INFO_ON
+
+#define SEQU_SET(reg,val)\
+GDBG_INFO((80, "%s:  Writing 0x%x to Sequencer Index 0x%x\n", FN_NAME, val, reg));\
+_outp(SEQU_INDEX, reg); _outp(SEQU_DATA, val)
+#define SEQU_GET(reg,val)\
+_outp(SEQU_INDEX, reg);val = _inp(SEQU_DATA);\
+GDBG_INFO((80, "%s:  Read 0x%x from Sequencer Index 0x%x\n", val, reg));
+
+#define CRTC_SET(reg,val)\
+GDBG_INFO((80, "%s:  Writing 0x%x to CRTC Index 0x%x\n", FN_NAME, val, reg));\
+_outp(CRTC_INDEX, reg); _outp(CRTC_DATA, val)
+#define CRTC_GET(reg,val)\
+_outp(CRTC_INDEX, reg); val = _inp(CRTC_DATA);\
+GDBG_INFO((80, "%s:  Read 0x%x from CRTC Index 0x%x\n", FN_NAME, val, reg))
+
+#else
+
+#define SEQU_SET(reg,val) _outp(SEQU_INDEX, reg); _outp(SEQU_DATA, val)
+#define SEQU_GET(reg,val) _outp(SEQU_INDEX, reg); val = _inp(SEQU_DATA)
+
+#define CRTC_SET(reg,val) _outp(CRTC_INDEX, reg); _outp(CRTC_DATA, val)
+#define CRTC_GET(reg,d)   _outp(CRTC_INDEX, reg); d = _inp(CRTC_DATA)
+
+#endif
+
+
+#endif /* _INITPIO_H_ */
Index: trunk/src/opengl/glide/sst1/init/init96/lindrvr.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/init96/lindrvr.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init96/lindrvr.c	(revision 2885)
@@ -0,0 +1,575 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+*/
+
+#include <X11/Xlib.h>
+#include <X11/extensions/xf86dga.h>
+#include <X11/extensions/xf86vmode.h>
+#ifndef DUMMY
+#include <X11/extensions/xf86rush.h>
+#endif
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+
+/* 3Dfx Headers */
+#include <3dfx.h>
+#include <fxpci.h>
+#include <gdebug.h>
+#include <sst.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <string.h>
+
+#include <init.h>
+
+/* Local Headers */
+#include "init96.h"
+#include "fxinit96.h"
+
+#define VG96_BUF_MAGIC  0x666
+#define FIFOSIZE (65536<<1)
+
+FxBool tripleBuffering = 0;
+
+#define NUM_BUFS 6
+
+#ifndef DUMMY
+static Display		    *dpy	= 0;
+static int		    screenNum   = 0;
+static int		    screenWidth = 0;
+static void*		    screenPhys  = 0;
+static int		    screenMem   = 0;
+static GC		    xgc		= 0;
+static Window               hWndApp     = 0;
+static FxU32                Width       = 0; 
+static FxU32                Height      = 0;
+static FxBool               IsFullScreen = 0;
+static InitBufDesc_t        BufDesc[NUM_BUFS]  = {0};
+static XF86VidModeModeInfo  **vidModes = 0;
+
+static Pixmap  pixBack      = 0;
+static Pixmap  pixAux       = 0;
+static Pixmap  pixTriple    = 0;
+static Pixmap  pixFifo      = 0;
+static void *addrFront = 0;
+static void *addrBack = 0;
+static void *addrAux = 0;
+static void *addrTriple = 0;
+static void *addrFifo = 0;
+#endif
+
+#ifdef DUMMY
+FxBool
+linOpen(
+    FxU32                hWindow,
+    GrScreenResolution_t sRes,
+    GrScreenRefresh_t    vRefresh,
+    InitColorFormat_t    cFormat,
+    InitOriginLocation_t yOrigin,
+    int                  nColBuffers,
+    int                  nAuxBuffers,
+    InitBufDesc_t        *pBufDesc,         // return values
+    int                  *width,
+    int                  *height,
+    InitSwapType_t       *swapType
+)
+{
+  return FXFALSE;
+}
+
+FxBool linClose()
+{
+  return FXFALSE;
+}
+
+FxBool
+linControl(FxU32 code, InitBufDesc_t *pBufDesc, int *width, int *height)
+{
+  return FXFALSE;
+}
+
+void
+linSwap(FxU32 code)
+{}
+
+void
+linFlip(FxU32 buffer)
+{}
+
+#else
+
+static FxBool
+ErrorMessage(Window win, char *err)
+{
+  fprintf(stderr, "Error %s \n", err);
+  return FXFALSE;
+} /* ErrorMessage */
+
+FxBool linSetup() {
+  int eventbase, errorbase;
+  int banksize;
+
+  if (dpy!=0) return FXTRUE;
+  dpy=XOpenDisplay("");
+  if (!dpy)
+    return ErrorMessage(hWndApp, "Linux VRush only runs under local X\n");
+  if (XF86DGAQueryExtension(dpy, &eventbase, &errorbase)) {
+    int major, minor;
+    XF86DGAQueryVersion(dpy, &major, &minor);
+    if (major>1 && minor<0) {
+      XCloseDisplay(dpy);
+      return ErrorMessage(hWndApp, "Linux VRush requires DGA version 1.0\n");
+    }
+  }
+  if (XF86RushQueryExtension(dpy, &eventbase, &errorbase)) {
+    int major, minor;
+    XF86RushQueryVersion(dpy, &major, &minor);
+    if (major>1 && minor<0) {
+      XCloseDisplay(dpy);
+      return ErrorMessage(hWndApp, "Linux VRush requires Rush version 1.0\n");
+    }
+  }
+  screenNum=XDefaultScreen(dpy);
+  XF86DGAGetVideoLL(dpy, screenNum, (int*)&screenPhys, &screenWidth, &banksize,
+		    &screenMem);
+  screenMem*=1024;
+  return FXTRUE;
+}
+
+static FxBool
+cvtAddrToBufDesc(void *pixAddr, InitBufDesc_t *pDesc) {
+  pDesc->bufOffset = (FxU32)pixAddr;
+  pDesc->bufStride = (FxI32)(2*screenWidth);
+  pDesc->bufBPP    = (FxI32)16;
+  return FXTRUE;
+}
+
+static int 
+cvtXToGlideDesc(InitBufDesc_t *pDesc) {
+  InitBufDesc_t   *dFront  = &pDesc[0];
+  InitBufDesc_t   *dBack   = &pDesc[1];
+  InitBufDesc_t   *dAux    = &pDesc[2];
+  InitBufDesc_t   *dFifo   = &pDesc[3];
+  InitBufDesc_t   *dScreen = &pDesc[4];
+  InitBufDesc_t   *dTriple = &pDesc[5];
+
+  dScreen->bufMagic = VG96_BUF_MAGIC;
+  dScreen->bufType  = INIT_BUFFER_SCREENBUFFER;
+  dScreen->bufOffset = 0;
+  dScreen->bufStride = 0;
+  dScreen->bufBPP    = 0;
+
+  *dFront = *dBack = *dAux = *dFifo = *dTriple = *dScreen;
+
+  /* Get info about screen (framebuffer) */
+  if (!cvtAddrToBufDesc(screenPhys, dScreen))
+    return ErrorMessage(hWndApp, "Couldn't get Screen Info");
+
+  /* Get info about the front buffer (window) */
+  dFront->bufType = INIT_BUFFER_FRONTBUFFER;
+  if (!cvtAddrToBufDesc(addrFront, dFront))
+    return ErrorMessage(hWndApp, "Couldn't get Frontbuffer Info");
+  dFront->bufOffset -= dScreen->bufOffset;
+
+  /* Get info about back buffer (pixmap) */
+  dBack->bufType  = INIT_BUFFER_BACKBUFFER;
+  if (!cvtAddrToBufDesc(addrBack, dBack))
+    return ErrorMessage(hWndApp, "Couldn't get Backbuffer Info");
+  dBack->bufOffset -= dScreen->bufOffset;
+  
+  /* Get info about aux buffer (pixmap) */
+  dAux->bufType = INIT_BUFFER_AUXBUFFER;
+  if (!cvtAddrToBufDesc(addrAux, dAux)) 
+    return ErrorMessage(hWndApp, "Couldn't get AuxBuffer Info");
+  dAux->bufOffset -= dScreen->bufOffset;
+  
+  /* Get info about triple buffer (pixmap if used) */
+  if (tripleBuffering) {
+    dTriple->bufType  = INIT_BUFFER_TRIPLEBUFFER;
+    if (!cvtAddrToBufDesc(addrTriple, dTriple))
+      return ErrorMessage(hWndApp, "Couldn't get triple buffer Info");
+    dTriple->bufOffset -= dScreen->bufOffset;
+  }
+
+  /* Get info about cmdFifo (pixmap) */
+  dFifo->bufType   = INIT_BUFFER_FIFOBUFFER;
+  dFifo->bufOffset = (int)addrFifo-dScreen->bufOffset;
+  dFifo->bufStride = FIFOSIZE;
+  
+  GDBG_INFO((80, "cvtXToGlideDesc: dFront->bufOffset = 0x%x\n", dFront->bufOffset));
+  GDBG_INFO((80, "cvtXToGlideDesc: dBack->bufOffset = 0x%x\n", dBack->bufOffset));
+  GDBG_INFO((80, "cvtXToGlideDesc: dAux->bufOffset = 0x%x\n", dAux->bufOffset));
+  GDBG_INFO((80, "cvtXToGlideDesc: dFifo->bufOffset = 0x%x\n", dFifo->bufOffset));
+  if (tripleBuffering)
+    GDBG_INFO((80, "cvtXToGlideDesc: dTriple->bufOffset = 0x%x\n", dTriple->bufOffset));
+
+  GDBG_INFO((80,
+    "F:%.06x %5d B:%.06x %5d B2:%.06x %5d A:%.06x %5d, C:%.06x %5d\n",
+             dFront->bufOffset, dFront->bufStride,
+             dBack ->bufOffset, dBack ->bufStride,
+             dTriple->bufOffset, dTriple->bufStride,
+             dAux  ->bufOffset, dAux  ->bufStride,
+             dFifo ->bufOffset, dFifo ->bufStride));
+  return FXTRUE;
+}
+
+static void
+doReleasePixmaps() {
+  if (!dpy) return;
+  XF86RushUnlockAllPixmaps(dpy);
+  if (pixAux) XFreePixmap(dpy, pixAux);
+  if (pixBack) XFreePixmap(dpy, pixBack);
+  if (pixTriple) XFreePixmap(dpy, pixTriple);
+  if (pixFifo) XFreePixmap(dpy, pixFifo);
+  pixAux=pixBack=pixTriple=pixFifo=0;
+}
+
+static void
+findWindow(Display *dpy, Window hWndApp, void **addrFront) {
+  XWindowAttributes attr;
+  int x=0, y=0, num;
+  Window root=-1, parent, *children;
+
+  do {
+    XQueryTree(dpy, hWndApp, &root, &parent, &children, &num);
+    /* Find out how big the window is */
+    if (!XGetWindowAttributes(dpy, hWndApp, &attr)) {
+      ErrorMessage(hWndApp, "Failed to get window attributes\n");
+      return;
+    }
+    x+=attr.x;
+    y+=attr.y;
+    if (hWndApp!=root) hWndApp=parent;
+  } while (hWndApp!=root);
+  *addrFront=screenPhys+(y*screenWidth+x)*2;
+}
+
+static int
+doAllocPixmaps(int xRes, int yRes, int vRefresh, 
+		      InitBufDesc_t *pDesc) {
+    GDBG_INFO((80, "doAllocPixmaps: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d\n", 
+             hWndApp, IsFullScreen, xRes, yRes, vRefresh));
+
+  doReleasePixmaps();
+
+  pixFifo=XCreatePixmap(dpy, hWndApp, screenWidth,
+			(FIFOSIZE/2+4096+screenWidth-1)/screenWidth, 16);
+  if ((XF86RushLockPixmap(dpy, screenNum, pixFifo, &addrFifo)==FXFALSE)
+      || !addrFifo) {
+    doReleasePixmaps();
+    return ErrorMessage(hWndApp, "Failed to lock fifo pixmap\n");
+  }
+  xRes = (xRes+3)&~3;
+  yRes = (yRes+3)&~3;
+
+  findWindow(dpy, hWndApp, &addrFront);
+  pixBack=XCreatePixmap(dpy, hWndApp, xRes, yRes, 16);
+  if ((XF86RushLockPixmap(dpy, screenNum, pixBack,
+			  &addrBack)==FXFALSE) || !addrBack) {
+    doReleasePixmaps();
+    return ErrorMessage(hWndApp, "Failed to lock back pixmap\n");
+  }
+  pixAux=XCreatePixmap(dpy, hWndApp, xRes, yRes, 16);
+  if ((XF86RushLockPixmap(dpy, screenNum, pixAux,
+			  &addrAux)==FXFALSE) || !addrAux) {
+    doReleasePixmaps();
+    return ErrorMessage(hWndApp, "Failed to lock aux pixmap\n");
+  }
+  if (tripleBuffering) {
+    pixTriple=XCreatePixmap(dpy, hWndApp, xRes, yRes, 16);
+    if ((XF86RushLockPixmap(dpy, screenNum, pixTriple,
+			    &addrTriple)==FXFALSE) || !addrTriple) {
+      doReleasePixmaps();
+      return ErrorMessage(hWndApp, "Failed to lock triple pixmap\n");
+    }
+  }
+  cvtXToGlideDesc(pDesc);
+  return FXTRUE;
+}
+
+static FxBool 
+getWindowSize(int *width, int *height) {
+    XWindowAttributes attr;
+
+    /* Find out how big the window is */
+    if (!XGetWindowAttributes(dpy, hWndApp, &attr))
+      return ErrorMessage(hWndApp, "Failed to get window attributes\n");
+
+    *width=attr.width;
+    *height=attr.height;
+    return FXTRUE;
+}
+
+FxBool
+linOpen(
+    FxU32                hWindow,
+    GrScreenResolution_t sRes,
+    GrScreenRefresh_t    vRefresh,
+    InitColorFormat_t    cFormat,
+    InitOriginLocation_t yOrigin,
+    int                  nColBuffers,
+    int                  nAuxBuffers,
+    InitBufDesc_t        *pBufDesc,         // return values
+    int                  *width,
+    int                  *height,
+    InitSwapType_t       *swapType
+)
+{
+  int i, flags, numModes;
+  XWindowAttributes attr;
+
+  GDBG_INFO((80, "linOpen: hWnd = %x, sRes=%d, yOrg=%d, ncb=%d, nab=%d\n",
+             hWindow, sRes, yOrigin, nColBuffers, nAuxBuffers));
+
+  if (!linSetup()) return FXFALSE;
+  atexit(linClose);
+
+  if (sRes == GR_RESOLUTION_NONE ) { /* In a window */
+
+    /*
+     * Get ourselves a valid window handle 
+     */
+    hWndApp = (Window)hWindow;
+    if (hWndApp == 0)
+      return ErrorMessage(hWndApp, "Linux VRush needs a valid window id!\n");
+    xgc=XCreateGC(dpy, hWndApp, 0, 0);
+    XSetFunction(dpy, xgc, GXcopy);
+    XSetPlaneMask(dpy, xgc, AllPlanes);
+
+    if (!XGetWindowAttributes(dpy, hWndApp, &attr))
+      return ErrorMessage(hWndApp, "Failed to get window attributes\n");
+    if (attr.depth!=16)
+      return ErrorMessage(hWndApp, "Screen depth must be 16\n");
+    screenNum=XScreenNumberOfScreen(attr.screen);
+    Width=attr.width;
+    Height=attr.height;
+    IsFullScreen = FXFALSE;
+  } else {
+    /* Full screen mode - convert resolution to Width, Height */
+    static int _w[] = {320,320,400,512,640,640,640,640,800,960,856,512};
+    static int _h[] = {200,240,256,384,200,350,400,480,600,720,480,256};
+
+    if ((sRes <  GR_RESOLUTION_320x200) ||
+        (sRes >  GR_RESOLUTION_512x256)) 
+      return ErrorMessage(hWndApp, "Bad Fullscreen resolution");
+
+    tripleBuffering = (nColBuffers == 3);
+
+    IsFullScreen = FXTRUE;
+    Width   = _w[sRes];
+    Height  = _h[sRes];
+
+    hWndApp=DefaultRootWindow(dpy);
+    if (!XGetWindowAttributes(dpy, hWndApp, &attr))
+      return ErrorMessage(hWndApp, "Failed to get window attributes\n");
+    if (attr.depth!=16)
+      return ErrorMessage(hWndApp, "Screen depth must be 16\n");
+    if (XF86DGAQueryDirectVideo(dpy, DefaultScreen(dpy), &flags)==False ||
+	!flags) {
+      GDBG_INFO((0, "Could query Direct Video"));
+      return ErrorMessage(hWndApp, "Direct video not supported\n");
+    }
+    if (XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numModes,
+				   &vidModes)==False) {
+      return ErrorMessage(hWndApp, "Couldn't query vidmode list\n");
+      return 1;
+    }
+    for (i=0; i<numModes; i++)
+      if ((vidModes[i]->hdisplay==Width) && (vidModes[i]->vdisplay==Height))
+	break;
+    if (i==numModes) {
+      return ErrorMessage(hWndApp, "Server doesn't support requested resolution\n");
+      if (vidModes) {
+	XFree(vidModes);
+	vidModes=0;
+      }
+      return 1;
+    }
+    if (XF86VidModeSwitchToMode(dpy, DefaultScreen(dpy), vidModes[i])==False) {
+      return ErrorMessage(hWndApp, "Failed to set required video mode\n");
+      return 1;
+    }
+  }
+
+  GDBG_INFO((80, "linOpen: W=%d, H=%d, FullScr=%d, vRefresh=%d\n",
+             Width, Height, IsFullScreen, vRefresh));
+
+  if (!doAllocPixmaps(Width, Height, vRefresh, BufDesc)) {
+    doReleasePixmaps();
+    return ErrorMessage(hWndApp, "failed linOpen");
+  }
+  GDBG_INFO((80, "doAllocPixmaps OK!\n"));
+  for (i=0; i< NUM_BUFS; i++) {
+    pBufDesc[i] = BufDesc[i];
+    GDBG_INFO((80, "linOpen: pBufDesc[%d]: \n", i));
+    GDBG_INFO((80, "\tbufMagic = 0x%x\n", pBufDesc[i].bufMagic));
+    GDBG_INFO((80, "\tbufType = 0x%x\n", pBufDesc[i].bufType));
+    GDBG_INFO((80, "\tbufOffset = 0x%x\n", pBufDesc[i].bufOffset));
+    GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride));    
+    GDBG_INFO((80, "\tbufBPP = 0x%x\n", pBufDesc[i].bufBPP));
+  }
+
+  *width = Width;
+  *height = Height;
+  *swapType = (IsFullScreen) ? INIT_SWAP_FLIP : INIT_SWAP_BLT;
+
+  if (IsFullScreen) {
+    if (XF86DGADirectVideo(dpy, DefaultScreen(dpy), XF86DGADirectGraphics)==False) {
+      GDBG_INFO((0, "Couldn't set direct graphics mode"));
+      return ErrorMessage(hWndApp, "Couldn't enable direct video\n");
+    }
+    if (XF86DGASetViewPort(dpy, DefaultScreen(dpy), 0, 0)==False) {
+      GDBG_INFO((0, "Failed to set viewport\n"));
+    }
+    XSync(dpy, False);
+    GDBG_INFO((80, "Fullscreen mode switched\n"));
+  }
+
+  if ( curHALData->initSetVideo ) {
+    curHALData->initSetVideo( sRes, vRefresh, 
+                             (FxU32*)width, (FxU32*)height );
+  }
+
+  GDBG_INFO((80, "linOpen:  Returning TRUE\n"));
+  return FXTRUE;
+
+} /* linOpen */
+
+FxBool
+linControl(FxU32 code, InitBufDesc_t *pBufDesc, int *width, int *height)
+{
+  int     i, w, h;
+  
+  GDBG_INFO((80, "linControl: code = %d\n", code));
+
+  if (IsFullScreen) return FXTRUE;
+  /* Why was I called? */
+  switch(code) {
+  case INIT_CONTROL_RESIZE:     /* recreate surfaces */
+    getWindowSize(&w, &h);
+    if ((Width != w) || (Height != h)) {
+      GDBG_INFO((120, "W and H changed to %d %d\n", 
+                 Width, Height)); 
+
+      if (!doAllocPixmaps(w, h, 0, BufDesc)) {
+	w=Width;
+	h=Height;
+	if (!doAllocPixmaps(w, h, 0, BufDesc)) {
+	  /* ErrorMessage(hWndApp, "linControl: Resize failed\n"); */
+	  return FXFALSE;
+	}
+      }
+      Width = w;
+      Height = h;
+    }
+    break;
+
+  case INIT_CONTROL_MOVE:
+    findWindow(dpy, hWndApp, &addrFront);
+    cvtAddrToBufDesc(addrFront, &BufDesc[0]);
+    GDBG_INFO((120, "linControl: Move\n"));
+    break;
+
+  case INIT_CONTROL_ACTIVATE:
+    GDBG_INFO((120, "linControl: Activate\n"));
+    break;
+
+  case INIT_CONTROL_DEACTIVATE:
+    GDBG_INFO((120, "linControl: DeActivate\n"));
+    break;
+
+  default:
+    GDBG_INFO((120, "linControl: Strange control %d\n", code));
+    return FXFALSE;
+    break;
+  }
+  for (i=0; i<5; i++) pBufDesc[i] = BufDesc[i];
+  *width = Width;
+  *height = Height;
+  GDBG_INFO((80, "linControl: code = %d, w = %d, h = %d\n", code,
+             Width, Height));
+  
+  return FXTRUE;
+} /* linControl */
+
+FxBool
+linClose()
+{
+  GDBG_INFO((80, "linClose:\n"));
+  if (!dpy) return FXTRUE;
+  if (IsFullScreen) {
+    if (XF86VidModeSwitchToMode(dpy, DefaultScreen(dpy), vidModes[0])==False) {
+      GDBG_INFO((80, "Failed to return to previous video mode\n"));
+    }
+    XF86DGADirectVideo(dpy, DefaultScreen(dpy), 0);
+    if (vidModes) {
+      XFree(vidModes);
+      vidModes=0;
+    }
+  }
+  doReleasePixmaps();
+  if (xgc) XFreeGC(dpy, xgc);
+  xgc=0;
+  dpy=0;
+  GDBG_INFO((80, "linClose:  Returning TRUE\n"));
+  return FXTRUE;
+} /* linClose */
+
+void
+linSwap(FxU32 code)
+{
+  if (IsFullScreen) return;
+  XCopyArea(dpy, pixBack, hWndApp, xgc, 0, 0, Width, Height, 0, 0);
+  XSync(dpy, False);
+}  /* linSwap */
+
+void
+linFlip(FxU32 buffer)
+{
+  int x, y;
+
+  y=buffer/(2*screenWidth);
+  x=(buffer-y*2*screenWidth)/2;
+  if (XF86DGASetViewPort(dpy, DefaultScreen(dpy), x, y)==False) {
+    GDBG_INFO((0, "Failed to set viewport\n"));
+  }
+  /*
+    We really are supposed to wait for the port changed call in a while
+    loop I guess, but at the moment, this is a no-op in the
+    server. Since this requires and extra round-trip to the X server it
+    really eats into performance. I'd argue DGA is broken. Setting the
+    viewport should enforce the switch before returning to avoid this.
+    */
+#if 0
+  if (XF86DGAViewPortChanged(dpy, DefaultScreen(dpy), 2)==False) {
+    GDBG_INFO((0, "Failed to wait for viewport change\n"));
+  }
+#endif
+} /* linFlip */
+
+#endif
+
+
Index: trunk/src/opengl/glide/sst1/init/init96/makefile.unix
===================================================================
--- trunk/src/opengl/glide/sst1/init/init96/makefile.unix	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init96/makefile.unix	(revision 2885)
@@ -0,0 +1,56 @@
+#
+# THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+# PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+# TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+# INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+# DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+# THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+# EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+# FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+# 
+# USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+# RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+# TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+# AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+# SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+# THE UNITED STATES.  
+# 
+# COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+#
+# $Revision: 1.1 $
+# $Date: 2000-02-25 00:31:32 $
+#
+
+# local defines, options, includes
+
+LCDEFS		= -DSST96
+ifeq ($(FX_SST96_ALT_FIFO),1)
+LCDEFS		+= -DSST96_ALT_FIFO_WRAP
+endif
+
+PARTNERCFILES   =       initmcrx.c
+#init8625.c
+
+ifeq ($(DEBUG),1)
+DBGOPTS         =       -DGDBG_INFO_ON
+endif
+
+ifneq ($(FX_GLIDE_HW),SST96)
+LCDEFS		+=	-DDUMMY
+endif
+
+LCOPTS   += $(DBGOPTS) \
+           -I$(BUILD_ROOT_SWLIBS)/include \
+           -I$(BUILD_ROOT_SST1)/include
+
+# sources
+HEADERS             = init96.h initvga.h
+PRIVATE_HEADERS     = atvga.h fxinit96.h initat3d.h initmcrx.h
+INSTALL_DESTINATION = $(BUILD_ROOT_SST1)
+CFILES              = $(PARTNERCFILES) init96.c lindrvr.c
+
+# targets
+LIBRARIES      = libinit96.a
+
+include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak
+
Index: trunk/src/opengl/glide/sst1/init/init96/readme.txt
===================================================================
--- trunk/src/opengl/glide/sst1/init/init96/readme.txt	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/init96/readme.txt	(revision 2885)
@@ -0,0 +1,37 @@
+Different Build Environments For VG96:
+
+Lab:
+FX_GLIDE_HW=SST96
+FX_GLIDE_CTRISETUP=1
+FX_GLIDE_NO_SPLASH=1
+INIT_ACCESS_DDRAW=
+
+
+Direct Draw Window:
+FX_GLIDE_HW=SST96
+FX_GLIDE_CTRISETUP=1
+FX_GLIDE_NO_SPLASH=1
+INIT_ACCESS_DDRAW=1
+SST_VG_MODE=WIN
+*demos* ARCADE_RES_OVERRIDE=1
+
+Direct Draw Fullscreen:
+FX_GLIDE_HW=SST96
+FX_GLIDE_CTRISETUP=1
+FX_GLIDE_NO_SPLASH=1
+INIT_ACCESS_DDRAW=1
+SST_VG_MODE=
+*demos* ARCADE_RES_OVERRIDE=
+
+This mode sucks because you can't get any input to your application
+and it is slow because you have to do sucky synchronized swapping.
+
+
+DOS Fullscreen:
+FX_GLIDE_HW=SST96
+FX_GLIDE_CTRISETUP=1
+FX_GLIDE_NO_SPLASH=1
+*demos* ARCADE_RES_OVERRIDE=
+INIT_ACCESS_DDRAW=
+SST_VG_MODE=
+
Index: trunk/src/opengl/glide/sst1/init/initvg/.depend
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/.depend	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/.depend	(revision 2885)
@@ -0,0 +1,289 @@
+dac.obj: \
+       dac.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       ..\..\incsrc\sst.h \
+       ..\..\..\swlibs\fxmisc\fxdll.h \
+       ..\..\init\sst1vid.h \
+       .\sst1init.h
+gamma.obj: \
+       gamma.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       ..\..\incsrc\sst.h \
+       ..\..\..\swlibs\fxmisc\fxdll.h \
+       ..\..\init\sst1vid.h \
+       .\sst1init.h
+gdebug.obj: \
+       gdebug.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\stdarg.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\..\..\..\..\..\include\win\windows.h \
+       ..\..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\..\swlibs\fxmisc\fxdll.h \
+       .\gdebug.h
+info.obj: \
+       info.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       ..\..\incsrc\sst.h \
+       ..\..\..\swlibs\fxmisc\fxdll.h \
+       ..\..\init\sst1vid.h \
+       .\sst1init.h
+parse.obj: \
+       parse.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\ctype.h \
+       k:\ibmcpp\INCLUDE\malloc.h \
+       ..\..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\..\swlibs\fxmisc\fxdll.h \
+       ..\..\init\sst1vid.h \
+       .\sst1init.h \
+       ..\..\..\..\..\..\include\win\windows.h \
+       ..\..\init\init.h
+print.obj: \
+       print.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\stdarg.h \
+       ..\..\incsrc\sst.h \
+       ..\..\init\sst1vid.h \
+       ..\..\..\swlibs\fxmisc\fxdll.h \
+       .\sst1init.h
+sli.obj: \
+       sli.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       ..\..\incsrc\sst.h \
+       ..\..\..\swlibs\fxmisc\fxdll.h \
+       ..\..\init\sst1vid.h \
+       .\sst1init.h
+sst1init.obj: \
+       sst1init.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       ..\..\incsrc\sst.h \
+       ..\..\..\swlibs\fxmisc\fxdll.h \
+       ..\..\..\swlibs\pcilib\fxpci.h \
+       ..\..\init\sst1vid.h \
+       .\sst1init.h \
+       ..\..\glide\rcver.h \
+       ..\..\..\..\..\..\include\win\windows.h \
+       k:\toolkit\H\os2.h
+util.obj: \
+       util.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       ..\..\incsrc\sst.h \
+       ..\..\..\swlibs\fxmisc\fxdll.h \
+       ..\..\init\sst1vid.h \
+       .\sst1init.h
+video.obj: \
+       video.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       ..\..\incsrc\sst.h \
+       ..\..\..\swlibs\fxmisc\fxdll.h \
+       ..\..\init\sst1vid.h \
+       .\sst1init.h
+gdebug.h: \
+       k:\ibmcpp\INCLUDE\stdarg.h \
+       ..\..\..\swlibs\fxmisc\3dfx.h
+rcver.h:
+sst1init.h: \
+       ..\..\init\sst1vid.h \
+       ..\..\..\swlibs\pcilib\fxpci.h \
+       k:\ibmcpp\INCLUDE\stdio.h
+..\..\..\..\..\..\include\codepage.h: \
+       k:\toolkit\H\uconv.h
+..\..\..\..\..\..\include\comtype.h:
+..\..\..\..\..\..\include\cpuhlp.h:
+..\..\..\..\..\..\include\dcdata.h:
+..\..\..\..\..\..\include\exceptions.h: \
+       ..\..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\..\include\misc.h
+..\..\..\..\..\..\include\excpt.h:
+..\..\..\..\..\..\include\exitlist.h:
+..\..\..\..\..\..\include\HandleManager.h: \
+       ..\..\..\..\..\..\include\winos2def.h
+..\..\..\..\..\..\include\heap.h: \
+       ..\..\..\..\..\..\include\win\winbase.h
+..\..\..\..\..\..\include\heapcode.h: \
+       ..\..\..\..\..\..\include\heapshared.h
+..\..\..\..\..\..\include\heapshared.h: \
+       k:\ibmcpp\INCLUDE\stddef.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\umalloc.h
+..\..\..\..\..\..\include\heapstring.h: \
+       ..\..\..\..\..\..\include\odin.h
+..\..\..\..\..\..\include\midimapr.h:
+..\..\..\..\..\..\include\misc.h: \
+       ..\..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\..\include\versionos2.h \
+       ..\..\..\..\..\..\include\unicode.h
+..\..\..\..\..\..\include\nameid.h:
+..\..\..\..\..\..\include\odin.h: \
+       k:\ibmcpp\INCLUDE\builtin.h
+..\..\..\..\..\..\include\odinlx.h:
+..\..\..\..\..\..\include\odinrsrc.h:
+..\..\..\..\..\..\include\odinwrap.h: \
+       ..\..\..\..\..\..\include\os2sel.h \
+       k:\ibmcpp\INCLUDE\malloc.h
+..\..\..\..\..\..\include\os2mewrap.h: \
+       k:\toolkit\H\os2me.h
+..\..\..\..\..\..\include\os2newapi.h:
+..\..\..\..\..\..\include\os2sel.h:
+..\..\..\..\..\..\include\OS2WIN.H: \
+       ..\..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\..\include\odin.h \
+       ..\..\..\..\..\..\include\win\windef.h \
+       ..\..\..\..\..\..\include\win\winbase.h \
+       ..\..\..\..\..\..\include\win\wingdi.h \
+       ..\..\..\..\..\..\include\win\winuser.h \
+       ..\..\..\..\..\..\include\win\winerror.h \
+       ..\..\..\..\..\..\include\win\commdlg.h \
+       ..\..\..\..\..\..\include\win\ddeml.h \
+       ..\..\..\..\..\..\include\win\mmsystem.h \
+       ..\..\..\..\..\..\include\os2sel.h \
+       ..\..\..\..\..\..\include\misc.h
+..\..\..\..\..\..\include\os2wrap.h: \
+       k:\toolkit\H\os2.h \
+       ..\..\..\..\..\..\include\os2sel.h \
+       ..\..\..\..\..\..\include\os2newapi.h
+..\..\..\..\..\..\include\pefile.h: \
+       k:\toolkit\H\os2.h \
+       ..\..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\..\include\win\peexe.h \
+       k:\ibmcpp\INCLUDE\stdlib.h
+..\..\..\..\..\..\include\pmmenu.h:
+..\..\..\..\..\..\include\spy.h:
+..\..\..\..\..\..\include\unicode.h: \
+       ..\..\..\..\..\..\include\uniconv.h
+..\..\..\..\..\..\include\uniconv.h: \
+       k:\ibmcpp\INCLUDE\stddef.h \
+       k:\ibmcpp\INCLUDE\time.h
+..\..\..\..\..\..\include\versionos2.h:
+..\..\..\..\..\..\include\virtual.h:
+..\..\..\..\..\..\include\vmutex.h:
+..\..\..\..\..\..\include\win32type.h: \
+       ..\..\..\..\..\..\include\odin.h
+..\..\..\..\..\..\include\win32util.h:
+..\..\..\..\..\..\include\win32wnd.h:
+..\..\..\..\..\..\include\winaccel.h:
+..\..\..\..\..\..\include\winconst.h:
+..\..\..\..\..\..\include\wincursor.h:
+..\..\..\..\..\..\include\windllbase.h: \
+       ..\..\..\..\..\..\include\winimagebase.h \
+       ..\..\..\..\..\..\include\odinlx.h
+..\..\..\..\..\..\include\windlllx.h: \
+       ..\..\..\..\..\..\include\windllbase.h \
+       ..\..\..\..\..\..\include\winimagelx.h
+..\..\..\..\..\..\include\windllpe2lx.h: \
+       ..\..\..\..\..\..\include\windllbase.h \
+       ..\..\..\..\..\..\include\winimagepe2lx.h
+..\..\..\..\..\..\include\windllpeldr.h: \
+       ..\..\..\..\..\..\include\windllbase.h \
+       ..\..\..\..\..\..\include\winimagepeldr.h
+..\..\..\..\..\..\include\wineuni.h:
+..\..\..\..\..\..\include\winexebase.h: \
+       ..\..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\..\include\winexelx.h: \
+       ..\..\..\..\..\..\include\winexebase.h \
+       ..\..\..\..\..\..\include\winimagelx.h \
+       ..\..\..\..\..\..\include\odinlx.h
+..\..\..\..\..\..\include\winexepe2lx.h: \
+       ..\..\..\..\..\..\include\winexebase.h \
+       ..\..\..\..\..\..\include\winimagepe2lx.h
+..\..\..\..\..\..\include\winexepeldr.h: \
+       ..\..\..\..\..\..\include\winexebase.h \
+       ..\..\..\..\..\..\include\winimagepeldr.h
+..\..\..\..\..\..\include\winfakepeldr.h: \
+       ..\..\..\..\..\..\include\winimagepeldr.h
+..\..\..\..\..\..\include\winicon.h:
+..\..\..\..\..\..\include\winimagebase.h: \
+       ..\..\..\..\..\..\include\win\peexe.h
+..\..\..\..\..\..\include\winimagelx.h: \
+       ..\..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\..\include\winimagepe2lx.h: \
+       ..\..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\..\include\winimagepeldr.h: \
+       ..\..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\..\include\winkeyboard.h:
+..\..\..\..\..\..\include\winmenu.h:
+..\..\..\..\..\..\include\winos2def.h:
+..\..\..\..\..\..\include\winres.h:
+..\..\..\..\..\..\include\wprocess.h: \
+       ..\..\..\..\..\..\include\win\winprocess.h \
+       ..\..\..\..\..\..\include\winconst.h \
+       ..\..\..\..\..\..\include\win\thread.h
+..\..\incsrc\ncc.h:
+..\..\incsrc\sst.h: \
+       ..\..\incsrc\ncc.h \
+       ..\..\..\swlibs\fxmisc\fx64.h
+..\..\..\swlibs\fxmisc\3dfx.h:
+..\..\..\swlibs\fxmisc\fx64.h: \
+       ..\..\..\swlibs\fxmisc\3dfx.h
+..\..\..\swlibs\fxmisc\fxdll.h:
+..\..\..\swlibs\fxmisc\fxglob.h:
+..\..\..\swlibs\fxmisc\fximg.h:
+..\..\..\swlibs\fxmisc\fxmemmap.h:
+..\..\..\swlibs\fxmisc\fxos.h: \
+       k:\ibmcpp\INCLUDE\stdio.h
+..\..\..\swlibs\fxmisc\fxver.h:
+..\..\..\swlibs\fxmisc\linutil.h:
+..\..\..\swlibs\fxmisc\tsc.h:
+..\fxinit.h: \
+       ..\..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\init\init.h \
+       ..\..\..\swlibs\fxmisc\fxdll.h
+..\init.h: \
+       ..\..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\init\sst1vid.h \
+       .\sst1init.h
+..\sst1vid.h:
+..\..\glide\fxglide.h: \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       ..\..\..\swlibs\fxmisc\3dfx.h \
+       .\sst1init.h \
+       ..\..\incsrc\sst.h \
+       .\gdebug.h \
+       ..\..\init\init.h \
+       k:\ibmcpp\INCLUDE\assert.h
+..\..\glide\fxinline.h:
+..\..\glide\glide.h: \
+       ..\..\..\swlibs\fxmisc\3dfx.h \
+       ..\..\glide\glidesys.h \
+       ..\..\init\sst1vid.h \
+       ..\..\glide\glideutl.h
+..\..\glide\glidesys.h:
+..\..\glide\glideutl.h:
+..\..\glide\gsstdef.h: \
+       ..\..\incsrc\sst.h
+..\..\glide\gump.h:
+..\..\glide\rcver.h:
+..\..\texus\texus.h: \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\stdio.h
+..\..\texus\texusint.h: \
+       ..\..\texus\texus.h
+..\..\..\swlibs\pcilib\fxlinux.h:
+..\..\..\swlibs\pcilib\fxos2.h:
+..\..\..\swlibs\pcilib\fxpci.h:
+..\..\..\swlibs\pcilib\fxphrlap.h:
+..\..\..\swlibs\pcilib\fxw32.h: \
+       ..\..\..\..\..\..\include\win\windows.h \
+       ..\..\..\swlibs\pcilib\pcilib.h
+..\..\..\swlibs\pcilib\pcilib.h:
+..\..\..\swlibs\pcilib\sst1_pci.h: \
+       ..\..\..\swlibs\pcilib\fxpci.h
Index: trunk/src/opengl/glide/sst1/init/initvg/dac.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/dac.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/dac.c	(revision 2885)
@@ -0,0 +1,1211 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:32 $ 
+**
+** Initialization code for initializing supported SST-1 DACs
+**
+*/
+#pragma optimize ("",off)
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <sst.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <sst1vid.h>
+#include <sst1init.h>
+
+/*
+** sst1InitDacRd():
+**  Read external DAC registers
+**  NOTE: The video unit of FBI must be in reset before calling this routine.
+**        The rendering engines of FBI and TREX must be idle before calling 
+**        this routine.
+**        fbiInit23 register remapping (PCI config. initEnable[2]=1) must be
+**        enabled before calling this routine
+**
+**  Valid addresses are 0 <= addr <= 3
+**
+*/
+FX_EXPORT FxU32 FX_CSTYLE sst1InitDacRd(FxU32 *sstbase, FxU32 addr)
+{
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+    FxU32 retVal;
+    static FxBool firstPass = FXTRUE;
+    static int helper;
+
+    if(firstPass == FXTRUE) {
+        firstPass = FXFALSE;
+        helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+    }
+
+    ISET(sst->dacData, ((addr) << SST_DACDATA_ADDR_SHIFT) | SST_DACDATA_RD);
+    sst1InitIdleFBINoNOP(sstbase);
+    retVal = IGET(sst->fbiInit2) & SST_DACDATA_DATA;
+    if(helper)
+        INIT_PRINTF(("dacRd(0x%x,0x%x)\n", addr, retVal));
+
+    return(retVal);
+}
+
+/*
+** sst1InitDacWr():
+**  Write to external DAC registers
+**  NOTE: The video unit of FBI must be in reset before calling this routine.
+**        The rendering engines of FBI and TREX must be idle before calling 
+**        this routine.
+**
+**  Valid addresses are 0 <= addr <= 3
+**
+*/
+FX_EXPORT void FX_CSTYLE sst1InitDacWr(FxU32 *sstbase, FxU32 addr, FxU32 data)
+{
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+    static FxBool firstPass = FXTRUE;
+    static int helper;
+
+    if(firstPass == FXTRUE) {
+        firstPass = FXFALSE;
+        helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+    }
+
+    ISET(sst->dacData,
+        (data & SST_DACDATA_DATA) |
+        ((addr) << SST_DACDATA_ADDR_SHIFT) |
+        SST_DACDATA_WR);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    if(helper)
+        INIT_PRINTF(("dacWr(0x%x,0x%x)\n", addr, data));
+}
+
+/*
+** sst1InitExecuteDacRdWr():
+**  Execute DAC read/write command sequence defined in "voodoo.ini" file
+**
+*/
+FxBool sst1InitExecuteDacRdWr(FxU32 *sstbase, sst1InitDacRdWrStruct
+  *dacRdWrBase)
+{
+    sst1InitDacRdWrStruct *dacRdWrPtr = dacRdWrBase;
+    FxU32 data;
+    FxBool retVal = FXTRUE;
+    int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+
+    while(dacRdWrPtr) {
+        if(dacRdWrPtr->type == DACRDWR_TYPE_WR) {
+            sst1InitDacWr(sstbase, dacRdWrPtr->addr, dacRdWrPtr->data);
+        } else if(dacRdWrPtr->type == DACRDWR_TYPE_RDMODWR) {
+            data = sst1InitDacRd(sstbase, dacRdWrPtr->addr);
+            if(helper)
+                INIT_PRINTF(("dacRdWr(Read=0x%x)\n", data));
+            data &= dacRdWrPtr->mask;
+            sst1InitDacWr(sstbase, dacRdWrPtr->addr, (data | dacRdWrPtr->data));
+        } else if(dacRdWrPtr->type == DACRDWR_TYPE_WRMOD_POP) {
+            data = iniStack[--iniStackPtr];
+            if(iniStackPtr < 0) {
+                retVal = FXFALSE;
+                break;
+            }
+            if(helper)
+                INIT_PRINTF(("dacWrModPop(Stack=0x%x,Mask=0x%x)\n", data,
+                    dacRdWrPtr->mask));
+            data &= dacRdWrPtr->mask;
+            sst1InitDacWr(sstbase, dacRdWrPtr->addr, (data | dacRdWrPtr->data));
+        } else if(dacRdWrPtr->type == DACRDWR_TYPE_RDNOCHECK) {
+            sst1InitDacRd(sstbase, dacRdWrPtr->addr);
+        } else if(dacRdWrPtr->type == DACRDWR_TYPE_RDPUSH) {
+            data = sst1InitDacRd(sstbase, dacRdWrPtr->addr);
+            iniStack[iniStackPtr++] = data;
+            if(iniStackPtr == DACRDWR_MAX_PUSH) {
+                retVal = FXFALSE;
+                break;
+            }
+        } else if(dacRdWrPtr->type == DACRDWR_TYPE_RDCHECK) {
+            if(sst1InitDacRd(sstbase, dacRdWrPtr->addr) != dacRdWrPtr->data) {
+                retVal = FXFALSE;
+                break;
+            }
+        } else {
+            retVal = FXFALSE;
+            break;
+        }
+        dacRdWrPtr = (sst1InitDacRdWrStruct *)dacRdWrPtr->nextRdWr;
+    }
+    return(retVal);
+}
+
+/*
+** sst1InitDacDetect():
+**  Detect type of on-board DAC
+**  NOTE: sst1InitDacDetect() resets the PCI fifo and the graphics subsystem
+**   of FBI
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitDacDetect(FxU32 * sstbase)
+{
+    FxU32 n;
+    FxU32 fbiInit1_save;
+    FxU32 fbiInit2_save;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+    FxBool retVal = FXFALSE;
+    int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+
+    if(!sst)
+        return(FXFALSE);
+
+    if(helper)
+        INIT_PRINTF(("sst1InitDacDetect(): Entered...\n"));
+
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Save init register states before overwriting them */
+    fbiInit1_save = IGET(sst->fbiInit1);
+    fbiInit2_save = IGET(sst->fbiInit2);
+
+    /* Reset video unit to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+    /* Turn off dram refresh to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit2, IGET(sst->fbiInit2) & ~SST_EN_DRAM_REFRESH);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Enable reads from the DAC (multiplexed on the fbiInit2 address) */
+    /* Disallow writes to pass through the PCI FIFO */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_FBIINIT23_REMAP);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    if(sst1InitUseVoodooFile == FXTRUE) {
+        retVal = sst1InitDacDetectINI(sstbase);
+    } else {
+        if((retVal = sst1InitDacDetectICS(sstbase)) == FXTRUE)
+            goto done;
+        if((retVal = sst1InitDacDetectATT(sstbase)) == FXTRUE)
+            goto done;
+        retVal = sst1InitDacDetectTI(sstbase);
+    }
+
+done:
+    /* Disable fbiinit23 address remapping */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_PCI_FIFOWR_EN);
+
+    /* Restore init register states */
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit1, fbiInit1_save);
+    ISET(sst->fbiInit2, fbiInit2_save);
+    sst1InitIdleFBINoNOP(sstbase);
+    return(retVal);
+}
+
+/*
+** sst1InitDacDetectINI():
+**  Detect DAC based on rules supplied in "voodoo.ini"
+**
+*/
+FxBool sst1InitDacDetectINI(FxU32 * sstbase)
+{
+    sst1InitDacStruct *dacPtr;
+    FxU32 j;
+    FxBool retVal = FXFALSE;
+
+    dacPtr = dacStructBase;
+    while(dacPtr) {
+        if(dacPtr->detect) {
+            /* Loop multiple times, as some DACs go into never-never land... */
+            for(j=0; j<100; j++) {
+                if((retVal = sst1InitExecuteDacRdWr(sstbase, dacPtr->detect))
+                  == FXTRUE) {
+                    iniDac = dacPtr;
+                    break;
+                }
+            }
+            if(retVal == FXTRUE)
+                break;
+        }
+        dacPtr = (sst1InitDacStruct *)dacPtr->nextDac;
+    }
+    return(retVal);
+}
+
+FxBool sst1InitDacDetectATT(FxU32 * sstbase)
+{
+    FxU32 n, j, dacmir, dacdir;
+    int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+
+    if(helper)
+        INIT_PRINTF(("sst1InitDacDetectATT(): Entered...\n"));
+
+    /* Detect ATT */
+    /* Sometimes the DACs seem to go into never-never land, so */
+    /* try and initialize the DAC multiple times */
+    n = 0;
+    while(1) {
+        if(++n > 100)
+            break;
+
+        /* Must guarantee that no rendering is being performed */
+        sst1InitIdleFBINoNOP(sstbase);
+
+        /* Reset current state of DAC command register 0 (CR0) via the read */
+        /* mask register (RMR) */
+        sst1InitDacWr(sstbase, SST_DACREG_WMA, 0x0); /* reset backdoor fsm */
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);      /* RMR must be read 5 times */
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);      /* Returns contents of CR0 */
+
+        /* Enable indexed programming by setting CR0[0] = 1 */
+        sst1InitDacWr(sstbase, SST_DACREG_WMA, 0x0); /* reset backdoor fsm */
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);      /* RMR must be read 4 times */
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacWr(sstbase, SST_DACREG_RMR,
+            SST_DACREG_CR0_INDEXED_ADDRESSING | SST_DACREG_CR0_8BITDAC);
+
+        /* NOW DAC IS IN INDEXED ADDRESS MODE... */
+
+        /* Check the manufacturing ID */
+        j = 0;
+        DAC_INDEXWRADDR(SST_DACREG_INDEX_MIR);
+        dacmir = DAC_INDEXRD();
+        if(dacmir == SST_DACREG_INDEX_MIR_ATT_DEFAULT)
+            j++;
+        else
+            continue;
+
+        /* Check the device ID */
+        DAC_INDEXWRADDR(SST_DACREG_INDEX_DIR);
+        dacdir = DAC_INDEXRD();
+        if(dacmir == SST_DACREG_INDEX_MIR_ATT_DEFAULT &&
+           dacdir == SST_DACREG_INDEX_DIR_ATT_DEFAULT)
+            j++;
+        else
+            continue;
+        if(j == 2) {
+            /* Found ATT DAC... */
+            sst1CurrentBoard->fbiDacType = SST_FBI_DACTYPE_ATT;
+            sst1InitIdleFBINoNOP(sstbase);
+            /* Disable indexed-mode addressing */
+            sst1InitDacWr(sstbase, SST_DACREG_INDEXADDR, SST_DACREG_INDEX_CR0);
+            sst1InitDacWr(sstbase, SST_DACREG_INDEXDATA,
+                sst1InitDacRd(sstbase, SST_DACREG_INDEXDATA) &
+                ~SST_DACREG_CR0_INDEXED_ADDRESSING);
+           if(helper)
+               INIT_PRINTF(("sst1InitDacDetectATT(): Exiting...\n"));
+            return(FXTRUE);
+        }
+    }
+    if(helper)
+        INIT_PRINTF(("sst1InitDacDetectATT(): Exiting...\n"));
+    return(FXFALSE);
+}
+
+FxBool sst1InitDacDetectTI(FxU32 * sstbase)
+{
+    FxU32 n, j, dacmir, dacdir;
+    int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+
+    if(helper)
+        INIT_PRINTF(("sst1InitDacDetectTI(): Entered...\n"));
+
+    /* Detect TI */
+    /* Sometimes the DACs seem to go into never-never land, so */
+    /* try and initialize the DAC multiple times */
+    n = 0;
+    while(1) {
+        if(++n > 100)
+            break;
+
+        /* Must guarantee that no rendering is being performed */
+        sst1InitIdleFBINoNOP(sstbase);
+
+        /* Reset current state of DAC command register 0 (CR0) via the read */
+        /* mask register (RMR) */
+        sst1InitDacWr(sstbase, SST_DACREG_WMA, 0x0); /* reset backdoor fsm */
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);      /* RMR must be read 5 times */
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);      /* Returns contents of CR0 */
+
+        /* Enable indexed programming by setting CR0[0] = 1 */
+        sst1InitDacWr(sstbase, SST_DACREG_WMA, 0x0); /* reset backdoor fsm */
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);      /* RMR must be read 4 times */
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacWr(sstbase, SST_DACREG_RMR,
+            SST_DACREG_CR0_INDEXED_ADDRESSING | SST_DACREG_CR0_8BITDAC);
+
+        /* NOW DAC IS IN INDEXED ADDRESS MODE... */
+
+        /* Check the manufacturing ID */
+        j = 0;
+        DAC_INDEXWRADDR(SST_DACREG_INDEX_MIR);
+        dacmir = DAC_INDEXRD();
+        if(dacmir == SST_DACREG_INDEX_MIR_TI_DEFAULT)
+            j++;
+        else
+            continue;
+
+        /* Check the device ID */
+        DAC_INDEXWRADDR(SST_DACREG_INDEX_DIR);
+        dacdir = DAC_INDEXRD();
+        if(dacmir == SST_DACREG_INDEX_MIR_TI_DEFAULT &&
+           dacdir == SST_DACREG_INDEX_DIR_TI_DEFAULT)
+            j++;
+        else
+            continue;
+        if(j == 2) {
+            /* Found TI DAC... */
+            sst1CurrentBoard->fbiDacType = SST_FBI_DACTYPE_TI;
+            sst1InitIdleFBINoNOP(sstbase);
+            /* Disable indexed-mode addressing */
+            sst1InitDacWr(sstbase, SST_DACREG_INDEXADDR, SST_DACREG_INDEX_CR0);
+            sst1InitDacWr(sstbase, SST_DACREG_INDEXDATA,
+                sst1InitDacRd(sstbase, SST_DACREG_INDEXDATA) &
+                ~SST_DACREG_CR0_INDEXED_ADDRESSING);
+            if(helper)
+                INIT_PRINTF(("sst1InitDacDetectTI(): Exiting...\n"));
+            return(FXTRUE);
+        }
+    }
+    if(helper)
+        INIT_PRINTF(("sst1InitDacDetectTI(): Exiting...\n"));
+    return(FXFALSE);
+}
+
+FxBool sst1InitDacDetectICS(FxU32 * sstbase)
+{
+    FxU32 n;
+    int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+
+    if(helper)
+        INIT_PRINTF(("sst1InitDacDetectICS(): Entered...\n"));
+
+    /* Detect ICS... */
+    /* Sometimes the DACs seem to go into never-never land, so */
+    /* try and initialize the DAC multiple times */
+    n = 0;
+    while(1) {
+        FxU32 gclk1, vclk1, vclk7;
+
+        if(++n > 100)
+            break;
+        /* Must guarantee that no rendering is being performed */
+        sst1InitIdleFBINoNOP(sstbase);
+
+        sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_RD,
+            SST_DACREG_ICS_PLLADDR_GCLK1);
+        gclk1 = sst1InitDacRd(sstbase,  SST_DACREG_ICS_PLLADDR_DATA);
+        sst1InitDacRd(sstbase,  SST_DACREG_ICS_PLLADDR_DATA);
+        sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_RD,
+            SST_DACREG_ICS_PLLADDR_VCLK1);
+        vclk1 = sst1InitDacRd(sstbase,  SST_DACREG_ICS_PLLADDR_DATA);
+        sst1InitDacRd(sstbase,  SST_DACREG_ICS_PLLADDR_DATA);
+        sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_RD,
+            SST_DACREG_ICS_PLLADDR_VCLK7);
+        vclk7 = sst1InitDacRd(sstbase,  SST_DACREG_ICS_PLLADDR_DATA);
+        sst1InitDacRd(sstbase,  SST_DACREG_ICS_PLLADDR_DATA);
+        if((gclk1 == SST_DACREG_ICS_PLLADDR_GCLK1_DEFAULT) &&
+           (vclk1 == SST_DACREG_ICS_PLLADDR_VCLK1_DEFAULT) &&
+           (vclk7 == SST_DACREG_ICS_PLLADDR_VCLK7_DEFAULT)) {
+            /* found ICS DAC... */
+            sst1CurrentBoard->fbiDacType = SST_FBI_DACTYPE_ICS;
+            if(helper)
+                INIT_PRINTF(("sst1InitDacDetectICS(): Exiting...\n"));
+            return(FXTRUE);
+        }
+    }
+    if(helper)
+        INIT_PRINTF(("sst1InitDacDetectICS(): Exiting...\n"));
+    return(FXFALSE);
+}
+
+/*
+** sst1InitCalcGrxClk():
+**  Determine graphics clock frequency
+**  NOTE: sst1InitCalcGrxClk() must be called prior to sst1InitGrxClk()
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitCalcGrxClk(FxU32 *sstbase)
+{
+    FxU32 clkFreq;
+
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    if(GETENV(("SST_GRXCLK"))) {
+        INIT_PRINTF(("sst1InitCalcGrxClk(): Overriding default clk frequency with SST_GRXCLK\n"));
+        clkFreq = ATOI(GETENV(("SST_GRXCLK")));
+        if(clkFreq < 16)
+            clkFreq = 16;
+    } else {
+        /* Setup memory clock frequency based on board strapping bits... */
+        if(sst1CurrentBoard->fbiBoardID == 0x0) {
+            /* Obsidian GE Fab */
+            clkFreq = 40 + (((sst1CurrentBoard->tmuConfig >> 3) & 0x7) << 2) +
+                (sst1CurrentBoard->fbiConfig & 0x3);
+        } else {
+            /* Obsidian Pro Fab */
+            clkFreq = 40 + (((sst1CurrentBoard->tmuConfig >> 3) & 0x7) << 2) +
+                (sst1CurrentBoard->fbiConfig & 0x3);
+            /* Fix for legacy/existing boards */
+            if(clkFreq == 54)
+                clkFreq = 50;
+        }
+    }
+    sst1CurrentBoard->grxClkFreq = clkFreq;
+    return(FXTRUE);
+}
+
+/*
+** sst1InitGrxClk():
+**  Initialize FBI and TREX Memory clocks
+**  NOTE: sst1InitCalcGrxClk() must be called prior to sst1InitGrxClk()
+**  NOTE: sst1InitGrxClk() resets the PCI fifo and the graphics subsystem of FBI
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitGrxClk(FxU32 *sstbase)
+{
+    sst1ClkTimingStruct sstGrxClk;
+
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+    if(sst1CurrentBoard->initGrxClkDone)
+        return(FXTRUE);
+    sst1CurrentBoard->initGrxClkDone = 1;
+
+    INIT_PRINTF(("sst1InitGrxClk(): Setting up %d MHz Graphics Clock...\n",
+        sst1CurrentBoard->grxClkFreq));
+    if(sst1InitComputeClkParams((float) sst1CurrentBoard->grxClkFreq,
+      &sstGrxClk) == FXFALSE)
+        return(FXFALSE);
+
+    return(sst1InitSetGrxClk(sstbase, &sstGrxClk));
+}
+
+/*
+** sst1InitComputeClkParams():
+**  Compute PLL parameters for given clock frequency
+**
+*/
+FxBool sst1InitComputeClkParams(float freq, sst1ClkTimingStruct
+    *clkTiming)
+{
+    float vcoFreqDivide, freqMultRatio, clkError;
+    float clkErrorMin;
+    FxU32 p, n, m, nPlusTwo;
+    int mPlusTwo;
+
+    /* Calculate P parameter */
+    p = 4;
+    if(((freq * (float) 1.) >= (float) 120.) &&
+       ((freq * (float) 1.) <= (float) 240.)) {
+           vcoFreqDivide = (float) 1.;
+           p = 0;
+    }
+    if(((freq * (float) 2.) >= (float) 120.) &&
+       ((freq * (float) 2.) <= (float) 240.)) {
+           vcoFreqDivide = (float) 2.;
+           p = 1;
+    }
+    if(((freq * (float) 4.) >= (float) 120.) &&
+       ((freq * (float) 4.) <= (float) 240.)) {
+           vcoFreqDivide = (float) 4.;
+           p = 2;
+    }
+    if(((freq * (float) 8.) >= (float) 120.) &&
+       ((freq * (float) 8.) <= (float) 240.)) {
+           vcoFreqDivide = (float) 8.;
+           p = 3;
+    }
+    if(p > 3)
+        return(FXFALSE);
+
+    /* Divide by 14.318 */
+    freqMultRatio = (freq * vcoFreqDivide) * (float) 0.06984216;
+
+    /* Calculate proper N and M parameters which yield the lowest error */
+    clkErrorMin = (float) 9999.; n = 0;
+    for(nPlusTwo = 3; nPlusTwo < 32; nPlusTwo++) {
+#ifdef DIRECTX
+        mPlusTwo = FTOL( (((float) nPlusTwo * freqMultRatio) + (float) 0.5) );
+        clkError = ((float) mPlusTwo * ITOF_INV( nPlusTwo ) ) - freqMultRatio;
+#else
+        mPlusTwo = (int) (((float) nPlusTwo * freqMultRatio) + (float) 0.5);
+        clkError = ((float) mPlusTwo / (float) nPlusTwo) - freqMultRatio;
+#endif
+        if(clkError < (float) 0.0)
+            clkError = -clkError;
+        if((clkError < clkErrorMin) && ((mPlusTwo - 2) < 127)) {
+            clkErrorMin = clkError;
+            n = nPlusTwo - 2;
+            m = mPlusTwo - 2;
+        }
+    }
+    if(n == 0)
+        return(FXFALSE);
+
+    clkTiming->freq = freq;
+    clkTiming->clkTiming_M = m;
+    clkTiming->clkTiming_P = p;
+    clkTiming->clkTiming_N = n;
+    if(freq < (float) 37.) {
+        clkTiming->clkTiming_L = 0xa;
+        clkTiming->clkTiming_IB = 0x6;
+    } else if(freq < (float) 45.) {
+        clkTiming->clkTiming_L = 0xc;
+        clkTiming->clkTiming_IB = 0x4;
+    } else if(freq < (float) 58.) {
+        clkTiming->clkTiming_L = 0x8;
+        clkTiming->clkTiming_IB = 0x4;
+    } else if(freq < (float) 66.) {
+        clkTiming->clkTiming_L = 0xa;
+        clkTiming->clkTiming_IB = 0x6;
+    } else {
+        clkTiming->clkTiming_L = 0xa;
+        clkTiming->clkTiming_IB = 0x8;
+    }
+#if 0
+    {
+        float calc;
+        
+        calc = ((float) 14.318 * (float) (m + 2)) /
+            ((float) (n + 2) * vcoFreqDivide);
+        printf("freq:%.3f  calc:%.3f\n", freq, calc);
+        printf("m:%d p:%d n:%d\n", m, p, n);
+        fflush(stdout);
+    }
+#endif
+    return(FXTRUE);
+}
+
+/*
+** sst1InitSetVidClkATT():
+**  Set video clock for ATT Dacs
+**
+*/
+FxBool sst1InitSetVidClkATT(FxU32 *sstbase, sst1ClkTimingStruct
+    *sstVidClk)
+{
+    if(sst1InitDacIndexedEnable(sstbase, 1) == FXFALSE)
+        return(FXFALSE);
+
+    DAC_INDEXWRADDR(SST_DACREG_INDEX_AD0);
+    DAC_INDEXWR((sstVidClk->clkTiming_M) << SST_DACREG_CLKREG_MSHIFT);
+    DAC_INDEXWRADDR(SST_DACREG_INDEX_AD1);
+    DAC_INDEXWR(((sstVidClk->clkTiming_P) << SST_DACREG_CLKREG_PSHIFT) |
+        ((sstVidClk->clkTiming_N)
+           << SST_DACREG_CLKREG_NSHIFT));
+    DAC_INDEXWRADDR(SST_DACREG_INDEX_AD2);
+    DAC_INDEXWR(((sstVidClk->clkTiming_L) << SST_DACREG_CLKREG_LSHIFT) |
+        ((sstVidClk->clkTiming_IB) << SST_DACREG_CLKREG_IBSHIFT));
+    DAC_INDEXWRADDR(SST_DACREG_INDEX_CC);
+    DAC_INDEXWR((DAC_INDEXRD() | (0x3 << SST_DACREG_CC_ACLK_SEL_SHIFT) |
+        SST_DACREG_CC_ACLK_SELECT_AD));
+    DAC_INDEXWRADDR(SST_DACREG_INDEX_CC);
+
+    if(sst1InitDacIndexedEnable(sstbase, 0) == FXFALSE)
+        return(FXFALSE);
+
+    return(FXTRUE);
+}
+
+/*
+** sst1InitSetVidClkICS():
+**  Set video clock for ICS Dacs
+**
+*/
+FxBool sst1InitSetVidClkICS(FxU32 *sstbase, sst1ClkTimingStruct
+    *sstVidClk)
+{
+    FxU32 n, fbiInit1_save, fbiInit2_save, pllCtrl;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Save init register states before overwriting them */
+    fbiInit1_save = IGET(sst->fbiInit1);
+    fbiInit2_save = IGET(sst->fbiInit2);
+
+    /* Reset video unit to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+    /* Turn off dram refresh to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit2, IGET(sst->fbiInit2) & ~SST_EN_DRAM_REFRESH);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Enable reads from the DAC (multiplexed on the fbiInit2 address) */
+    /* Disallow writes to pass through the PCI FIFO */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_FBIINIT23_REMAP);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_RD,
+        SST_DACREG_ICS_PLLADDR_CTRL);
+    pllCtrl = sst1InitDacRd(sstbase,  SST_DACREG_ICS_PLLADDR_DATA);
+
+    sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_WR,
+        SST_DACREG_ICS_PLLADDR_VCLK0);
+    sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_DATA,
+        sstVidClk->clkTiming_M);
+    sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_DATA,
+        (((sstVidClk->clkTiming_P) << 5) | sstVidClk->clkTiming_N));
+    sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_WR,
+        SST_DACREG_ICS_PLLADDR_CTRL);
+    sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_DATA,
+        ((pllCtrl & ~SST_DACREG_ICS_PLLCTRL_CLK0FREQ) |
+          SST_DACREG_ICS_PLLCTRL_CLK0SEL));
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Disable fbiinit23 address remapping */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_PCI_FIFOWR_EN);
+
+    /* Restore init register states */
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit1, fbiInit1_save);
+    ISET(sst->fbiInit2, fbiInit2_save);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    return(FXTRUE);
+}
+
+/*
+** sst1InitSetVidClkINI():
+**  Set video clock for DACs defined in "voodoo.ini"
+**
+*/
+FxBool sst1InitSetVidClkINI(FxU32 *sstbase, FxU32 width,
+  FxU32 height, FxU32 refresh, FxU32 video16BPP)
+{
+    FxU32 n, fbiInit1_save, fbiInit2_save;
+    sst1InitDacSetVideoStruct *setVideo;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+    int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+    FxBool retVal = FXFALSE;
+
+    if(helper)
+        INIT_PRINTF(("sst1InitSetVidClkINI(): Entered...\n"));
+
+    if(iniDac == (sst1InitDacStruct *) NULL)
+        return(FXFALSE);
+
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Save init register states before overwriting them */
+    fbiInit1_save = IGET(sst->fbiInit1);
+    fbiInit2_save = IGET(sst->fbiInit2);
+
+    /* Reset video unit to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+    /* Turn off dram refresh to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit2, IGET(sst->fbiInit2) & ~SST_EN_DRAM_REFRESH);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Enable reads from the DAC (multiplexed on the fbiInit2 address) */
+    /* Disallow writes to pass through the PCI FIFO */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_FBIINIT23_REMAP);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    setVideo = iniDac->setVideo;
+    while(setVideo) {
+        if((setVideo->width == width) && (setVideo->height == height) &&
+           (setVideo->refresh == refresh) &&
+           (setVideo->video16BPP == video16BPP)) {
+            if((retVal = sst1InitExecuteDacRdWr(sstbase,
+              setVideo->setVideoRdWr)) == FXTRUE) {
+                retVal = FXTRUE;
+                break;
+            }
+        }
+        setVideo = (sst1InitDacSetVideoStruct *)setVideo->nextSetVideo;
+    }
+
+    /* Disable fbiinit23 address remapping */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_PCI_FIFOWR_EN);
+
+    /* Restore init register states */
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit1, fbiInit1_save);
+    ISET(sst->fbiInit2, fbiInit2_save);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    return(retVal);
+}
+
+/*
+** sst1InitSetGrxClkATT():
+**  Set graphics clock for ATT Dacs
+**  NOTE: sst1InitSetGrxClkATT() resets the PCI fifo and the graphics subsystem
+**  of FBI
+**
+*/
+FxBool sst1InitSetGrxClkATT(FxU32 *sstbase, sst1ClkTimingStruct
+    *sstGrxClk)
+{
+    FxU32 n;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    /* Reset graphics unit before we change grx clk */
+    ISET(sst->fbiInit0, IGET(sst->fbiInit0) |
+      (SST_GRX_RESET | SST_PCI_FIFO_RESET));
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Enable DAC indexed addressing */
+    /* sst1InitDacIndexedEnable resets the video module, turns off dram refresh */
+    /* and disallows writes to the PCI fifo */
+    if(sst1InitDacIndexedEnable(sstbase, 1) == FXFALSE)
+        return(FXFALSE);
+
+    DAC_INDEXWRADDR(SST_DACREG_INDEX_BD0);
+    DAC_INDEXWR((sstGrxClk->clkTiming_M) << SST_DACREG_CLKREG_MSHIFT);
+    DAC_INDEXWRADDR(SST_DACREG_INDEX_BD1);
+    DAC_INDEXWR(((sstGrxClk->clkTiming_P) << SST_DACREG_CLKREG_PSHIFT) |
+                ((sstGrxClk->clkTiming_N) << SST_DACREG_CLKREG_NSHIFT));
+    DAC_INDEXWRADDR(SST_DACREG_INDEX_BD2);
+    DAC_INDEXWR(((sstGrxClk->clkTiming_L) << SST_DACREG_CLKREG_LSHIFT) |
+                ((sstGrxClk->clkTiming_IB) << SST_DACREG_CLKREG_IBSHIFT));
+    DAC_INDEXWRADDR(SST_DACREG_INDEX_CC);
+    DAC_INDEXWR((DAC_INDEXRD() | (0x3 << SST_DACREG_CC_BCLK_SEL_SHIFT) |
+        SST_DACREG_CC_BCLK_SELECT_BD));
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Turn off DAC indexed addressing */
+
+    /* Disabling dac indexed mode re-enables writes to pass through the */
+    /* PCI fifo (and restores video refresh and dram refresh if previously */
+    /* enabled) */
+    if(sst1InitDacIndexedEnable(sstbase, 0) == FXFALSE)
+        return(FXFALSE);
+
+    /* Wait for graphics clock to stabilize */
+    for(n=0; n<200000; n++)
+        sst1InitReturnStatus(sstbase);
+
+    /* Unreset PCI FIFO and graphic subsystem */
+    ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_PCI_FIFO_RESET);
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_GRX_RESET);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    return(FXTRUE);
+}
+
+/*
+** sst1InitSetGrxClkICS():
+**  Set graphics clock for ICS Dacs
+**  NOTE: sst1InitSetGrxClkICS() resets the PCI fifo and the graphics subsystem
+**  of FBI
+**
+*/
+FxBool sst1InitSetGrxClkICS(FxU32 *sstbase, sst1ClkTimingStruct
+    *sstGrxClk)
+{
+    FxU32 n, fbiInit1_save, fbiInit2_save, pllCtrl;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    /* Reset graphics unit before we change grx clk */
+    ISET(sst->fbiInit0, IGET(sst->fbiInit0) |
+      (SST_GRX_RESET | SST_PCI_FIFO_RESET));
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Save init register states before overwriting them */
+    fbiInit1_save = IGET(sst->fbiInit1);
+    fbiInit2_save = IGET(sst->fbiInit2);
+
+    /* Reset video unit to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+    /* Turn off dram refresh to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit2, IGET(sst->fbiInit2) & ~SST_EN_DRAM_REFRESH);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Enable reads from the DAC (multiplexed on the fbiInit2 address) */
+    /* Disallow writes to pass through the PCI FIFO */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_FBIINIT23_REMAP);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_RD,
+        SST_DACREG_ICS_PLLADDR_CTRL);
+    pllCtrl = sst1InitDacRd(sstbase,  SST_DACREG_ICS_PLLADDR_DATA);
+
+    sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_WR,
+        SST_DACREG_ICS_PLLADDR_GCLK0);
+    sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_DATA,
+        sstGrxClk->clkTiming_M);
+    sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_DATA,
+        (((sstGrxClk->clkTiming_P) << 5) | sstGrxClk->clkTiming_N));
+    sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_WR,
+        SST_DACREG_ICS_PLLADDR_CTRL);
+    sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_DATA,
+        (pllCtrl & ~SST_DACREG_ICS_PLLCTRL_CLK1SEL));
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Disable fbiinit23 address remapping */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_PCI_FIFOWR_EN);
+
+    /* Restore init register states */
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit1, fbiInit1_save);
+    ISET(sst->fbiInit2, fbiInit2_save);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Wait for graphics clock to stabilize */
+    for(n=0; n<200000; n++)
+        sst1InitReturnStatus(sstbase);
+
+    /* Unreset PCI FIFO and graphic subsystem */
+    ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_PCI_FIFO_RESET);
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_GRX_RESET);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    return(FXTRUE);
+}
+
+/*
+** sst1InitSetGrxClkINI():
+**  Set graphics clock for dac specified in "voodoo.ini" file
+**  NOTE: sst1InitSetGrxClkINI() resets the PCI fifo and the graphics subsystem
+**  of FBI
+**
+*/
+FxBool sst1InitSetGrxClkINI(FxU32 *sstbase, sst1ClkTimingStruct
+    *sstGrxClk)
+{
+    FxU32 n, fbiInit1_save, fbiInit2_save;
+    sst1InitDacSetMemClkStruct *setMemClk;
+    FxBool retVal = FXFALSE;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    if(iniDac == (sst1InitDacStruct *) NULL)
+        return(FXFALSE);
+
+    /* Reset graphics unit before we change grx clk */
+    ISET(sst->fbiInit0, IGET(sst->fbiInit0) |
+      (SST_GRX_RESET | SST_PCI_FIFO_RESET));
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Save init register states before overwriting them */
+    fbiInit1_save = IGET(sst->fbiInit1);
+    fbiInit2_save = IGET(sst->fbiInit2);
+
+    /* Reset video unit to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+    /* Turn off dram refresh to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit2, IGET(sst->fbiInit2) & ~SST_EN_DRAM_REFRESH);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Enable reads from the DAC (multiplexed on the fbiInit2 address) */
+    /* Disallow writes to pass through the PCI FIFO */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_FBIINIT23_REMAP);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    setMemClk = iniDac->setMemClk;
+    while(setMemClk) {
+#ifdef DIRECTX
+        if(setMemClk->frequency == FTOL(sstGrxClk->freq) ) {
+#else
+        if(setMemClk->frequency == (FxU32) sstGrxClk->freq) {
+#endif
+            if((retVal = sst1InitExecuteDacRdWr(sstbase,
+              setMemClk->setMemClkRdWr)) == FXTRUE) {
+                retVal = FXTRUE;
+                break;
+            }
+        }
+        setMemClk = (sst1InitDacSetMemClkStruct *)setMemClk->nextSetMemClk;
+    }
+    /* Disable fbiinit23 address remapping */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_PCI_FIFOWR_EN);
+
+    /* Restore init register states */
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit1, fbiInit1_save);
+
+    ISET(sst->fbiInit2, fbiInit2_save);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Wait for graphics clock to stabilize */
+    if(retVal == FXTRUE) {
+        for(n=0; n<200000; n++)
+            sst1InitReturnStatus(sstbase);
+    }
+
+    /* Unreset PCI FIFO and graphic subsystem */
+    ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_PCI_FIFO_RESET);
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_GRX_RESET);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    return(retVal);
+}
+
+/*
+** sst1InitSetVidModeATT():
+**  Set video Mode for ATT dacs
+**
+*/
+FxBool sst1InitSetVidModeATT(FxU32 *sstbase, FxU32 video16BPP)
+{
+    if(sst1InitDacIndexedEnable(sstbase, 1) == FXFALSE)
+        return(FXFALSE);
+
+    /* Set 16 or 24-bit pixel output */
+    if(video16BPP) {
+       DAC_INDEXWRADDR(SST_DACREG_INDEX_CR0);
+       DAC_INDEXWR((DAC_INDEXRD() & ~SST_DACREG_CR0_COLOR_MODE) |
+           SST_DACREG_CR0_COLOR_MODE_16BPP | SST_DACREG_CR0_8BITDAC);
+    } else {
+       DAC_INDEXWRADDR(SST_DACREG_INDEX_CR0);
+       DAC_INDEXWR((DAC_INDEXRD() & ~SST_DACREG_CR0_COLOR_MODE) |
+           SST_DACREG_CR0_COLOR_MODE_24BPP | SST_DACREG_CR0_8BITDAC);
+    }
+
+    if(sst1InitDacIndexedEnable(sstbase, 0) == FXFALSE)
+        return(FXFALSE);
+
+
+    return(FXTRUE);
+}
+
+/*
+** sst1InitSetVidModeICS():
+**  Set video Mode for ICS dacs
+**
+*/
+FxBool sst1InitSetVidModeICS(FxU32 *sstbase, FxU32 video16BPP)
+{
+    FxU32 n, fbiInit1_save, fbiInit2_save;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Save init register states before overwriting them */
+    fbiInit1_save = IGET(sst->fbiInit1);
+    fbiInit2_save = IGET(sst->fbiInit2);
+
+    /* Reset video unit to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+    /* Turn off dram refresh to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit2, IGET(sst->fbiInit2) & ~SST_EN_DRAM_REFRESH);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Enable reads from the DAC (multiplexed on the fbiInit2 address) */
+    /* Disallow writes to pass through the PCI FIFO */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_FBIINIT23_REMAP);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    if(video16BPP)
+        sst1InitDacWr(sstbase, SST_DACREG_ICS_CMD,
+            SST_DACREG_ICS_COLORMODE_16BPP);
+    else
+        sst1InitDacWr(sstbase, SST_DACREG_ICS_CMD,
+            SST_DACREG_ICS_COLORMODE_24BPP);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Disable fbiinit23 address remapping */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_PCI_FIFOWR_EN);
+
+    /* Restore init register states */
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit1, fbiInit1_save);
+    ISET(sst->fbiInit2, fbiInit2_save);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    return(FXTRUE);
+}
+
+/*
+** sst1InitSetVidModeINI():
+**  Set video Mode for DACs defined in "voodoo.ini"
+**
+*/
+FxBool sst1InitSetVidModeINI(FxU32 *sstbase, FxU32 video16BPP)
+{
+    FxU32 n, fbiInit1_save, fbiInit2_save;
+    sst1InitDacSetVideoModeStruct *setVideoMode;
+    FxBool retVal = FXFALSE;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    if(iniDac == (sst1InitDacStruct *) NULL)
+        return(FXFALSE);
+
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Save init register states before overwriting them */
+    fbiInit1_save = IGET(sst->fbiInit1);
+    fbiInit2_save = IGET(sst->fbiInit2);
+
+    /* Reset video unit to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+    /* Turn off dram refresh to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit2, IGET(sst->fbiInit2) & ~SST_EN_DRAM_REFRESH);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Enable reads from the DAC (multiplexed on the fbiInit2 address) */
+    /* Disallow writes to pass through the PCI FIFO */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_FBIINIT23_REMAP);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    setVideoMode = iniDac->setVideoMode;
+    while(setVideoMode) {
+        if(setVideoMode->video16BPP == video16BPP) {
+            if((retVal = sst1InitExecuteDacRdWr(sstbase,
+              setVideoMode->setVideoModeRdWr)) == FXTRUE) {
+                retVal = FXTRUE;
+                break;
+            }
+        }
+        setVideoMode = (sst1InitDacSetVideoModeStruct *)setVideoMode->nextSetVideoMode;
+    }
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Disable fbiinit23 address remapping */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_PCI_FIFOWR_EN);
+
+    /* Restore init register states */
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit1, fbiInit1_save);
+    ISET(sst->fbiInit2, fbiInit2_save);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    return(retVal);
+}
+
+/*
+** sst1InitDacIndexedEnable():
+**  Initialize DAC for indexed-mode addressing
+**  NOTE: When DAC indexed-mode addressing is enabled, video timing and
+**   DRAM refresh are both reset (disabled)
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitDacIndexedEnable(FxU32 *sstbase,
+  FxU32 Enable)
+{
+    FxU32 n, j, dacmir, dacdir, cr0_save;
+    static FxU32 fbiInit1_save = 0;
+    static FxU32 fbiInit2_save = 0;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    if(!sst)
+        return(FXFALSE);
+
+    sst1InitIdleFBINoNOP(sstbase);
+    if(!Enable) {
+        /* Disable indexed-mode addressing */
+        sst1InitDacWr(sstbase, SST_DACREG_INDEXADDR, SST_DACREG_INDEX_CR0);
+        sst1InitDacWr(sstbase, SST_DACREG_INDEXDATA,
+            sst1InitDacRd(sstbase, SST_DACREG_INDEXDATA) &
+             ~SST_DACREG_CR0_INDEXED_ADDRESSING);
+
+        /* Disable fbiinit23 address remapping */
+        PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_PCI_FIFOWR_EN);
+
+        /* Restore init register states */
+        sst1InitIdleFBINoNOP(sstbase);
+        if(fbiInit1_save)  /* Have we previously enabled indexed addressing? */
+            ISET(sst->fbiInit1, fbiInit1_save);
+        if(fbiInit2_save)  /* Have we previously enabled indexed addressing? */
+            ISET(sst->fbiInit2, fbiInit2_save);
+        sst1InitIdleFBINoNOP(sstbase);
+        return(FXTRUE);
+    }
+
+    /* Save init register states before overwriting them */
+    fbiInit1_save = IGET(sst->fbiInit1);
+    fbiInit2_save = IGET(sst->fbiInit2);
+
+    /* Reset video unit to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+    /* Turn off dram refresh to guarantee no contentions on the memory bus */
+    ISET(sst->fbiInit2, IGET(sst->fbiInit2) & ~SST_EN_DRAM_REFRESH);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Enable reads from the DAC (multiplexed on the fbiInit2 address) */
+    /* Disallow writes to pass through the PCI FIFO */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_FBIINIT23_REMAP);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Sometimes the DACs seem to go into never-never land, so */
+    /* try and initialize the DAC multiple times */
+    n = 0;
+    while(1) {
+        if(++n > 100) {
+            INIT_PRINTF(("sst1InitDacIndexedEnable() ERROR: Could not Initialize DAC\n"));
+            return(FXFALSE);
+        }
+
+        /* Must guarantee that no rendering is being performed */
+        sst1InitIdleFBINoNOP(sstbase);
+
+        /* Reset current state of DAC command register 0 (CR0) via the read */
+        /* mask register (RMR) */
+        sst1InitDacWr(sstbase, SST_DACREG_WMA, 0x0); /* reset backdoor fsm */
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);      /* RMR must be read 5 times */
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        cr0_save = sst1InitDacRd(sstbase, SST_DACREG_RMR);
+
+        /* Enable indexed programming by setting CR0[0] = 1 */
+        sst1InitDacWr(sstbase, SST_DACREG_WMA, 0x0); /* reset backdoor fsm */
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);      /* RMR must be read 4 times */
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacRd(sstbase, SST_DACREG_RMR);
+        sst1InitDacWr(sstbase, SST_DACREG_RMR, ((cr0_save & 0xf0) |
+            SST_DACREG_CR0_INDEXED_ADDRESSING | SST_DACREG_CR0_8BITDAC));
+
+        /* NOW DAC IS IN INDEXED ADDRESS MODE... */
+
+        /* Check the manufacturing ID for sanity */
+        j = 0;
+        DAC_INDEXWRADDR(SST_DACREG_INDEX_MIR);
+        dacmir = DAC_INDEXRD();
+
+        if((dacmir == SST_DACREG_INDEX_MIR_ATT_DEFAULT) ||
+           (dacmir == SST_DACREG_INDEX_MIR_TI_DEFAULT))
+            j++;
+        else
+            continue;
+
+        /* Check the device ID for sanity */
+        DAC_INDEXWRADDR(SST_DACREG_INDEX_DIR);
+        dacdir = DAC_INDEXRD();
+        if((dacmir == SST_DACREG_INDEX_MIR_ATT_DEFAULT &&
+            dacdir == SST_DACREG_INDEX_DIR_ATT_DEFAULT) ||
+           (dacmir == SST_DACREG_INDEX_MIR_TI_DEFAULT &&
+            dacdir == SST_DACREG_INDEX_DIR_TI_DEFAULT))
+            j++;
+        else
+            continue;
+        if(j == 2)
+            break;
+    }
+    sst1InitIdleFBINoNOP(sstbase);
+    return(FXTRUE);
+}
+
+#pragma optimize ("",on)
Index: trunk/src/opengl/glide/sst1/init/initvg/gamma.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/gamma.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/gamma.c	(revision 2885)
@@ -0,0 +1,256 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:33 $ 
+**
+** Initialization code for loading SST-1 gamma tables
+**
+*/
+#pragma optimize ("",off)
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <sst.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <sst1vid.h>
+#include <sst1init.h>
+
+/*
+** sst1InitGamma():
+**  Load the video color-lookup tables with the specified gamma function
+**
+**    Returns:
+**      FXTRUE if successfully initializes SST-1 gamma tables
+**      FXFALSE if cannot initialize SST-1 gamma tables
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitGamma(FxU32 *sstbase, double gamma)
+{
+    static FxBool calledBefore = FXFALSE;
+    static FxBool overRideR = FXFALSE;
+    static FxBool overRideG = FXFALSE;
+    static FxBool overRideB = FXFALSE;
+    static double gammaR, gammaG, gammaB;
+
+    if(!sstbase)
+        return(FXFALSE);
+
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    if(overRideR == FXFALSE)
+        gammaR = gamma;
+    if(overRideG == FXFALSE)
+        gammaG = gamma;
+    if(overRideB == FXFALSE)
+        gammaB = gamma;
+
+    if(calledBefore == FXFALSE) {
+        calledBefore = FXTRUE;
+        if(GETENV(("SST_RGAMMA"))) {
+            overRideR = FXTRUE;
+            gammaR = (double) ATOF(GETENV(("SST_RGAMMA")));
+        }
+        if(GETENV(("SST_GGAMMA"))) {
+            overRideG = FXTRUE;
+            gammaG = (double) ATOF(GETENV(("SST_GGAMMA")));
+        }
+        if(GETENV(("SST_BGAMMA"))) {
+            overRideB = FXTRUE;
+            gammaB = (double) ATOF(GETENV(("SST_BGAMMA")));
+        }
+        if(GETENV(("SST_GAMMA"))) {
+            overRideR = FXTRUE;
+            overRideG = FXTRUE;
+            overRideB = FXTRUE;
+            gammaR = (double) ATOF(GETENV(("SST_GAMMA")));
+            gammaG = gammaR;
+            gammaB = gammaR;
+        }
+    }
+    return(sst1InitGammaRGB(sstbase, gammaR, gammaG, gammaB));
+}
+
+FX_EXPORT FxBool FX_CSTYLE sst1InitGammaRGB(FxU32 *sstbase, double gammaR,
+  double gammaG, double gammaB)
+{
+    FxU32 x, n;
+    FxU32 gammaTableR[256];
+    FxU32 gammaTableG[256];
+    FxU32 gammaTableB[256];
+    FxBool sstVideoIsReset;
+    static FxBool calledBefore = FXFALSE;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    if(!sstbase)
+        return(FXFALSE);
+
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    /* Enable video clock */
+    if(calledBefore == FXFALSE && !sst1InitSliEnabled) {
+        if(SLI_DRIVEOK()) {
+            INIT_PRINTF(("sst1InitGammaRGB(): Enabling Video Clock...\n"));
+            PCICFG_WR(SST1_PCI_VCLK_ENABLE, 0x0);
+        }
+        INIT_PRINTF(("sst1InitGammaRGB(): Setting GammaRGB = (%.2f,%.2f,%.2f)\n",
+          gammaR, gammaG, gammaB));
+    }
+
+    /* Initialize the gamma table */
+    for(x=0; x<256; x++) {
+        gammaTableR[x] = FTOL (POW(x/255.0F, 1.0F/gammaR) * 255.0F + 0.5F);
+        gammaTableG[x] = FTOL (POW(x/255.0F, 1.0F/gammaG) * 255.0F + 0.5F);
+        gammaTableB[x] = FTOL (POW(x/255.0F, 1.0F/gammaB) * 255.0F + 0.5F);
+    }
+
+    /* SST-1 video reset must be inactive to load gamma tables */
+    sst1InitIdleFBINoNOP(sstbase);
+    if(!sst1InitSliEnabled) {
+        if(IGET(sst->fbiInit1) & SST_VIDEO_RESET)
+            sstVideoIsReset = FXTRUE;
+        else
+            sstVideoIsReset = FXFALSE;
+   
+        ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_RESET);
+        /* wait for video reset to be deasserted */
+        sst1InitIdleFBINoNOP(sstbase);
+    }
+
+    /* SST-1 requires every eighth entry of the gamma table to be loaded, */
+    /* so only 32 basic writes are required.  A 33rd write is used to load  */
+    /* the top entry of the gamma table.  The 33rd entry is necessary because */
+    /* SST-1 performs linear interpolation between each gamma table entry to */
+    /* generate 256 unique gamma-corrected values. */
+    for(x=0; x<32; x++) {
+        FxU32 gcR = gammaTableR[(x<<3)];
+        FxU32 gcG = gammaTableG[(x<<3)];
+        FxU32 gcB = gammaTableB[(x<<3)];
+        ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 
+                         (gcR<<SST_CLUTDATA_RED_SHIFT) |
+                         (gcG<<SST_CLUTDATA_GREEN_SHIFT) |
+                         (gcB<<SST_CLUTDATA_BLUE_SHIFT)));
+    }
+    /* Last entry in the gamma table is stored as 0x0 to perform proper
+       linear interpolation of the last 8 entries */
+    /* BUG Fix: Last entry in table needs to be 0xffffff for proper linear
+       interpolation */
+    ISET(sst->clutData, (32<<SST_CLUTDATA_INDEX_SHIFT) | 0xffffff);
+
+    sst1InitIdleFBINoNOP(sstbase); /* wait for gamma table writes to complete */
+
+    if(!sst1InitSliEnabled) {
+        /* Return state of video reset to original value */
+        if(sstVideoIsReset == FXTRUE)
+            ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+    }
+
+    if(calledBefore == FXFALSE) {
+        calledBefore = FXTRUE;
+        INIT_PRINTF(("sst1InitGammaRGB() exiting with status %d...\n", FXTRUE));
+    }
+    return(FXTRUE);
+}
+
+FX_EXPORT FxBool FX_CSTYLE sst1InitGammaTable(FxU32 *sstbase, FxU32 nentries, 
+FxU32 *r, FxU32 *g, FxU32 *b)
+{
+    FxU32 x, n;
+    FxU32 gammaTableR[256];
+    FxU32 gammaTableG[256];
+    FxU32 gammaTableB[256];
+    FxBool sstVideoIsReset;
+    static FxBool calledBefore = FXFALSE;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    if(!sstbase)
+        return(FXFALSE);
+
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    /* Enable video clock */
+    if(calledBefore == FXFALSE && !sst1InitSliEnabled) {
+        if(SLI_DRIVEOK()) {
+            INIT_PRINTF(("sst1InitGammaRGB(): Enabling Video Clock...\n"));
+            PCICFG_WR(SST1_PCI_VCLK_ENABLE, 0x0);
+        }
+    }
+
+    /* Initialize the gamma table */
+    for(x=0; x<nentries; x++) {
+        gammaTableR[x] = *r;
+        gammaTableG[x] = *g;
+        gammaTableB[x] = *b;
+        r++; g++; b++;
+    }
+
+    /* SST-1 video reset must be inactive to load gamma tables */
+    sst1InitIdleFBINoNOP(sstbase);
+    if(!sst1InitSliEnabled) {
+        if(IGET(sst->fbiInit1) & SST_VIDEO_RESET)
+            sstVideoIsReset = FXTRUE;
+        else
+            sstVideoIsReset = FXFALSE;
+   
+        ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_RESET);
+        /* wait for video reset to be deasserted */
+        sst1InitIdleFBINoNOP(sstbase);
+    }
+
+    /* SST-1 requires every eighth entry of the gamma table to be loaded, */
+    /* so only 32 basic writes are required.  A 33rd write is used to load  */
+    /* the top entry of the gamma table.  The 33rd entry is necessary because */
+    /* SST-1 performs linear interpolation between each gamma table entry to */
+    /* generate 256 unique gamma-corrected values. */
+    for(x=0; x<32; x++) {
+        FxU32 gcR = gammaTableR[(x<<3)];
+        FxU32 gcG = gammaTableG[(x<<3)];
+        FxU32 gcB = gammaTableB[(x<<3)];
+        ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 
+                         (gcR<<SST_CLUTDATA_RED_SHIFT) |
+                         (gcG<<SST_CLUTDATA_GREEN_SHIFT) |
+                         (gcB<<SST_CLUTDATA_BLUE_SHIFT)));
+    }
+    /* Last entry in the gamma table is stored as 0x0 to perform proper
+       linear interpolation of the last 8 entries */
+    /* BUG Fix: Last entry in table needs to be 0xffffff for proper linear
+       interpolation */
+    ISET(sst->clutData, (32<<SST_CLUTDATA_INDEX_SHIFT) | 0xffffff);
+
+    sst1InitIdleFBINoNOP(sstbase); /* wait for gamma table writes to complete */
+
+    if(!sst1InitSliEnabled) {
+        /* Return state of video reset to original value */
+        if(sstVideoIsReset == FXTRUE)
+            ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+    }
+
+    if(calledBefore == FXFALSE) {
+        calledBefore = FXTRUE;
+        INIT_PRINTF(("sst1InitGammaRGB() exiting with status %d...\n", FXTRUE));
+    }
+    return(FXTRUE);
+}
+
+#pragma optimize ("",on)
Index: trunk/src/opengl/glide/sst1/init/initvg/gdebug.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/gdebug.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/gdebug.c	(revision 2885)
@@ -0,0 +1,265 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:33 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <stdarg.h>
+#include <string.h>
+
+#ifdef __WIN32__
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include "gdebug.h"
+
+#define GETENV getenv
+
+static char *gdbg_myname = "gd";                // default library name
+static char gdbg_debuglevel[GDBG_MAX_LEVELS];   // array of debuglevel controls
+
+static long gdbg_errors = 0;
+
+static FxBool UseDebugString;
+
+static FILE *gdbg_msgfile = NULL; /*stdout;*/     // GDBG info/error file
+
+//----------------------------------------------------------------------
+// initialize gdbg_level from an environment variable
+//----------------------------------------------------------------------
+static char *setRange(char *buf, int val)
+{
+    int r0,r1,pos;
+
+    sscanf(buf,"%i%n",&r0,&pos);                // parse the first integer
+    if (buf[pos]=='-' || buf[pos]==':')         // if there's a second
+        sscanf(buf+pos+1,"%i%n",&r1,&pos);      // then parse it
+    else
+        r1 = r0;
+
+    if (r0 < 0) r0 = 0;                         // sanity checks
+    if (r1 >= GDBG_MAX_LEVELS) r1 = GDBG_MAX_LEVELS-1;
+    if (r1 < r0) r1 = r0;
+
+    while (r0 <= r1)                            // now set the debuglevel levels
+        gdbg_debuglevel[r0++] = val;
+
+    return buf + pos;                           // and return rest of string
+}
+
+static void parse(char *env)
+{
+    int level, pos;
+
+    do {
+        if (env[0] == ',')              // advance past commas
+            env++;
+        if (env[0] == '+')              // if + then enable a range
+            env = setRange(env+1,1);
+        else if (env[0] == '-')         // if - then disable a range
+            env = setRange(env+1,0);
+        else {                          // else just a number
+            if (EOF == sscanf(env,"%i%n",&level,&pos)) return;
+            if (pos==0) return;         // oops, guess not
+            if (level >= GDBG_MAX_LEVELS) level = GDBG_MAX_LEVELS-1;
+            while (level >= 0)          // enable the range [0,#]
+                gdbg_debuglevel[level--] = 1;
+            env += pos;
+        }
+    } while (env[0] == ',');
+}
+
+void FX_EXPORT FX_CSTYLE
+gdbg_init(void)
+{
+    static int done=0;                  // only execute once
+    char *env;
+
+    if (done) return;
+
+    /* I can't init gdbg_msgfile to stdout since it isn't constant so
+     * I do it now */
+    gdbg_msgfile = stdout;    
+
+    done = 1;
+    gdbg_debuglevel[0] = 1;             // always enable level 0
+    env = GETENV("GDBG_FILE");
+    if (env != NULL) GDBG_SET_FILE(env);
+    env = GETENV("GDBG_LEVEL");
+    if (env == NULL) env = "0";
+    parse(env);
+    gdbg_info(1,"gdbg_init(): debug level = %s\n",env);
+}
+
+void FX_EXPORT FX_CSTYLE
+gdbg_shutdown(void)
+{
+    gdbg_info(1,"gdbg_shutdown()\n");
+    if (gdbg_msgfile != stdout) {       // close any existing output file
+        fclose(gdbg_msgfile);
+        gdbg_msgfile = stdout;
+    }
+}
+
+//----------------------------------------------------------------------
+// the MAIN message display suboutine - ALL messages come thru here
+//----------------------------------------------------------------------
+void FX_EXPORT FX_CSTYLE
+gdbg_vprintf (const char *format,va_list args)
+{
+  
+    if (gdbg_msgfile != NULL) {
+        if (!UseDebugString) {
+
+            vfprintf(gdbg_msgfile,format,args);
+
+            fflush(gdbg_msgfile);   
+        } 
+#ifdef __WIN32__
+        else {
+            char msgString[1024];
+
+            vsprintf(msgString, format, args);
+            OutputDebugString(msgString);
+        }
+#endif
+    }
+}
+
+void FX_EXPORT FX_CSTYLE
+gdbg_printf (const char *format, ...)
+{
+    va_list args;
+
+    va_start(args, format);
+    gdbg_vprintf(format,args);
+    va_end(args);
+}
+
+//----------------------------------------------------------------------
+// INFO message subroutines
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// display an INFO message if level <= debug level and return whether
+// debug level high enough to allow display
+//----------------------------------------------------------------------
+int FX_EXPORT FX_CSTYLE
+gdbg_info (const int level, const char *format, ...)
+{
+    va_list args;
+    char newformat[4095];
+
+    if (!gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level])
+        return(0);
+    va_start(args, format);
+    sprintf(newformat, "%s.%d:\t", gdbg_myname,level);
+    strcat(newformat,format);
+    gdbg_vprintf(newformat,args);
+    va_end(args);
+    return (1);
+}
+
+//----------------------------------------------------------------------
+// same as gdbg_info but does not display INFO header
+//----------------------------------------------------------------------
+int FX_EXPORT FX_CSTYLE
+gdbg_info_more (const int level, const char *format, ...)
+{
+    va_list args;
+
+    if (!gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level])
+        return(0);
+    va_start(args, format);
+    gdbg_vprintf(format,args);
+    va_end(args);
+    return (1);
+}
+
+
+//----------------------------------------------------------------------
+// ALL errors must come thru here, this subroutine adds a preamble
+// and then displays the message and increments the error counter
+//----------------------------------------------------------------------
+void FX_EXPORT FX_CSTYLE
+gdbg_error (const char *kind, const char *format, ...)
+{
+    va_list args;
+
+    char newformat[1024];
+
+    va_start(args, format);
+    sprintf(newformat, "%s error (%s): ", gdbg_myname,kind);
+    strcat(newformat,format);           // add a preamble to message
+    gdbg_vprintf(newformat,args);
+    gdbg_errors++;                      // increment the error counter
+    va_end(args);
+}
+
+// return the error counter
+int FX_EXPORT FX_CSTYLE
+gdbg_get_errors(void)
+{
+    return gdbg_errors;
+}
+
+// return a debuglevel level
+int FX_EXPORT FX_CSTYLE
+gdbg_get_debuglevel(const int level)
+{
+    return gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level];
+}
+
+// set a debuglevel level
+void FX_EXPORT FX_CSTYLE
+gdbg_set_debuglevel(const int level, const int value)
+{
+    gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level] = value;
+}
+
+// open up a new output file
+int FX_EXPORT FX_CSTYLE
+gdbg_set_file(const char *name)
+{
+    FILE *outf;
+
+    if (gdbg_msgfile != stdout) {       // close any existing output file
+        fclose(gdbg_msgfile);
+        gdbg_msgfile = stdout;
+    }
+#ifdef __WIN32__
+    else if (!strcmp(name, "DEBUG")) {
+        gdbg_msgfile = (FILE *) 1;
+        UseDebugString = 1;
+    }
+#endif
+    else {
+        outf = fopen(name,"w");             // open up a new one
+        if (outf) gdbg_msgfile = outf;
+        return outf != NULL;
+    } 
+}
Index: trunk/src/opengl/glide/sst1/init/initvg/gdebug.h
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/gdebug.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/gdebug.h	(revision 2885)
@@ -0,0 +1,68 @@
+/* 
+ * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ * FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ * 
+ * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ * TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ * THE UNITED STATES.  
+ * 
+ * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+ */
+
+#ifndef __GDEBUG_H__
+#define __GDEBUG_H__
+
+/*
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:33 $
+*/
+
+#include <stdarg.h>
+#include <3dfx.h>
+
+#define GDBG_MAX_LEVELS 512
+
+// if debug info turned on then GDBG_INFO does something
+#ifdef GDBG_INFO_ON
+
+#define GDBG_INFO(a) gdbg_info a
+#define GDBG_INFO_MORE(a) gdbg_info_more a
+#define GDBG_PRINTF(a) gdbg_printf a
+
+// otherwise GDBG_INFO does nothing
+#else
+
+#define GDBG_INFO(a)
+#define GDBG_INFO_MORE(a)
+#define GDBG_PRINTF(a)
+
+#endif
+
+#define GDBG_INIT               gdbg_init
+#define GDBG_ERROR              gdbg_error
+#define GDBG_GET_ERRORS         gdbg_get_errors
+#define GDBG_GET_DEBUGLEVEL     gdbg_get_debuglevel
+#define GDBG_SET_DEBUGLEVEL     gdbg_set_debuglevel
+#define GDBG_SET_FILE           gdbg_set_file
+
+FX_ENTRY void FX_CALL gdbg_init(void);
+FX_ENTRY void FX_CALL gdbg_vprintf(const char *format, va_list);
+FX_ENTRY void FX_CALL gdbg_printf(const char *format, ...);
+FX_ENTRY int  FX_CALL gdbg_info(const int level, const char *format, ...);
+FX_ENTRY int  FX_CALL gdbg_info_more(const int level, const char *format, ...);
+FX_ENTRY void FX_CALL gdbg_error(const char *name, const char *format, ...);
+FX_ENTRY int  FX_CALL gdbg_get_errors(void);
+FX_ENTRY int  FX_CALL gdbg_get_debuglevel(const int level);
+FX_ENTRY void FX_CALL gdbg_set_debuglevel(const int level, const int value);
+FX_ENTRY int  FX_CALL gdbg_set_file(const char *name);
+
+#endif /* !__GDEBUG_H__ */
Index: trunk/src/opengl/glide/sst1/init/initvg/info.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/info.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/info.c	(revision 2885)
@@ -0,0 +1,589 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:33 $ 
+**
+** Routines to detect memory size, strapping pin, and other initialization
+** configuration information.
+**
+*/
+#pragma optimize ("",off)
+#include <stdio.h>
+#include <stdlib.h>
+#include <sst.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <sst1vid.h>
+#include <sst1init.h>
+
+#define XY_ONE (1<<SST_XY_FRACBITS)
+
+static FxBool 
+readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, 
+    		FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum)
+{
+    FxU32 rd_x, rd_y;
+    FxU32 rd_col;
+    FxU32 rd_r, rd_g, rd_b;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    /* wait for idle board */
+    ISET(sst->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER);
+    sst1InitIdle(sstbase);
+    if (x & 1) {
+	INIT_PRINTF(("ERROR: readAndSum4x4 must have an even X (%d)\n", x));
+	return(FXFALSE);
+    }
+
+    /* get 16 pixels (4 x 4 array) from frame buffer and sum the colors */
+    *r_sum = 0;
+    *g_sum = 0;
+    *b_sum = 0;
+
+    for (rd_y = 0; rd_y < 4; rd_y++) {		/* read 4 scanlines */
+	for (rd_x = 0; rd_x < 4; rd_x ++) {
+	    if ((rd_x & 1)==0) {		/* read 2 pixels at a time */
+		rd_col =
+		  IGET(sstbase[(SST_LFB_ADDR + (y+rd_y)*2048 + (x+rd_x)*2) >> 2]);
+	    }
+	    else rd_col >>= 16;
+	    rd_r = ((rd_col >> 11) & 0x1f) << 3;
+	    rd_g = ((rd_col >>  5) & 0x3f) << 2;
+	    rd_b = ((rd_col >>  0) & 0x1f) << 3;
+	    *r_sum += rd_r;
+	    *g_sum += rd_g;
+	    *b_sum += rd_b;
+	    INIT_INFO((4,"%d,%d = rd_col: 0x%04x   rgb: %02x %02x %02x\n",
+		    rd_x, rd_y, (rd_col & 0xffff), rd_r, rd_g, rd_b));
+	}
+    }
+    INIT_INFO((3,"sums:  r_sum=0x%03x  g_sum=0x%03x  b_sum=0x%03x\n",
+		    *r_sum, *g_sum, *b_sum));
+	return(FXTRUE);
+}
+
+/* xxx - Give these guys some meaningful comments */
+static FxI32 rb_tbl[0xFFF+1];
+static FxI32 g_tbl[0xFFF+1];
+
+/* draw a right angle triangle */
+static void
+drawTriangle(volatile Sstregs *sst, int x, int y, int tSize)
+{
+    ISET(sst->vA.x,x);
+    ISET(sst->vA.y,y);
+    ISET(sst->vB.x,x+XY_ONE*tSize);
+    ISET(sst->vB.y,y);
+    ISET(sst->vC.x,x);
+    ISET(sst->vC.y,y+XY_ONE*tSize);
+    ISET(sst->s,0);
+    ISET(sst->t,0);
+    ISET(sst->w,0);
+    ISET(sst->dsdx,1<<SST_ST_FRACBITS);
+    ISET(sst->dtdx,0);
+    ISET(sst->dwdx,0);
+    ISET(sst->dsdy,0);
+    ISET(sst->dtdy,1<<SST_ST_FRACBITS);
+    ISET(sst->dwdy,0);
+    ISET(sst->triangleCMD,0);
+}
+
+static FxBool
+initSumTables(FxU32 *sstbase)
+{
+    int x=0,y=0;
+    FxU32 tst_color;
+    FxU32 r_sum, g_sum, b_sum;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    /* init sum array */
+    for (r_sum = 0; r_sum <= 0xfff; r_sum++) {
+	rb_tbl[r_sum] = -1;
+	g_tbl[r_sum] = -1;
+    }
+
+    ISET(sst->fbzColorPath, SST_RGBSEL_C1 | SST_CC_PASS);
+    ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK | SST_ENDITHER);
+
+    /* fill sum array */
+    for (tst_color = 0; tst_color <= 255; tst_color++) {
+	INIT_INFO((2,"tst_color=0x%02x\n", tst_color));
+	ISET(sst->c1, (tst_color << 16) | (tst_color << 8) | tst_color);
+
+	drawTriangle(sst, x,y,36);
+	if(readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum) == FXFALSE)
+		return(FXFALSE);
+
+	/* check sums for uniqueness and then store away */
+	if (r_sum != b_sum) {
+	    INIT_PRINTF(("ERROR:  b_sum=0x%03x  r_sum=0x%03x\n", r_sum, b_sum));
+		return(FXFALSE);
+	}
+	if (rb_tbl[r_sum] != -1) {
+	    INIT_PRINTF(("ERROR:  non-unique r/b_sum=0x%03x\n", r_sum));
+		return(FXFALSE);
+	}
+	rb_tbl[r_sum] = tst_color;
+	if (g_tbl[g_sum] != -1) {
+	    INIT_PRINTF(("ERROR:  non-unique g_sum=0x%03x\n", g_sum));
+		return(FXFALSE);
+	}
+	g_tbl[g_sum] = tst_color;
+    }
+	return(FXTRUE);
+}
+
+/* remove dither to derive actual 24-bit RGB value */
+static FxBool
+unDither(FxU32 r_sum, FxU32 g_sum, FxU32 b_sum, FxU32 *result)
+{
+    if (rb_tbl[r_sum] == -1 || g_tbl[g_sum] == -1 || rb_tbl[b_sum] == -1)
+    {
+	INIT_PRINTF(("ERROR: unDither: invalid color sum\n"));
+	return(FXFALSE);
+    }
+    *result = (rb_tbl[r_sum] << 16) | (g_tbl[g_sum] << 8) | rb_tbl[b_sum];
+	return(FXTRUE);
+}
+
+static FxBool
+getTmuConfigData(FxU32 *sstbase, sst1DeviceInfoStruct *info)
+{
+    int x=0, y=0;
+    FxU32 r_sum, g_sum, b_sum;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    /* set trex's (all 3) to output configuration bits */
+    ISET(SST_TREX(sst,0)->trexInit1, info->tmuInit1[0] | (1 << 18));
+    ISET(SST_TREX(sst,1)->trexInit1, info->tmuInit1[1] | (1 << 18));
+    ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2] | (1 << 18));
+
+    /* render into the frame buffer */
+    ISET(sst->fbzColorPath,
+	  SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
+    ISET(sst->texBaseAddr, 0);
+    ISET(sst->textureMode, SST_AI88 | SST_TC_PASS | SST_TCA_PASS);
+    ISET(sst->tLOD, 0);
+    drawTriangle(sst,x,y,36);
+
+    readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum);
+    if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE)
+		return(FXFALSE);
+	if(GETENV(("SST_TMUCFG")))
+        SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig);
+
+    /* reset trex's init registers */
+    ISET(SST_TREX(sst,0)->trexInit1, info->tmuInit1[0]);
+    ISET(SST_TREX(sst,1)->trexInit1, info->tmuInit1[1]);
+    ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2]);
+
+	return(FXTRUE);
+}
+
+#define SENSE2 0x92F56EB0
+#define SENSE1 0xF2A916B5
+#define SENSE0 0xBADBEEF1
+
+static FxU32 sense(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu,
+		   FxU32 mem, FxU32 init)
+{
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+    FxU32 *texAddr = (tmu<<(21-2)) + (FxU32 *)SST_TEX_ADDRESS(sst);
+
+    /* set the Init0 register to enable ? MBytes of memory */
+    sst1InitIdle(sstbase);
+    ISET(SST_TREX(sst,tmu)->trexInit0, init | (info->tmuInit0[tmu] & ~0x7000));
+    sst1InitIdle(sstbase);
+
+    ISET(sst->texBaseAddr, 0x200000>>3);	/* set to 2 MB */
+    texAddr[0] = SENSE2;		/* write a random value */
+    ISET(sst->texBaseAddr, 0x100000>>3);	/* set to 1 MB */
+    texAddr[0] = SENSE1;		/* write a random value */
+    ISET(sst->texBaseAddr, 0x000000>>3);	/* set to 0 MB */
+    texAddr[0] = SENSE0;		/* write a random value */
+
+    ISET(sst->texBaseAddr, mem>>3);		/* reset to 2 MB */
+    drawTriangle(sst,0,0,4);		/* draw a 4x4 right triangle */
+    sst1InitIdle(sstbase);
+
+    mem = IGET(sstbase[SST_LFB_ADDR>>2]);
+    INIT_INFO((2,"data=0x%08x\n", mem));
+
+    /* reset the Init0 register back to its previous value */
+    sst1InitIdle(sstbase);
+    ISET(SST_TREX(sst,tmu)->trexInit0, info->tmuInit0[tmu]);
+    sst1InitIdle(sstbase);
+    return mem;
+}
+
+FX_EXPORT FxBool FX_CSTYLE
+sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu,
+	FxU32 *TmuMemorySize)
+{
+    FxU32 i,data;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    INIT_INFO((1,"sst1InitGetTmuMemory(0x%x, , %d)\n", sstbase,tmu));
+
+	if(GETENV(("SST_TMUMEM_SIZE"))) {
+		*TmuMemorySize = ATOI(GETENV(("SST_TMUMEM_SIZE")));
+		return(FXTRUE);
+	}
+
+    ISET(sst->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER);
+    ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK);
+    ISET(sst->fbzColorPath,
+	  SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
+    ISET(sst->textureMode, SST_RGB565 | SST_TC_REPLACE | SST_TCA_REPLACE);
+    ISET(sst->tLOD, 0);
+
+    /* setup all downstream TMUs to be in pass-thru mode */
+    for (i=0; i<tmu; i++)
+	ISET(SST_TREX(sst,i)->textureMode, SST_TC_PASS | SST_TCA_PASS);
+
+    /* first see if we have 4 Mbytes by writing a texel at 2MB followed by
+       a texel at 1MB and 0MB and then rendering using the texel at 2MB
+       if we have less memory it should not render correctly since we trash
+       the memory locations it would wrap to
+    */
+
+    data = sense(sstbase,info,tmu,0x200000, 0x5000);
+    if (data == SENSE2) {*TmuMemorySize = 4; return(FXTRUE);}
+
+    /* set the Init0 register to enable 2 MBytes of memory and repeat test */
+    data = sense(sstbase,info,tmu,0x100000, 0x2000);
+    if (data == SENSE1) {*TmuMemorySize = 2; return(FXTRUE);}
+
+    /* set the Init0 register to enable 1 MBytes of memory and repeat test */
+    data = sense(sstbase,info,tmu,0x000000, 0x2000);
+    if (data == SENSE0) {*TmuMemorySize = 1; return(FXTRUE);}
+
+    INIT_PRINTF(("sst1InitGetTmuMemory() ERROR: Could not detect memory size.\n"));
+	return(FXFALSE);
+}
+
+/*---------------------------------------------------------------------------
+   NOTES:
+  	assumes that board and registers are initialized
+  	destroys part of the framebuffer
+  ---------------------------------------------------------------------------*/
+FX_EXPORT FxBool FX_CSTYLE
+sst1InitGetTmuInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info)
+{
+    FxU32 trev;
+
+    if(initSumTables(sstbase) == FXFALSE)
+		return(FXFALSE);
+    if(getTmuConfigData(sstbase,info) == FXFALSE)
+		return(FXFALSE);
+
+	/* TMU memory speed */
+	/* tmuClkFixed is no longer used... */
+	info->tmuClkFixed = 0x0;
+	/* tmuMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */
+	info->tmuMemSpeed = 0;
+
+    /* count the TMUs and verify that all TMUs are the same revision */
+    info->tmuRevision = info->tmuConfig & 0x7;
+    info->numberTmus = 1;
+    if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) == FXFALSE)
+		return(FXFALSE);
+    INIT_INFO((1,"TMU0 memory = %d MB\n", info->tmuMemSize[0]));
+    if (info->tmuConfig & FXBIT(6)) {		/* if TMU 1 exists */
+	info->numberTmus++;			/* increment TMU count */
+	trev = (info->tmuConfig>>7) & 0x7;	/* get its revision */
+	if (info->tmuRevision != trev) {
+	    INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));
+	    return(FXFALSE);
+	}
+    if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE)
+		return(FXFALSE);
+    }
+    if (info->tmuConfig & FXBIT(13)) {		/* if TMU 2 exists */
+	info->numberTmus++;			/* increment TMU count */
+	trev = (info->tmuConfig>>14) & 0x7;	/* get its revision */
+	if (info->tmuRevision != trev) {
+	    INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));
+	    return(FXFALSE);
+	}
+    if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE)
+		return(FXFALSE);
+    }
+    INIT_INFO((1,"numberTMus = %d\n", info->numberTmus));
+    return(FXTRUE);
+}
+
+/*
+** fbiMemSize():
+**  Returns size (in MBytes) of FBI frame buffer memory
+**  Returns 0 on error
+**  NOTE: fbiMemSize() destroys the contents in memory
+**
+*/
+#define LFB_PUTPIXEL(X, Y, DATA)	\
+	ISET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)], DATA)
+#define LFB_GETPIXEL(X, Y)			\
+	IGET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)])
+
+static int fbiMemSize(FxU32 *sstbase)
+{
+	volatile Sstregs *sst = (Sstregs *) sstbase;
+	volatile unsigned short *lfbptr = (unsigned short *) sstbase;
+	FxU32 init0Save = IGET(sst->fbiInit0);
+	FxU32 init1Save = IGET(sst->fbiInit1);
+	FxU32 init2Save = IGET(sst->fbiInit2);
+	int retval = 0;
+
+	if(GETENV(("SST_FBIMEM_SIZE")))
+		return(ATOI(GETENV(("SST_FBIMEM_SIZE"))));
+
+	/* Enable dram refresh, disable memory fifo, and setup memory */
+	/* for rendering */
+	ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN);
+    ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH);
+	sst1InitIdleFBI(sstbase);
+
+	/* Setup Basic rendering datapath */
+	ISET(sst->fbzColorPath, SST_CC_MONE);
+	ISET(sst->fogMode, 0x0);
+	ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK | SST_DRAWBUFFER_FRONT);
+	sst1InitIdleFBI(sstbase);
+
+	if(sst1InitSliDetect(sstbase))
+		/* SLI cannot support 4 MBytes... */
+		goto check2MByte;
+    sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1);
+	sst1InitIdleFBI(sstbase);
+
+	ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER |
+		SST_LFB_READDEPTHABUFFER);
+	sst1InitIdleFBI(sstbase);
+
+	/* Check for 4 MBytes... */
+	/* Write to Zbuffer in 800x600 resolution in upper 2 MBytes of memory */
+	LFB_PUTPIXEL(128, 100, 0xdead);	/* maps to row:0x216, col:0x80, bank:0x1 */
+	LFB_PUTPIXEL(0, 0, 0x0);
+	LFB_PUTPIXEL(798, 599, 0xffff);
+	LFB_PUTPIXEL(200, 200, 0x55aa);	/* maps to row:0x23d, col:0x104, bank:0x0 */
+	LFB_PUTPIXEL(20, 20, 0xffff);
+	LFB_PUTPIXEL(400, 400, 0x0);
+	sst1InitIdleFBI(sstbase);
+	if((LFB_GETPIXEL(128, 100) == 0xdead) &&
+	   (LFB_GETPIXEL(200, 200) == 0x55aa)) {
+   		retval = 4;
+		ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));
+		sst1InitIdleFBI(sstbase);
+		goto fbiMemSizeDone;
+	}
+
+check2MByte:
+	/* Check for 2 MBytes... */
+	/* Write to color buffer in 640x480 resolution */
+    sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0);
+	ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |
+		SST_LFB_READFRONTBUFFER);
+	sst1InitIdleFBI(sstbase);
+	LFB_PUTPIXEL(50, 100, 0xdead);	/* maps to row:0x1e, col:0x99, bank:0x0 */
+	LFB_PUTPIXEL(0, 0, 0x0);
+	LFB_PUTPIXEL(638, 479, 0xffff);
+	ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEBACKBUFFER |
+		SST_LFB_READFRONTBUFFER);
+	sst1InitIdleFBI(sstbase);
+	LFB_PUTPIXEL(178, 436, 0xaa55);	/* maps to row:0x11e, col:0x99, bank:0x0 */
+	LFB_PUTPIXEL(20, 20, 0x0);
+	LFB_PUTPIXEL(400, 400, 0xffff);
+	sst1InitIdleFBI(sstbase);
+	if(LFB_GETPIXEL(50, 100) != 0xdead)
+		goto check1MByte;
+	ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));
+	sst1InitIdleFBI(sstbase);
+	if(LFB_GETPIXEL(178, 436) == 0xaa55) {
+   		retval = 2;
+		goto fbiMemSizeDone;
+	}
+
+check1MByte:
+	ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |
+		SST_LFB_READFRONTBUFFER);
+	sst1InitIdleFBI(sstbase);
+	LFB_PUTPIXEL(10, 10, 0xdead);	/* maps to row:0x0, col:0x145, bank:0x0 */
+	LFB_PUTPIXEL(8, 8, 0x0);
+	LFB_PUTPIXEL(340, 340, 0xffff);
+	LFB_PUTPIXEL(100, 200, 0x5a5a);	/* maps to row:0x3c, col:0x112, bank:0x1 */
+	LFB_PUTPIXEL(66, 0, 0x0);
+	LFB_PUTPIXEL(360, 360, 0xffff);
+	sst1InitIdleFBI(sstbase);
+	if((LFB_GETPIXEL(10, 10) == 0xdead) &&
+	   (LFB_GETPIXEL(100, 200) == 0x5a5a))
+   		retval = 1;
+
+fbiMemSizeDone:
+	/* Restore init registers to original state */
+	ISET(sst->fbiInit0, init0Save);
+	ISET(sst->fbiInit1, init1Save);
+	ISET(sst->fbiInit2, init2Save);
+	sst1InitIdleFBI(sstbase);
+
+	return(retval);
+}
+
+FX_EXPORT FxBool FX_CSTYLE
+sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info)
+{
+	volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    info->fbiMemSize = fbiMemSize(sstbase);
+
+	/* Detect board identification and memory speed */
+	if(GETENV(("SST_FBICFG")))
+        SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig);
+    else
+		info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >>
+			SST_FBI_MEM_TYPE_SHIFT;
+
+	info->fbiBoardID = (info->fbiConfig >> 2) & 0x1;
+	/* fbiMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */
+	info->fbiMemSpeed = 0;
+
+	/* Detect scanline interleaving */
+	info->sstSliDetect = sst1InitSliDetect(sstbase);
+
+    return FXTRUE;
+}
+
+/*
+** sst1InitGetDeviceInfo():
+**  Read device specific information
+**  NOTE: info pointer must point to an Info structure which has already
+**        been allocated
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitGetDeviceInfo(FxU32 *sstbase,
+  sst1DeviceInfoStruct *info)
+{
+    FxBool retval;
+
+    if((retval = sst1InitCheckBoard(sstbase)) == FXTRUE)
+        *info = *sst1CurrentBoard;
+    return(retval);
+}
+
+/*
+** sst1InitFillDeviceInfo():
+**  Fill in device information
+**  NOTE: This routine destroys current contents in frame buffer memory
+**
+**
+*/
+FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info)
+{
+    if(!sstbase)
+        return(FXFALSE);
+
+    if(info->tmuRevision != 0xdead)
+        return FXTRUE;  /* if already got it, return */
+
+    if(GETENV(("SST_NODEVICEINFO"))) {
+        /* fill device info struct with sane values... */
+    	INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n"));
+
+		if(GETENV(("SST_FBICFG")))
+        	SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig);
+		else
+	        info->fbiConfig = 0x0;
+
+		if(GETENV(("SST_TMUCFG")))
+        	SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig);
+		else
+	        info->tmuConfig = 0x0;
+
+        info->numberTmus = 1;
+    	if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */
+			info->numberTmus++;
+	    if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */
+			info->numberTmus++;
+
+    	info->tmuRevision = info->tmuConfig & 0x7;
+
+		if(GETENV(("SST_FBIMEM_SIZE")))
+			info->fbiMemSize = ATOI(GETENV(("SST_FBIMEM_SIZE")));
+		else
+	        info->fbiMemSize = 2;
+
+		if(GETENV(("SST_TMUMEM_SIZE")))
+			info->tmuMemSize[0] = ATOI(GETENV(("SST_TMUMEM_SIZE")));
+		else
+        	info->tmuMemSize[0] = 2;
+		info->tmuMemSize[1] = info->tmuMemSize[0];
+		info->tmuMemSize[2] = info->tmuMemSize[0];
+    } else {
+		int i;
+
+		for(i=0; i<5; i++) {
+			if(i)
+				INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i));
+        	/* GetFbiInfo() must be called before GetTmuInfo() */
+	        if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE)
+				continue;
+	        /* get the revision ID of each TMU and verify that they are all the
+			   same */
+	        if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE)
+				continue;
+			break;
+		}
+		if(i == 5)
+			return(FXFALSE);
+    }
+    INIT_PRINTF(("sst1DeviceInfo: Board ID: Obsidian %s\n",
+        (info->fbiBoardID) ? "PRO" : "GE"));
+    INIT_PRINTF(("sst1DeviceInfo: FbiConfig:0x%x, TmuConfig:0x%x\n",
+        info->fbiConfig, info->tmuConfig));
+    INIT_PRINTF(("sst1DeviceInfo: FBI Revision:%d, TMU Revison:%d, Num TMUs:%d\n",
+        info->fbiRevision, info->tmuRevision, info->numberTmus));
+    INIT_PRINTF(("sst1DeviceInfo: FBI Memory:%d, TMU[0] Memory:%d",
+        info->fbiMemSize, info->tmuMemSize[0]));
+    if(info->numberTmus > 1)
+        INIT_PRINTF((", TMU[1] Memory:%d", info->tmuMemSize[1]));
+    if(info->numberTmus > 2)
+        INIT_PRINTF((", TMU[2] Memory:%d", info->tmuMemSize[2]));
+    INIT_PRINTF(("\n"));
+    if(sst1InitUseVoodooFile == FXTRUE) {
+        if(iniDac == (sst1InitDacStruct *) NULL)
+			INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown"));
+		else
+	    	INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n", 
+			  iniDac->dacManufacturer, iniDac->dacDevice));
+	} else {
+	    INIT_PRINTF(("sst1DeviceInfo: Dac Type: "));
+	    if(info->fbiDacType == SST_FBI_DACTYPE_ATT)
+	        INIT_PRINTF(("AT&T ATT20C409\n"));
+	    else if(info->fbiDacType == SST_FBI_DACTYPE_ICS)
+	        INIT_PRINTF(("ICS ICS5342\n"));
+	    else if(info->fbiDacType == SST_FBI_DACTYPE_TI)
+	        INIT_PRINTF(("TI TVP3409\n"));
+	    else
+	        INIT_PRINTF(("Unknown\n"));
+	}
+    INIT_PRINTF(("sst1DeviceInfo: SliDetect:%d\n", info->sstSliDetect));
+
+    return(FXTRUE);
+}
+#pragma optimize ("",on)
Index: trunk/src/opengl/glide/sst1/init/initvg/init.rc
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/init.rc	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/init.rc	(revision 2885)
@@ -0,0 +1,68 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/init/initvg/Attic/init.rc,v 1.1 2000-02-25 00:31:33 sandervl Exp $
+** $Log: init.rc,v $
+** Revision 1.1  2000-02-25 00:31:33  sandervl
+** Created new Voodoo 1 Glide dir
+**
+*/
+
+#define OFFICIAL   1 
+#define FINAL      1 
+
+#include <fxver.h>
+#include "rcver.h"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+#define VERSIONNAME             "sst1init.dll\0"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
+ PRODUCTVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
+ FILEFLAGSMASK 0x0030003FL
+ FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
+
+ FILEOS VOS_DOS_WINDOWS32
+ FILETYPE VFT_DRV
+ FILESUBTYPE VFT2_DRV_INSTALLABLE
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904E4"
+        BEGIN
+            VALUE "CompanyName", "3Dfx Interactive, Inc.\0"
+            VALUE "FileDescription", "3Dfx Interactive, Inc. InitCode DLL\0"
+            VALUE "FileVersion", VERSIONSTR
+            VALUE "InternalName", VERSIONNAME
+            VALUE "LegalCopyright", "Copyright \251 3Dfx Interactive, Inc. 1996\0"
+            VALUE "OriginalFilename", VERSIONNAME
+            VALUE "ProductName", "InitCode for Voodoo Graphics\251 and Windows\256  95\0"
+            VALUE "ProductVersion", VERSIONSTR
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        /* the following line should be extended for localized versions */
+        VALUE "Translation", 0x409, 1252
+    END
+END
Index: trunk/src/opengl/glide/sst1/init/initvg/makefile
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/makefile	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/makefile	(revision 2885)
@@ -0,0 +1,38 @@
+# $Id: makefile,v 1.1 2000-02-25 00:31:33 sandervl Exp $
+#
+# PD-Win32 API
+#
+#       Glide makefile
+#
+
+PDWIN32_INCLUDE = ..\..\..\..\..\..\include
+PDWIN32_LIB = ..\..\..\..\..\..\lib
+PDWIN32_BIN = ..\..\..\..\..\..\bin
+PDWIN32_TOOLS = ..\..\..\..\..\..\tools\bin
+
+!include $(PDWIN32_INCLUDE)/pdwin32.mk
+!include ..\..\3dfx.mak
+
+CINCLUDE=-I..\..\incsrc;..\..\..\swlibs\fxmisc;..\..\init;..\..\glide;..\..\texus;..\..\..\swlibs\pcilib
+
+CFLAGS = $(CFLAGS) $(CINCLUDE)
+CXXFLAGS = $(CXXFLAGS) $(CINCLUDE)
+
+OBJS =	DAC.OBJ         GAMMA.OBJ       GDEBUG.OBJ      INFO.OBJ        PARSE.OBJ \
+	PRINT.OBJ       SLI.OBJ         SST1INIT.OBJ    UTIL.OBJ        VIDEO.OBJ
+
+all: $(OBJS)
+
+dep:
+    $(DEPEND) -I$(PDWIN32_INCLUDE);$(PDWIN32_INCLUDE)\win $(CINCLUDE) \
+        *.c *.cpp *.h *.asm *.inc $(PDWIN32_INCLUDE)\*.h \
+        ..\..\incsrc\*.h ..\..\..\swlibs\fxmisc\*.h ..\*.h ..\..\glide\*.h ..\..\texus\*.h ..\..\..\swlibs\pcilib\*.h 
+
+!ifndef NODEP
+!include .depend
+!endif
+
+clean:
+    $(RM) *.obj *.pch
+    $(RM) *.lib
+
Index: trunk/src/opengl/glide/sst1/init/initvg/makefile.new
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/makefile.new	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/makefile.new	(revision 2885)
@@ -0,0 +1,53 @@
+#
+# THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+# PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+# TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+# INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+# DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+# THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+# EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+# FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+# 
+# USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+# RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+# TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+# AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+# SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+# THE UNITED STATES.  
+# 
+# COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+#
+# $Revision: 1.1 $
+# $Date: 2000-02-25 00:31:34 $
+#
+
+# local defines, options, includes
+LCDEFS   = -DGDBG_INFO_ON -DINIT_DOS
+LCOPTS   = -WX
+LCINCS	 = -I$(BUILD_ROOT_SWLIBS)\include -I$(BUILD_ROOT_SST1)\include
+
+!if "$(FX_SST96_PAGE_FIFO)" != "1"
+LCDEFS          = $(LCDEFS) -DSST96_ALT_FIFO_WRAP
+!endif
+
+# sources
+HEADERS	            = sst1init.h gdebug.h
+INSTALL_DESTINATION = $(BUILD_ROOT_SST1)
+CFILES	            = sst1init.c info.c print.c parse.c gamma.c util.c \
+                      sli.c video.c dac.c gdebug.c
+
+!if "$(FX_DLL_BUILDSST1INIT)" == "1"
+SUBLIBRARIES        = $(BUILD_ROOT_SWLIBS)\lib\fxpci.lib 
+FX_DLL_LIBRARY = 1
+!else
+SUBLIBRARIES        = 
+!endif
+
+# targets
+LIBRARIES      = sst1init.lib
+RCFILE         = init.rc
+
+!include $(BUILD_ROOT_SWLIBS)/include/nmake/3dfx.mak
+
+init.res: rcver.h
+sst1init.obj: rcver.h
Index: trunk/src/opengl/glide/sst1/init/initvg/makefile.os2
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/makefile.os2	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/makefile.os2	(revision 2885)
@@ -0,0 +1,10 @@
+include "\glide\3dfxos2.mak"
+
+OBJS =	DAC.OBJ         GAMMA.OBJ       GDEBUG.OBJ      INFO.OBJ        PARSE.OBJ \
+	PRINT.OBJ       SLI.OBJ         SST1INIT.OBJ    UTIL.OBJ        VIDEO.OBJ
+
+
+all: $(OBJS)
+
+clean:
+        del *.obj
Index: trunk/src/opengl/glide/sst1/init/initvg/makefile.unix
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/makefile.unix	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/makefile.unix	(revision 2885)
@@ -0,0 +1,56 @@
+#
+# THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+# PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+# TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+# INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+# DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+# THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+# EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+# FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+# 
+# USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+# RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+# TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+# AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+# SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+# THE UNITED STATES.  
+# 
+# COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+#
+# $Revision: 1.1 $
+# $Date: 2000-02-25 00:31:34 $
+#
+
+# local defines, options, includes
+LCDEFS	 = -DGDBG_INFO_ON -DINIT_LINUX
+LCOPTS   =
+LCINC    = -I$(BUILD_ROOT_SWLIBS)/include -I$(BUILD_ROOT_SST1)/include
+
+ifeq ($(FX_SST96_PAGE_FIFO),1)
+LCDEFS	+= -DSST96_ALT_FIFO_WRAP
+endif
+
+# sources
+HEADERS	            = sst1init.h gdebug.h
+INSTALL_DESTINATION = $(BUILD_ROOT_SST1)
+CFILES	            = sst1init.c info.c print.c parse.c gamma.c util.c \
+                      sli.c video.c dac.c gdebug.c
+
+ifeq ($(FX_DLL_BUILDSST1INIT),1)
+SUBLIBRARIES    = $(BUILD_ROOT_SWLIBS)/lib/libfxpci.a
+else
+SUBLIBRARIES	=
+endif
+
+# targets
+LIBRARIES      = libsst1.a
+
+include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak
+
+#
+# This library must be compiled without the big optimization options
+# for some strange reason
+#
+ifndef DEBUG
+CFLAGS = -O -m486 -fomit-frame-pointer $(LCDEFS) $(LCOPTS) $(LCINC)
+endif
Index: trunk/src/opengl/glide/sst1/init/initvg/parse.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/parse.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/parse.c	(revision 2885)
@@ -0,0 +1,917 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:34 $ 
+**
+** Parsing code for grabbing information from "voodoo.ini" initialization file
+**
+*/
+#pragma optimize ("",off)
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <malloc.h>
+#include <3dfx.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <sst1vid.h>
+#include <sst1init.h>
+
+static int sst1InitFgets(char *, FILE *);
+static int sst1InitFgetc(FILE *);
+static int sst1InitParseFieldDac(char *);
+static int sst1InitParseFieldCfg(char *);
+static int sst1InitParseDacRdWrString(char *, sst1InitDacStruct *);
+static int sst1InitParseDacRdWr(char *, sst1InitDacRdWrStruct *);
+static int sst1InitParseSetVideoString(char *, sst1InitDacStruct *);
+static int sst1InitParseSetMemClkString(char *, sst1InitDacStruct *);
+static int sst1InitParseSetVideoModeString(char *, sst1InitDacStruct *);
+static void sst1InitPrintDacRdWr(sst1InitDacRdWrStruct *, char *);
+static void sst1InitToLower(char *string);
+static void sst1InitFixFilename(char *dst, char *src);
+
+#ifndef INIT_LINUX
+/*
+** sst1InitVoodooFile():
+**  Find and setup "voodoo.ini" file if possible
+**
+**    Returns:
+**      FxTRUE if "voodoo.ini" file is found and opened with no errors
+**      FXFALSE if cannot find file or error opening file
+**
+*/
+FX_ENTRY FxBool FX_CALL sst1InitVoodooFile()
+{
+#ifndef __DOS32__
+    return(FXFALSE);
+#else
+    char filename[256], fixedFilename[512], *tmpPtr;
+    char path[512];
+    FILE *file = (FILE *) NULL;
+    char buffer[1024];
+    int inCfg, inDac;
+    int i;
+    int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+
+    if(getenv("VOODOO_FILE")) {
+        /* Override voodoo.ini name */
+        strcpy(filename, getenv("VOODOO_FILE"));
+        if(!(file = fopen(filename, "r")))
+            return(FXFALSE);
+    } else {
+        /* Override path setting */
+        if(getenv("VOODOO_PATH"))
+          strcpy(path, getenv("VOODOO_PATH"));
+        else if(getenv("PATH")) {
+            strcpy(path, ".;");
+            strcat(path, getenv("PATH"));
+        } else
+            strcpy(path, ".;");
+
+        i = 0;
+        while(1) {
+            if(!i) {
+                if((tmpPtr = strtok(path, ";")) == NULL)
+                    break;
+            } else {
+                if((tmpPtr = strtok(NULL, ";")) == NULL)
+                    break;
+            }
+            strcpy(filename, tmpPtr);
+            sst1InitFixFilename(fixedFilename, filename);
+            if(fixedFilename[strlen(fixedFilename)-1] == '\\')
+                sprintf(filename, "%svoodoo.ini", filename);
+            else
+                sprintf(filename, "%s\\voodoo.ini", filename);
+            i++;
+            if((file = fopen(filename, "r")))
+                break;
+        }
+    }
+    if(file == (FILE *) NULL)
+        return(FXFALSE);
+
+    inCfg = inDac = 0;
+    while(sst1InitFgets(buffer, file)) {
+        buffer[strlen(buffer)-1] = (char) NULL;
+        if(!strcmp(buffer, "[CFG]")) {
+            inCfg = 1; inDac = 0;
+            continue;
+        } else if (!strcmp(buffer, "[DAC]")) {
+            inCfg = 0; inDac = 1;
+            continue;
+        } else if(buffer[0] == '[') {
+            inCfg = 0; inDac = 0;
+            continue;
+        }
+        if(inCfg) {
+            if(!sst1InitParseFieldCfg(buffer)) {
+                if(helper)
+                    INIT_PRINTF(("sst1InitVoodooFile(): ERROR in [CFG] section of .ini file...\n"));
+                return(FXFALSE);
+            }
+        } else if(inDac) {
+            if(!sst1InitParseFieldDac(buffer)) {
+                if(helper)
+                    INIT_PRINTF(("sst1InitVoodooFile(): ERROR in [DAC] section of .ini file...\n"));
+                return(FXFALSE);
+            }
+        }
+    }
+    fclose(file);
+    INIT_PRINTF(("sst1Init Routines(): Using Initialization file '%s'\n", filename));
+
+    return(FXTRUE);
+#endif
+}
+
+#else
+
+/*
+** sst1InitVoodooFile():
+**  Find and setup "voodoo2.ini" file if possible
+**
+**    Returns:
+**      FxTRUE if "voodoo2.ini" file is found, opened with no errors, and
+**             constains the dac programming data.
+**      FXFALSE if cannot find file, error opening file, or has no dac data in it.
+**
+*/
+FX_ENTRY FxBool FX_CALL sst1InitVoodooFile() {
+  static FxBool retVal = FXFALSE;
+  int inCfg, inDac;
+  FILE *file = 0;
+  char buffer[1024], filename[256];
+  char *tmpPtr;
+  char path[512];
+  int i;
+  int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+
+  if (getenv("VOODOO_FILE")) {
+    /* Override voodoo.ini name */
+    strcpy(filename, getenv("VOODOO_FILE"));
+    if (!(file = fopen(filename, "r"))) 
+      goto __errExit;
+  } else {
+    /* Override path setting */
+    if (getenv("VOODOO_PATH")) {
+      strcpy(path, getenv("VOODOO_PATH"));
+    } else {
+      strcpy(path, "/etc/conf.3dfx");
+    }
+
+    i = 0;
+    while(1) {
+      if (!i) {
+	if ((tmpPtr = strtok(path, ":")) == NULL)
+	  break;
+      } else {
+	if ((tmpPtr = strtok(NULL, ":")) == NULL)
+	  break;
+      }
+      strcpy(filename, tmpPtr);
+      if (filename[strlen(filename)-1] == '\\')
+	sprintf(filename, "%voodoo", filename);
+      else
+	sprintf(filename, "%s/voodoo", filename);
+      i++;
+      if ((file = fopen(filename, "r")))
+	break;
+    }
+  }
+  if (!file) {
+    retVal = FXFALSE;
+    goto __errExit;
+  }
+  while(sst1InitFgets(buffer, file)) {
+    buffer[strlen(buffer)-1] = 0;
+    if (buffer[0]=='#') continue;
+    if (!sst1InitParseFieldCfg(buffer)) {
+      retVal = FXFALSE;
+      break;
+    }
+  }
+  INIT_PRINTF(("sst1Init Routines(): Using Initialization file '%s'\n", filename));
+
+__errExit:
+  if (file) fclose(file);
+
+  return retVal;
+}
+#endif
+
+#if __WIN32__
+#include <windows.h>
+#endif /* __WIN32__ */
+
+/* Get the definition of myGetenv for glide builds */
+#include <init.h>
+
+/* void main(int argc, char **argv) */
+static void foo(int argc, char **argv)
+{
+    char buffer[2048]; /* buffer for command line inputs */
+    int inCfg, inDac;
+    sst1InitEnvVarStruct *envVarsPtr;
+    sst1InitDacStruct *dacPtr;
+    sst1InitDacSetVideoStruct *setVideo;
+    sst1InitDacSetMemClkStruct *setMemClk;
+    FILE *file = fopen(argv[1], "r");
+
+    inCfg = inDac = 0;
+    while(sst1InitFgets(buffer, file)) {
+        buffer[strlen(buffer)-1] = (char) NULL;
+        if(!strcmp(buffer, "[CFG]")) {
+            inCfg = 1; inDac = 0;
+            continue;
+        } else if (!strcmp(buffer, "[DAC]")) {
+            inCfg = 0; inDac = 1;
+            continue;
+        } else if(buffer[0] == '[') {
+            inCfg = 0; inDac = 0;
+            continue;
+        }
+        if(inCfg) {
+            if(!sst1InitParseFieldCfg(buffer))
+                /* Error processing .ini file */
+                exit(1);
+        } else if(inDac) {
+            if(!sst1InitParseFieldDac(buffer))
+                /* Error processing .ini file */
+                exit(1);
+        }
+    }
+
+    /* Dump CFG Data... */
+    envVarsPtr = envVarsBase;
+    while(envVarsPtr) {
+        printf("ENV VAR:%s  VALUE:%s\n", envVarsPtr->envVariable,
+            envVarsPtr->envValue);
+        envVarsPtr = (sst1InitEnvVarStruct *) envVarsPtr->nextVar;
+    }
+
+    /* Dump Dac Data... */
+    dacPtr = dacStructBase;
+    while(dacPtr) {
+        printf("DAC MANU:%s  DEVICE:%s\n", dacPtr->dacManufacturer,
+            dacPtr->dacDevice);
+        if(dacPtr->detect) {
+            printf("\tDetect:\n");
+            sst1InitPrintDacRdWr(dacPtr->detect, "\t\t");
+        }
+        if(dacPtr->setVideo) {
+            setVideo = (sst1InitDacSetVideoStruct *)dacPtr->setVideo;
+            while(1) {
+                printf("\tsetVideo (%dx%d @ %d Hz)\n",
+                  setVideo->width, setVideo->height, setVideo->refresh);
+                sst1InitPrintDacRdWr(setVideo->setVideoRdWr, "\t\t");
+                if(!setVideo->nextSetVideo)
+                    break;
+                else
+                    setVideo = (sst1InitDacSetVideoStruct *)setVideo->nextSetVideo;
+            }
+        }
+        if(dacPtr->setMemClk) {
+            setMemClk = dacPtr->setMemClk;
+            while(1) {
+                printf("\tsetMemClk (%d MHz)\n", setMemClk->frequency);
+                sst1InitPrintDacRdWr(setMemClk->setMemClkRdWr, "\t\t");
+                if(!setMemClk->nextSetMemClk)
+                    break;
+                else
+                    setMemClk = (sst1InitDacSetMemClkStruct *)setMemClk->nextSetMemClk;
+            }
+        }
+        dacPtr = (sst1InitDacStruct *)dacPtr->nextDac;
+    }
+    fclose(file);
+}
+
+static void sst1InitFixFilename(char *dst, char *src)
+{
+    while(*src) {
+        *dst++ = *src;
+        if(*src == '\\')
+            *dst++ = *src;
+        src++;
+    }
+    *dst = (char) NULL;
+}
+
+
+static int sst1InitFgets(char *string, FILE *stream)
+{
+    int validChars = 0;
+    char *ptr = string;
+    int charRead;
+
+    while((charRead = sst1InitFgetc(stream))) {
+        *ptr++ = (char) charRead;
+        validChars++;
+        if(charRead == '\n') {
+            *ptr++ = (char) NULL;
+            break;
+        }
+    }
+    return(validChars);
+}
+
+static int sst1InitFgetc(FILE *stream)
+{
+    static int column = 0;
+    static int validChars = 0;
+    int charRead, charReadL;
+    int inComment;
+
+    inComment = 0;
+    while(1) {
+        charRead = fgetc(stream);
+        if(inComment == 1) {
+            if(charRead <= 0)
+                return(0);
+            else if(charRead == '\n')
+                inComment = 0;
+            column = 0;
+            validChars = 0;
+            continue;
+        } else if(column == 0 && charRead == '#') {
+            /* Comment line */
+            inComment = 1;
+            column = 0;
+            validChars = 0;
+        } else if(charRead <= 0) {
+                return(0);
+        } else {
+            if(charRead == '\n') {
+                if(validChars > 0) {
+                    validChars = 0;
+                    column = 0;
+                    return(charRead);
+                } else
+                    continue;
+            } else {
+                if(isspace(charRead))
+                    continue;
+                validChars++;
+                column++;
+                charReadL = (islower(charRead)) ? toupper(charRead) : charRead;
+                return(charReadL);
+            }
+        }
+    }
+}
+
+static int sst1InitParseFieldCfg(char *string)
+{
+    char *envName, *envVal;
+    sst1InitEnvVarStruct *envVarsPtr;
+
+    if((envName = strtok(string, "=")) == NULL)
+        return(0);
+    if((envVal = strtok((char *) NULL, "=")) == NULL)
+        /* Valid environment variable, NULL value */
+        return(1);
+    sst1InitToLower(envVal);
+
+    if(envVarsBase == (sst1InitEnvVarStruct *) NULL) {
+        if((envVarsPtr = (sst1InitEnvVarStruct *)malloc(sizeof(sst1InitEnvVarStruct))) ==
+          (sst1InitEnvVarStruct *) NULL)
+            return(0);
+        envVarsBase = envVarsPtr;
+    } else {
+        envVarsPtr = envVarsBase;
+        while(1) {
+            if(envVarsPtr->nextVar == (sst1InitEnvVarStruct *) NULL)
+                break;
+            else
+               envVarsPtr = (sst1InitEnvVarStruct *) envVarsPtr->nextVar;
+        }
+        if((envVarsPtr->nextVar = malloc(sizeof(sst1InitEnvVarStruct))) ==
+           (sst1InitEnvVarStruct *) NULL)
+            return(0);
+        envVarsPtr = (sst1InitEnvVarStruct *) envVarsPtr->nextVar;
+    }
+    envVarsPtr->nextVar = (sst1InitEnvVarStruct *) NULL;
+    strcpy(envVarsPtr->envVariable, envName);
+    strcpy(envVarsPtr->envValue, envVal);
+
+    return(1);
+}
+
+static int sst1InitParseFieldDac(char *string)
+{
+    char *dacFieldReference, *dacFieldValue;
+    static sst1InitDacStruct *dacPtr = (sst1InitDacStruct *) NULL;
+
+    if((dacFieldReference = strtok(string, "=")) == NULL)
+        return(0);
+    if(!strcmp(dacFieldReference, "MANUFACTURER")) {
+        /* Add new dac device */
+        if(dacStructBase == (sst1InitDacStruct *) NULL) {
+            if((dacPtr = (sst1InitDacStruct *) malloc(sizeof(sst1InitDacStruct))) ==
+              (sst1InitDacStruct *) NULL)
+                return(0);
+            dacStructBase = dacPtr;
+        } else {
+            dacPtr = (sst1InitDacStruct *) dacStructBase;
+            while(1) {
+                if(dacPtr->nextDac == (sst1InitDacStruct *) NULL)
+                    break;
+                else
+                   dacPtr = (sst1InitDacStruct *) dacPtr->nextDac;
+            }
+                if((dacPtr->nextDac = malloc(sizeof(sst1InitDacStruct))) ==
+               (sst1InitDacStruct *) NULL)
+                return(0);
+            dacPtr = (sst1InitDacStruct *) dacPtr->nextDac;
+        }
+        dacPtr->nextDac = (sst1InitDacStruct *) NULL;
+        dacPtr->dacManufacturer[0] = (char) NULL;
+        dacPtr->dacDevice[0] = (char) NULL;
+        dacPtr->detect = (sst1InitDacRdWrStruct *) NULL;
+        dacPtr->setVideo = (sst1InitDacSetVideoStruct *) NULL;
+        dacPtr->setMemClk = (sst1InitDacSetMemClkStruct *) NULL;
+        dacPtr->setVideoMode = (sst1InitDacSetVideoModeStruct *) NULL;
+        if((dacFieldValue = strtok((char *) NULL, "=")) == NULL)
+            return(0);
+        strcpy(dacPtr->dacManufacturer, dacFieldValue);
+    } else if(!strcmp(dacFieldReference, "DEVICE")) {
+        if((dacFieldValue = strtok((char *) NULL, "=")) == NULL)
+            return(0);
+        strcpy(dacPtr->dacDevice, dacFieldValue);
+    } else if(!strcmp(dacFieldReference, "DETECT")) {
+        if((dacFieldValue = strtok((char *) NULL, "=")) == NULL)
+            return(0);
+        sst1InitToLower(dacFieldValue);
+        if(!sst1InitParseDacRdWrString(dacFieldValue, dacPtr))
+            return(0);
+    } else if(!strcmp(dacFieldReference, "SETVIDEO")) {
+        if((dacFieldValue = strtok((char *) NULL, "=")) == NULL)
+            return(0);
+        sst1InitToLower(dacFieldValue);
+        if(!sst1InitParseSetVideoString(dacFieldValue, dacPtr))
+            return(0);
+    } else if(!strcmp(dacFieldReference, "SETMEMCLK")) {
+        if((dacFieldValue = strtok((char *) NULL, "=")) == NULL)
+            return(0);
+        sst1InitToLower(dacFieldValue);
+        if(!sst1InitParseSetMemClkString(dacFieldValue, dacPtr))
+            return(0);
+    } else if(!strcmp(dacFieldReference, "SETVIDEOMODE")) {
+        if((dacFieldValue = strtok((char *) NULL, "=")) == NULL)
+            return(0);
+        sst1InitToLower(dacFieldValue);
+        if(!sst1InitParseSetVideoModeString(dacFieldValue, dacPtr))
+            return(0);
+    } else
+        return(0);
+
+    return(1);
+}
+
+static int sst1InitParseDacRdWrString(char *string, sst1InitDacStruct *dacBase)
+{
+    int cntr = 0;
+    int i;
+    sst1InitDacRdWrStruct *dacRdWrPtr;
+    char *dacRdWrCmd;
+    char stringCpy[2048];
+
+    while(1) {
+        strcpy(stringCpy, string);
+        if((dacRdWrCmd = strtok(stringCpy, ";")) == NULL)
+            return(0);
+        if(cntr == 0) {
+            if(!(dacBase->detect = (sst1InitDacRdWrStruct *)malloc(sizeof(sst1InitDacRdWrStruct))))
+                return(0);
+            dacRdWrPtr = dacBase->detect;
+        } else {
+            for(i=0; i<(cntr-1); i++) {
+                if((dacRdWrCmd = strtok(NULL, ";")) == NULL)
+                    return(0);
+            }
+            if((dacRdWrCmd = strtok(NULL, ";")) == NULL) {
+                break;
+            }
+            if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct)))) 
+                return(0);
+
+            dacRdWrPtr = (sst1InitDacRdWrStruct *)dacRdWrPtr->nextRdWr;
+        }
+        dacRdWrPtr->nextRdWr = (sst1InitDacRdWrStruct *) NULL;
+        if(!sst1InitParseDacRdWr(dacRdWrCmd, dacRdWrPtr))
+            return(0);
+        cntr++;
+    }
+    return(1);
+}
+
+static int sst1InitParseDacRdWr(char *string, sst1InitDacRdWrStruct *dacRdWrPtr)
+{
+    char *addr, *data, *mask, *addrDataCmd;
+    char stringCpy[2048];
+
+    strcpy(stringCpy, string);
+
+    if(stringCpy[5] == '(') {
+        stringCpy[5] = (char) NULL;
+        addrDataCmd = &stringCpy[6];
+    } else if(stringCpy[7] == '(') {
+        stringCpy[7] = (char) NULL;
+        addrDataCmd = &stringCpy[8];
+    } else if(stringCpy[8] == '(') {
+        stringCpy[8] = (char) NULL;
+        addrDataCmd = &stringCpy[9];
+    } else if(stringCpy[9] == '(') {
+        stringCpy[9] = (char) NULL;
+        addrDataCmd = &stringCpy[10];
+    } else
+        return(0);
+
+    if(!strcmp(stringCpy, "dacwr")) {
+        if((addr = strtok(addrDataCmd, ",")) == NULL)
+            return(0);
+        if((data = strtok(NULL, ",")) == NULL)
+            return(0);
+        if(data[strlen(data)-1] != ')')
+            return(0);
+        data[strlen(data)-1] = (char) NULL;
+        dacRdWrPtr->type = DACRDWR_TYPE_WR;
+        SSCANF(addr, "%i", &dacRdWrPtr->addr);
+        SSCANF(data, "%i", &dacRdWrPtr->data);
+    } else if(!strcmp(stringCpy, "dacwrpop")) {
+        if((addr = strtok(addrDataCmd, ",")) == NULL)
+            return(0);
+        if((mask = strtok(NULL, ",")) == NULL)
+            return(0);
+        if((data = strtok(NULL, ",")) == NULL)
+            return(0);
+        if(data[strlen(data)-1] != ')')
+            return(0);
+        data[strlen(data)-1] = (char) NULL;
+        dacRdWrPtr->type = DACRDWR_TYPE_WRMOD_POP;
+        SSCANF(addr, "%i", &dacRdWrPtr->addr);
+        SSCANF(mask, "%i", &dacRdWrPtr->mask);
+        SSCANF(data, "%i", &dacRdWrPtr->data);
+    } else if(!strcmp(stringCpy, "dacrdwr")) {
+        if((addr = strtok(addrDataCmd, ",")) == NULL)
+            return(0);
+        if((mask = strtok(NULL, ",")) == NULL)
+            return(0);
+        if((data = strtok(NULL, ",")) == NULL)
+            return(0);
+        if(data[strlen(data)-1] != ')')
+            return(0);
+        data[strlen(data)-1] = (char) NULL;
+        dacRdWrPtr->type = DACRDWR_TYPE_RDMODWR;
+        SSCANF(addr, "%i", &dacRdWrPtr->addr);
+        SSCANF(mask, "%i", &dacRdWrPtr->mask);
+        SSCANF(data, "%i", &dacRdWrPtr->data);
+    } else if(!strcmp(stringCpy, "dacrd")) {
+        if((addr = strtok(addrDataCmd, ",")) == NULL)
+            return(0);
+        if(addr[strlen(addr)-1] == ')') {
+            dacRdWrPtr->type = DACRDWR_TYPE_RDNOCHECK;
+            SSCANF(addr, "%i", &dacRdWrPtr->addr);
+        } else {
+            dacRdWrPtr->type = DACRDWR_TYPE_RDCHECK;
+            if((data = strtok(NULL, ",")) == NULL)
+                return(0);
+            if(data[strlen(data)-1] != ')')
+                return(0);
+            data[strlen(data)-1] = (char) NULL;
+            SSCANF(addr, "%i", &dacRdWrPtr->addr);
+            SSCANF(data, "%i", &dacRdWrPtr->data);
+        }
+    } else if(!strcmp(stringCpy, "dacrdpush")) {
+        if((addr = strtok(addrDataCmd, ",")) == NULL)
+            return(0);
+        if(addr[strlen(addr)-1] == ')') {
+            dacRdWrPtr->type = DACRDWR_TYPE_RDPUSH;
+            SSCANF(addr, "%i", &dacRdWrPtr->addr);
+        } else
+            return(0);
+    } else {
+        return(0);
+    }
+
+    return(1);
+}
+
+static void sst1InitPrintDacRdWr(sst1InitDacRdWrStruct *dacRdWrBase,
+  char *prefix)
+{
+    sst1InitDacRdWrStruct *dacRdWrPtr = dacRdWrBase;
+
+    while(dacRdWrPtr) {
+        if(dacRdWrPtr->type == DACRDWR_TYPE_WR) {
+            printf("%sDacWR", prefix);
+            printf("(0x%x,0x%x)\n", dacRdWrPtr->addr, dacRdWrPtr->data);
+        } else if(dacRdWrPtr->type == DACRDWR_TYPE_RDMODWR) {
+            printf("%sDacRD-MOD-WR", prefix);
+            printf("(0x%x,0x%x,0x%x)\n", dacRdWrPtr->addr, dacRdWrPtr->mask,
+              dacRdWrPtr->data);
+        } else if(dacRdWrPtr->type == DACRDWR_TYPE_RDNOCHECK) {
+            printf("%sDacRD-NOCHECK", prefix);
+            printf("(0x%x)\n", dacRdWrPtr->addr);
+        } else if(dacRdWrPtr->type == DACRDWR_TYPE_RDCHECK) {
+            printf("%sDacRD-CHECK", prefix);
+            printf("(0x%x,0x%x)\n", dacRdWrPtr->addr, dacRdWrPtr->data);
+        } else
+            printf("%sDAC???", prefix);
+        dacRdWrPtr = (sst1InitDacRdWrStruct *) dacRdWrPtr->nextRdWr;
+    }
+}
+
+static int sst1InitParseSetVideoString(char *string, sst1InitDacStruct *dacBase)
+{
+    int cntr = 0;
+    int i;
+    sst1InitDacRdWrStruct *dacRdWrPtr;
+    sst1InitDacSetVideoStruct *dacSetVideoPtr;
+    char *dacRdWrCmd;
+    char stringCpy[2048];
+
+    while(1) {
+        strcpy(stringCpy, string);
+        if((dacRdWrCmd = strtok(stringCpy, ";")) == NULL)
+            return(0);
+        if(cntr == 0) {
+            if(!dacBase->setVideo) {
+                if(!(dacBase->setVideo =
+                  (sst1InitDacSetVideoStruct *) malloc(sizeof(sst1InitDacSetVideoStruct))))
+                    return(0);
+                dacSetVideoPtr = (sst1InitDacSetVideoStruct *)dacBase->setVideo;
+            } else {
+                dacSetVideoPtr = (sst1InitDacSetVideoStruct *)dacBase->setVideo;
+                while(1) {
+                    if(!dacSetVideoPtr->nextSetVideo)
+                        break;
+                    dacSetVideoPtr = (sst1InitDacSetVideoStruct *)dacSetVideoPtr->nextSetVideo;
+                }
+                if(!(dacSetVideoPtr->nextSetVideo =
+                   malloc(sizeof(sst1InitDacSetVideoStruct))))
+                    return(0);
+                dacSetVideoPtr = (sst1InitDacSetVideoStruct *)dacSetVideoPtr->nextSetVideo;
+            }
+            dacSetVideoPtr->nextSetVideo = (sst1InitDacSetVideoStruct *) NULL;
+            /* Width */
+            SSCANF(dacRdWrCmd, "%i", &dacSetVideoPtr->width);
+            /* Height */
+            if((dacRdWrCmd = strtok(NULL, ";")) == NULL)
+                return(0);
+            SSCANF(dacRdWrCmd, "%i", &dacSetVideoPtr->height);
+            /* Refresh */
+            if((dacRdWrCmd = strtok(NULL, ";")) == NULL)
+                return(0);
+            SSCANF(dacRdWrCmd, "%i", &dacSetVideoPtr->refresh);
+            /* video16BPP */
+            if((dacRdWrCmd = strtok(NULL, ";")) == NULL)
+                return(0);
+            SSCANF(dacRdWrCmd, "%i", &dacSetVideoPtr->video16BPP);
+            /* First DacRdWr */
+            if((dacRdWrCmd = strtok(NULL, ";")) == NULL)
+                return(0);
+            if(!(dacSetVideoPtr->setVideoRdWr =
+               (sst1InitDacRdWrStruct *)malloc(sizeof(sst1InitDacRdWrStruct))))
+                return(0);
+            dacRdWrPtr = dacSetVideoPtr->setVideoRdWr;
+        } else {
+            for(i=0; i<(cntr+3); i++) {
+                if((dacRdWrCmd = strtok(NULL, ";")) == NULL)
+                    return(0);
+            }
+            if((dacRdWrCmd = strtok(NULL, ";")) == NULL) {
+                break;
+            }
+            if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct))))
+                return(0);
+            dacRdWrPtr = (sst1InitDacRdWrStruct *) dacRdWrPtr->nextRdWr;
+        }
+        dacRdWrPtr->nextRdWr = (sst1InitDacRdWrStruct *) NULL;
+        if(!sst1InitParseDacRdWr(dacRdWrCmd, dacRdWrPtr))
+            return(0);
+        cntr++;
+    }
+    return(1);
+}
+
+static int sst1InitParseSetMemClkString(char *string,
+  sst1InitDacStruct *dacBase)
+{
+    int cntr = 0;
+    int i;
+    sst1InitDacRdWrStruct *dacRdWrPtr;
+    sst1InitDacSetMemClkStruct *dacSetMemClkPtr;
+    char *dacRdWrCmd;
+    char stringCpy[2048];
+
+    while(1) {
+        strcpy(stringCpy, string);
+        if((dacRdWrCmd = strtok(stringCpy, ";")) == NULL)
+            return(0);
+        if(cntr == 0) {
+            if(!dacBase->setMemClk) {
+                if(!(dacBase->setMemClk =
+                  (sst1InitDacSetMemClkStruct *)malloc(sizeof(sst1InitDacSetMemClkStruct))))
+                    return(0);
+                dacSetMemClkPtr = (sst1InitDacSetMemClkStruct *)dacBase->setMemClk;
+            } else {
+                dacSetMemClkPtr = (sst1InitDacSetMemClkStruct *)dacBase->setMemClk;
+                while(1) {
+                    if(!dacSetMemClkPtr->nextSetMemClk)
+                        break;
+                    dacSetMemClkPtr = (sst1InitDacSetMemClkStruct *)dacSetMemClkPtr->nextSetMemClk;
+                }
+                if(!(dacSetMemClkPtr->nextSetMemClk =
+                   malloc(sizeof(sst1InitDacSetMemClkStruct))))
+                    return(0);
+                dacSetMemClkPtr = (sst1InitDacSetMemClkStruct *)dacSetMemClkPtr->nextSetMemClk;
+            }
+            dacSetMemClkPtr->nextSetMemClk = (sst1InitDacSetMemClkStruct *)
+              NULL;
+            /* Frequency */
+            SSCANF(dacRdWrCmd, "%i", &dacSetMemClkPtr->frequency);
+
+            /* First DacRdWr */
+            if((dacRdWrCmd = strtok(NULL, ";")) == NULL)
+                return(0);
+            if(!(dacSetMemClkPtr->setMemClkRdWr =
+               (sst1InitDacRdWrStruct *) malloc(sizeof(sst1InitDacRdWrStruct))))
+                return(0);
+            dacRdWrPtr = (sst1InitDacRdWrStruct *)dacSetMemClkPtr->setMemClkRdWr;
+        } else {
+            for(i=0; i<(cntr); i++) {
+                if((dacRdWrCmd = strtok(NULL, ";")) == NULL)
+                    return(0);
+            }
+            if((dacRdWrCmd = strtok(NULL, ";")) == NULL) {
+                break;
+            }
+            if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct))))
+                return(0);
+            dacRdWrPtr = (sst1InitDacRdWrStruct *)dacRdWrPtr->nextRdWr;
+        }
+        dacRdWrPtr->nextRdWr = (sst1InitDacRdWrStruct *) NULL;
+        if(!sst1InitParseDacRdWr(dacRdWrCmd, dacRdWrPtr))
+            return(0);
+        cntr++;
+    }
+    return(1);
+}
+
+static int sst1InitParseSetVideoModeString(char *string,
+  sst1InitDacStruct *dacBase)
+{
+    int cntr = 0;
+    int i;
+    sst1InitDacRdWrStruct *dacRdWrPtr;
+    sst1InitDacSetVideoModeStruct *dacSetVideoModePtr;
+    char *dacRdWrCmd;
+    char stringCpy[2048];
+
+    while(1) {
+        strcpy(stringCpy, string);
+        if((dacRdWrCmd = strtok(stringCpy, ";")) == NULL)
+            return(0);
+        if(cntr == 0) {
+            if(!dacBase->setVideoMode) {
+                if(!(dacBase->setVideoMode =
+                  (sst1InitDacSetVideoModeStruct *) malloc(sizeof(sst1InitDacSetVideoModeStruct))))
+                    return(0);
+                dacSetVideoModePtr = (sst1InitDacSetVideoModeStruct *) dacBase->setVideoMode;
+            } else {
+                dacSetVideoModePtr = (sst1InitDacSetVideoModeStruct *) dacBase->setVideoMode;
+                while(1) {
+                    if(!dacSetVideoModePtr->nextSetVideoMode)
+                        break;
+                    dacSetVideoModePtr = (sst1InitDacSetVideoModeStruct *) dacSetVideoModePtr->nextSetVideoMode;
+                }
+                if(!(dacSetVideoModePtr->nextSetVideoMode =
+                   (sst1InitDacSetVideoModeStruct *) malloc(sizeof(sst1InitDacSetVideoModeStruct))))
+                    return(0);
+                dacSetVideoModePtr = (sst1InitDacSetVideoModeStruct *) dacSetVideoModePtr->nextSetVideoMode;
+            }
+            dacSetVideoModePtr->nextSetVideoMode =
+              (sst1InitDacSetVideoModeStruct *) NULL;
+            /* video16BPP */
+            SSCANF(dacRdWrCmd, "%i", &dacSetVideoModePtr->video16BPP);
+
+            /* First DacRdWr */
+            if((dacRdWrCmd = strtok(NULL, ";")) == NULL)
+                return(0);
+            if(!(dacSetVideoModePtr->setVideoModeRdWr =
+               (sst1InitDacRdWrStruct *) malloc(sizeof(sst1InitDacRdWrStruct))))
+                return(0);
+            dacRdWrPtr = dacSetVideoModePtr->setVideoModeRdWr;
+        } else {
+            for(i=0; i<(cntr); i++) {
+                if((dacRdWrCmd = strtok(NULL, ";")) == NULL)
+                    return(0);
+            }
+            if((dacRdWrCmd = strtok(NULL, ";")) == NULL) {
+                break;
+            }
+            if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct))))
+                return(0);
+            dacRdWrPtr = (sst1InitDacRdWrStruct *) dacRdWrPtr->nextRdWr;
+        }
+        dacRdWrPtr->nextRdWr = (sst1InitDacRdWrStruct *) NULL;
+        if(!sst1InitParseDacRdWr(dacRdWrCmd, dacRdWrPtr))
+            return(0);
+        cntr++;
+    }
+    return(1);
+}
+
+static void sst1InitToLower(char *string)
+{
+    char *ptr = string;
+
+    while(*ptr) {
+        *ptr = (isupper(*ptr)) ? tolower(*ptr) : *ptr;
+        ptr++;
+    }
+}
+
+/*
+** sst1InitGetenv():
+**  Getenv() for INIT routines.
+**
+**  If the actual environment variable exists (determined by a call to
+**  the system getenv() routine), then that pointer is returned.  Otherwise,
+**  if the variable is defined in the [CFG] section of "voodoo.ini", then
+**  a pointer to the value defined in "voodoo.ini" is returned.  Otherwise,
+**  NULL is returned
+**
+*/
+FX_ENTRY char * FX_CALL sst1InitGetenv(char *string)
+{
+    sst1InitEnvVarStruct *envVarsPtr;
+    char *retVal = (char *) NULL;
+
+    /* Does the real environment variable exist? */
+    if(myGetenv(string))
+      return((char*)myGetenv(string));
+
+    /* Does the requested environment variable exist in "voodoo.ini"? */
+    /* Dump CFG Data... */
+    envVarsPtr = envVarsBase;
+    while(envVarsPtr) {
+        if(!strcmp(string, envVarsPtr->envVariable)) {
+            retVal = envVarsPtr->envValue;
+            break;
+        }
+        envVarsPtr = (sst1InitEnvVarStruct *) envVarsPtr->nextVar;
+    }
+    return(retVal);
+}
+
+const char*
+myGetenv(const char* envKey)
+{
+  FxBool callRealGetenvP = FXTRUE;
+
+#if __WIN32__
+  /* NB: If were being called from cya code in
+   * DllMain(DLL_PROCESS_DETACH) because the current app has called
+   * exit() or dropped off of the end of main the per dll environ
+   * string table has been freed by the c runtime but has not been set
+   * to NULL. Bad things happen if this memory has been unmapped by
+   * the system or if the string cannot be found.  
+   */
+  {
+    HANDLE curProcessHandle = GetCurrentProcess();
+    DWORD exitCode = STILL_ACTIVE;
+
+    callRealGetenvP = ((curProcessHandle != NULL) &&
+                       GetExitCodeProcess(curProcessHandle, &exitCode) &&
+                       (exitCode == STILL_ACTIVE));
+  }
+#endif /* __WIN32__ */
+
+  return (callRealGetenvP
+          ? getenv(envKey)
+          : NULL);
+}
+
+#pragma optimize ("",on)
Index: trunk/src/opengl/glide/sst1/init/initvg/print.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/print.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/print.c	(revision 2885)
@@ -0,0 +1,81 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:34 $ 
+**
+** Print functions for SST-1 Initialization routines
+*/
+#pragma optimize ("",off)
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <sst.h>
+#include <sst1vid.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <sst1init.h>
+
+#ifdef INIT_OUTPUT
+
+FX_ENTRY void FX_CALL sst1InitVPrintf(const char *, va_list);
+
+FX_ENTRY void FX_CALL sst1InitPrintf(const char *format, ...)
+{
+    va_list args;
+    static FxBool firstPass = FXTRUE;
+    static FxBool printIt = FXFALSE;
+
+    if(firstPass == FXTRUE) {
+        firstPass = FXFALSE;
+	if (sst1InitMsgFile == NULL)
+	{
+	  /* I couldn't initialize to stdout because stdout is not constant */
+	  sst1InitMsgFile = stdout;
+	}
+        if(GETENV(("SST_INITDEBUG")))
+            printIt = FXTRUE;
+        if(GETENV(("SST_INITDEBUG_FILE"))) {
+            if((sst1InitMsgFile = fopen(GETENV(("SST_INITDEBUG_FILE")), "w")))
+                printIt = FXTRUE;
+            else {
+                fprintf(stderr, "sst1InitPrintf(): Could not open file '%s' for logging...\n", GETENV(("SST_INITDEBUG_FILE")));
+                printIt = FXFALSE;
+            }
+        }
+    }
+
+    if(printIt == FXFALSE)
+        return;
+
+    va_start(args, format);
+    sst1InitVPrintf(format, args);
+    va_end(args);
+}
+
+FX_ENTRY void FX_CALL sst1InitVPrintf(const char *format, va_list args)
+{
+    vfprintf(sst1InitMsgFile, format, args);
+    fflush(sst1InitMsgFile);
+}
+
+#endif
+
+#pragma optimize ("",on)
Index: trunk/src/opengl/glide/sst1/init/initvg/rcver.h
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/rcver.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/rcver.h	(revision 2885)
@@ -0,0 +1,25 @@
+/* 
+ * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ * FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ * 
+ * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ * TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ * THE UNITED STATES.  
+ * 
+ * COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+ */
+
+#define MANVERSION              1
+#define MANREVISION             1
+#define BUILD_NUMBER            1
+
+#define VERSIONSTR    "InitCode " "$Revision: 1.1 $" "\0"
Index: trunk/src/opengl/glide/sst1/init/initvg/sli.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/sli.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/sli.c	(revision 2885)
@@ -0,0 +1,544 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:34 $ 
+**
+** Initialization code for initializing scanline interleaving
+**
+*/
+#pragma optimize ("",off)
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <sst.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <sst1vid.h>
+#include <sst1init.h>
+
+/*
+** sst1InitSli():
+**  Setup Multiple SST-1 subsystems for Scanline Interleaving
+**  sstbase0 defined to be the SLI Master
+**  sstbase1 defined to be the SLI Slave
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1)
+{
+    FxU32 j, n, MasterPhysAddr, cntr;
+    volatile Sstregs *sstMaster = (Sstregs *) sstbase0;
+    volatile Sstregs *sstSlave = (Sstregs *) sstbase1;
+    FxU32 MasterInit1, SlaveInit1;
+    FxU32 memOffset;
+    FxU32 masterVInClkDel, masterVOutClkDel;
+    FxU32 slaveVInClkDel, slaveVOutClkDel;
+    FxU32 masterPVOutClkDel, slavePVOutClkDel;
+    FxU32 pciFifoLwm, memFifoLwm;
+    FxU32 clkFreqMaster;
+
+    /* Check to make sure master and slave are installed properly */
+    /* Master should have a clock frequency setting of 54 MHz */
+    /* Slave should have a clock frequency setting of 50 MHz */
+    /* sst1InitCalcGrxClk() will actually setup the master to run at 54 MHz, */
+    /* even though the default strapping is 54 MHz.  The 54 MHz strapping is */
+    /* implemented to allow software detection of which SLI board is the */
+    /* SLI Master */
+    if(sst1InitCheckBoard(sstbase0) == FXFALSE)
+        return(FXFALSE);
+    clkFreqMaster = 40 + (((sst1CurrentBoard->tmuConfig >> 3) & 0x7) << 2) +
+      (sst1CurrentBoard->fbiConfig & 0x3);
+    if(!(GETENV(("SST_IGNORE_SLI_CHECK")))) {
+        if(clkFreqMaster != 54) {
+            INIT_PRINTF(("sst1InitSli(): SLI Slave board installed as SLI Master.\n"));
+            INIT_PRINTF(("               Please power-down, swap SLI boards and re-boot.\n"));
+            return(FXFALSE);
+        }
+    } else
+        INIT_PRINTF(("sst1InitSli(): WARNING: Bypassing check for proper SLI installation...\n"));
+
+    INIT_PRINTF(("sst1InitSli(): Enabling Scanline Interleaving...\n"));
+
+    /* Setup SLI Slave... */
+    cntr = 0;
+    while(1) {
+        if(sst1InitCheckBoard(sstbase1) == FXFALSE)
+            return(FXFALSE);
+        PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+        PCICFG_WR(SST1_PCI_INIT_ENABLE,
+            (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV)); 
+        ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) |
+          (SST_VIDEO_RESET | SST_EN_SCANLINE_INTERLEAVE));
+        sst1InitIdleFBINoNOP(sstbase1);
+        PCICFG_WR(SST1_PCI_VCLK_DISABLE, 0x0); /* Disable video clock */
+        ISET(SST_TREX(sstSlave,0)->trexInit1, sst1CurrentBoard->tmuInit1[0] |
+            SST_EN_TEX_SCANLINE_INTERLEAVE | SST_TEX_SCANLINE_INTERLEAVE_SLAVE);
+        sst1InitIdle(sstbase1);
+        ISET(SST_TREX(sstSlave,1)->trexInit1, sst1CurrentBoard->tmuInit1[1] |
+            SST_EN_TEX_SCANLINE_INTERLEAVE | SST_TEX_SCANLINE_INTERLEAVE_SLAVE);
+        sst1InitIdle(sstbase1);
+        ISET(SST_TREX(sstSlave,2)->trexInit1, sst1CurrentBoard->tmuInit1[2] |
+            SST_EN_TEX_SCANLINE_INTERLEAVE | SST_TEX_SCANLINE_INTERLEAVE_SLAVE);
+        sst1InitIdle(sstbase1);
+        sst1InitIdleFBINoNOP(sstbase1);
+        ISET(sstSlave->fbiInit2, (IGET(sstSlave->fbiInit2) &
+          ~(SST_EN_DRAM_BANKED | SST_SWAP_ALGORITHM)) | SST_SWAP_DACDATA0);
+        sst1InitIdleFBINoNOP(sstbase1);
+        /* Initialize Y-Origin */
+        ISET(sstSlave->fbiInit3, (IGET(sstSlave->fbiInit3) & ~SST_YORIGIN_TOP) |
+            ((sst1CurrentBoard->fbiVideoHeight - 1) << SST_YORIGIN_TOP_SHIFT));
+        sst1InitIdleFBINoNOP(sstbase1);
+        memOffset = ((IGET(sstSlave->fbiInit2) & SST_VIDEO_BUFFER_OFFSET) >>
+            SST_VIDEO_BUFFER_OFFSET_SHIFT) + 16;
+        if(memOffset & 0x1) {
+            if((memOffset + 1) & 0x3) /* not divisible by 4... */
+                memOffset = (memOffset + 1) >> 1;
+            else
+                memOffset = (memOffset + 3) >> 1;
+        } else {
+            if(memOffset & 0x3) /* not divisible by 4... */
+                memOffset = (memOffset + 2) >> 1;
+            else
+                memOffset = memOffset >> 1;
+        }
+        if(sst1CurrentBoard->fbiVideoWidth == 960) {
+            memOffset = 170;
+            ISET(sstSlave->fbiInit0, IGET(sstSlave->fbiInit0) &
+              ~SST_MEM_FIFO_EN);
+            INIT_PRINTF(("sst1InitSli(): Disabling memory fifo...\n"));
+        }
+        ISET(sstSlave->fbiInit2, (IGET(sstSlave->fbiInit2) &
+          ~SST_VIDEO_BUFFER_OFFSET) |
+          (memOffset << SST_VIDEO_BUFFER_OFFSET_SHIFT));
+        sst1InitIdleFBINoNOP(sstbase1);
+        ISET(sstSlave->fbiInit0, (IGET(sstSlave->fbiInit0) &
+          ~SST_MEM_FIFO_HWM) | (0x100 << SST_MEM_FIFO_HWM_SHIFT));
+        sst1InitIdleFBINoNOP(sstbase1);
+        ISET(sstSlave->fbiInit4, (IGET(sstSlave->fbiInit4) &
+          ~SST_MEM_FIFO_ROW_BASE) |
+          ((3*memOffset) << SST_MEM_FIFO_ROW_BASE_SHIFT));
+        sst1InitIdleFBINoNOP(sstbase1);
+        //slaveVInClkDel = 0;
+        //slaveVOutClkDel = 1;
+        //slavePVOutClkDel = 1;
+        slaveVInClkDel = 2;
+        slaveVOutClkDel = 0;
+        slavePVOutClkDel = 3;
+        if(GETENV(("SST_SLIS_VOUT_CLKDEL")))
+            SSCANF(GETENV(("SST_SLIS_VOUT_CLKDEL")), "%i", &slaveVOutClkDel);
+        if(GETENV(("SST_SLIS_PVOUT_CLKDEL")))
+            SSCANF(GETENV(("SST_SLIS_PVOUT_CLKDEL")), "%i", &slavePVOutClkDel);
+        if(GETENV(("SST_SLIS_VIN_CLKDEL")))
+            SSCANF(GETENV(("SST_SLIS_VIN_CLKDEL")), "%i", &slaveVInClkDel);
+        INIT_PRINTF(("sst1InitSli(): slaveVinClkdel=0x%x, slaveVOutClkDel=0x%x, slavePVOutClkDel=0x%x\n",
+            slaveVInClkDel, slaveVOutClkDel, slavePVOutClkDel));
+        if(sst1CurrentBoard->fbiVideo16BPP)
+            /* 16-bit Video Output */
+            ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) &
+                    ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL)) | 
+                SST_EN_SCANLINE_INTERLEAVE |
+                /* SST_VIDEO_VID_CLK_SLAVE | */
+                SST_VIDEO_VID_CLK_2X |
+                /* SST_VIDEO_INVERT_VID_CLK_2X | */
+                SST_PCI_WRWS_1 |
+                (slaveVInClkDel << SST_VIDEO_VCLK_DEL_SHIFT) |
+                (slaveVOutClkDel << SST_VIDEO_VCLK_2X_OUTPUT_DEL_SHIFT) |
+                (slavePVOutClkDel << SST_VIDEO_VCLK_2X_INPUT_DEL_SHIFT));
+        else
+            /* 24-bit Video Output */
+            ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) &
+                    ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL |
+                      SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 
+                SST_EN_SCANLINE_INTERLEAVE |
+                /* SST_VIDEO_VID_CLK_SLAVE | */
+                SST_VIDEO_VID_CLK_2X |
+                /* SST_VIDEO_INVERT_VID_CLK_2X | */
+                (0x0 << SST_VIDEO_VCLK_SEL_SHIFT) |
+                SST_PCI_WRWS_1 |
+                (slaveVInClkDel << SST_VIDEO_VCLK_DEL_SHIFT) |
+                (slaveVOutClkDel << SST_VIDEO_VCLK_2X_OUTPUT_DEL_SHIFT) |
+                (slavePVOutClkDel << SST_VIDEO_VCLK_2X_INPUT_DEL_SHIFT));
+        sst1InitIdleFBINoNOP(sstbase1);
+        ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) &
+                               ~(SST_VIDEO_DATA_OE_EN |
+                                SST_VIDEO_BLANK_OE_EN |
+                                SST_VIDEO_DCLK_OE_EN |
+                                SST_VIDEO_HVSYNC_OE_EN));
+        sst1InitIdleFBINoNOP(sstbase1);
+        /* Initialize pci and memory fifos... */
+        pciFifoLwm = 16;
+        memFifoLwm = 26;
+        if(!GETENV(("SST_PCIFIFO_LWM")))
+            ISET(sstSlave->fbiInit0, (IGET(sstSlave->fbiInit0) &
+              ~SST_PCI_FIFO_LWM) | (pciFifoLwm << SST_PCI_FIFO_LWM_SHIFT));
+        sst1InitIdleFBINoNOP(sstbase1);
+        if(!GETENV(("SST_MEMFIFO_LWM")))
+            ISET(sstSlave->fbiInit4, (IGET(sstSlave->fbiInit4) &
+              ~SST_MEM_FIFO_LWM) | (memFifoLwm << SST_MEM_FIFO_LWM_SHIFT));
+        sst1InitIdleFBINoNOP(sstbase1);
+        INIT_PRINTF(("sst1InitSli(): Slave pciFifoLwm:%d, memFifoLwm:%d\n",
+          ((IGET(sstSlave->fbiInit0) & SST_PCI_FIFO_LWM) >>
+            SST_PCI_FIFO_LWM_SHIFT),
+          ((IGET(sstSlave->fbiInit4) & SST_MEM_FIFO_LWM) >>
+            SST_MEM_FIFO_LWM_SHIFT)));
+        sst1InitIdleFBINoNOP(sstbase1);
+        sst1InitIdleFBINoNOP(sstbase1);
+        ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) |
+          (SST_EN_SCANLINE_INTERLEAVE | SST_VIDEO_RESET));
+        sst1InitIdleFBINoNOP(sstbase1);
+        sst1InitIdleFBINoNOP(sstbase1);
+        sst1InitIdleFBINoNOP(sstbase1);
+        ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) & ~SST_VIDEO_RESET);
+        sst1InitIdleFBINoNOP(sstbase1);
+        sst1InitIdleFBINoNOP(sstbase1);
+        if(IGET(sstSlave->fbiInit1) & SST_VIDEO_RESET) {
+            INIT_PRINTF(("sst1InitSli(): Could not unReset Slave Video...\n"));
+            if(++cntr < 10)
+                continue;
+            else
+                return(FXFALSE);
+        }
+        if(!(IGET(sstSlave->fbiInit1) & SST_EN_SCANLINE_INTERLEAVE)) {
+            INIT_PRINTF(("sst1InitSli(): Could not setup SLI Slave...\n"));
+            if(++cntr < 10)
+                continue;
+            else
+                return(FXFALSE);
+        }
+        SlaveInit1 = IGET(sstSlave->fbiInit1);
+        break;
+    }
+
+    /* Setup SLI Master... */
+    ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) | SST_VIDEO_RESET);
+    ISET(SST_TREX(sstMaster,0)->trexInit1, sst1CurrentBoard->tmuInit1[0] |
+        SST_EN_TEX_SCANLINE_INTERLEAVE);
+    sst1InitIdle(sstbase0);
+    ISET(SST_TREX(sstMaster,1)->trexInit1, sst1CurrentBoard->tmuInit1[1] |
+        SST_EN_TEX_SCANLINE_INTERLEAVE);
+    sst1InitIdle(sstbase0);
+    ISET(SST_TREX(sstMaster,2)->trexInit1, sst1CurrentBoard->tmuInit1[2] |
+        SST_EN_TEX_SCANLINE_INTERLEAVE);
+    sst1InitIdle(sstbase0);
+    sst1InitIdleFBINoNOP(sstbase0);
+    ISET(sstMaster->fbiInit2, (IGET(sstMaster->fbiInit2) &
+      ~(SST_EN_DRAM_BANKED | SST_SWAP_ALGORITHM)) | SST_SWAP_DACDATA0);
+    sst1InitIdleFBINoNOP(sstbase0);
+    /* Initialize Y-Origin */
+    ISET(sstMaster->fbiInit3, (IGET(sstMaster->fbiInit3) & ~SST_YORIGIN_TOP) |
+        ((sst1CurrentBoard->fbiVideoHeight) << SST_YORIGIN_TOP_SHIFT));
+    sst1InitIdleFBINoNOP(sstbase0);
+    if(sst1CurrentBoard->fbiVideoWidth == 960)
+        ISET(sstMaster->fbiInit0, IGET(sstMaster->fbiInit0) & ~SST_MEM_FIFO_EN);
+    ISET(sstMaster->fbiInit2, (IGET(sstMaster->fbiInit2) &
+      ~SST_VIDEO_BUFFER_OFFSET) | (memOffset << SST_VIDEO_BUFFER_OFFSET_SHIFT));
+    sst1InitIdleFBINoNOP(sstbase0);
+    ISET(sstMaster->fbiInit0, (IGET(sstMaster->fbiInit0) & ~SST_MEM_FIFO_HWM) |
+        (0x100 << SST_MEM_FIFO_HWM_SHIFT));
+    sst1InitIdleFBINoNOP(sstbase0);
+    ISET(sstMaster->fbiInit4, (IGET(sstMaster->fbiInit4) &
+      ~SST_MEM_FIFO_ROW_BASE) | ((3*memOffset) << SST_MEM_FIFO_ROW_BASE_SHIFT));
+    sst1InitIdleFBINoNOP(sstbase0);
+    //masterVInClkDel = 1;
+    //masterVOutClkDel = 1;
+    //masterPVOutClkDel = 1;
+    masterVInClkDel = 2;
+    masterVOutClkDel = 0;
+    masterPVOutClkDel = 3;
+    if(GETENV(("SST_SLIM_VOUT_CLKDEL")))
+        SSCANF(GETENV(("SST_SLIM_VOUT_CLKDEL")), "%i", &masterVOutClkDel);
+    if(GETENV(("SST_SLIM_PVOUT_CLKDEL")))
+        SSCANF(GETENV(("SST_SLIM_PVOUT_CLKDEL")), "%i", &masterPVOutClkDel);
+    if(GETENV(("SST_SLIM_VIN_CLKDEL")))
+        SSCANF(GETENV(("SST_SLIM_VIN_CLKDEL")), "%i", &masterVInClkDel);
+    INIT_PRINTF(("sst1InitSli(): masterVinClkdel=0x%x, masterVOutClkDel=0x%x, masterPVOutClkDel=0x%x\n",
+        masterVInClkDel, masterVOutClkDel, masterPVOutClkDel));
+    if(sst1CurrentBoard->fbiVideo16BPP)
+        /* 16-bit Video Output */
+        ISET(sstMaster->fbiInit1, (IGET(sstMaster->fbiInit1) &
+                ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL)) | 
+            SST_EN_SCANLINE_INTERLEAVE |
+            SST_VIDEO_VID_CLK_2X |
+            /* SST_VIDEO_INVERT_VID_CLK_2X | */
+            SST_PCI_WRWS_1 |
+            (masterVInClkDel << SST_VIDEO_VCLK_DEL_SHIFT) |
+            (masterVOutClkDel << SST_VIDEO_VCLK_2X_OUTPUT_DEL_SHIFT) |
+            (masterPVOutClkDel << SST_VIDEO_VCLK_2X_INPUT_DEL_SHIFT));
+    else
+        /* 24-bit Video Output */
+        ISET(sstMaster->fbiInit1, (IGET(sstMaster->fbiInit1) &
+                ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL |
+                      SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 
+            SST_EN_SCANLINE_INTERLEAVE |
+            SST_VIDEO_VID_CLK_2X |
+            /*SST_VIDEO_INVERT_VID_CLK_2X | */
+            (0x0 << SST_VIDEO_VCLK_SEL_SHIFT) |
+            SST_PCI_WRWS_1 |
+            (masterVInClkDel << SST_VIDEO_VCLK_DEL_SHIFT) |
+            (masterVOutClkDel << SST_VIDEO_VCLK_2X_OUTPUT_DEL_SHIFT) |
+            (masterPVOutClkDel << SST_VIDEO_VCLK_2X_INPUT_DEL_SHIFT));
+    sst1InitIdleFBINoNOP(sstbase0);
+    /* Initialize pci and memory fifos... */
+    pciFifoLwm = 16;
+    memFifoLwm = 26;
+    if(!GETENV(("SST_PCIFIFO_LWM")))
+        ISET(sstMaster->fbiInit0, (IGET(sstMaster->fbiInit0) &
+          ~SST_PCI_FIFO_LWM) | (pciFifoLwm << SST_PCI_FIFO_LWM_SHIFT));
+    sst1InitIdleFBINoNOP(sstbase0);
+    if(!GETENV(("SST_MEMFIFO_LWM")))
+        ISET(sstMaster->fbiInit4, (IGET(sstMaster->fbiInit4) &
+          ~SST_MEM_FIFO_LWM) | (memFifoLwm << SST_MEM_FIFO_LWM_SHIFT));
+    sst1InitIdleFBINoNOP(sstbase0);
+    INIT_PRINTF(("sst1InitSli(): Master pciFifoLwm:%d, memFifoLwm:%d\n",
+      ((IGET(sstMaster->fbiInit0) & SST_PCI_FIFO_LWM) >>
+        SST_PCI_FIFO_LWM_SHIFT),
+      ((IGET(sstMaster->fbiInit4) & SST_MEM_FIFO_LWM) >>
+        SST_MEM_FIFO_LWM_SHIFT)));
+    ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) & ~SST_VIDEO_RESET);
+    sst1InitIdleFBINoNOP(sstbase0);
+    MasterInit1 = IGET(sstMaster->fbiInit1);
+
+    /* Master */
+    if(sst1InitCheckBoard(sstbase0) == FXFALSE)
+        return(FXFALSE);
+    PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+    PCICFG_WR(SST1_PCI_INIT_ENABLE,
+        (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 
+    MasterPhysAddr = sst1CurrentBoard->physAddr;
+    sst1InitReturnStatus(sstbase0); /* flush pci packer with reads */
+    sst1InitReturnStatus(sstbase0);
+    sst1InitReturnStatus(sstbase0);
+
+    /* Slave */
+    if(sst1InitCheckBoard(sstbase1) == FXFALSE)
+        return(FXFALSE);
+    PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+    PCICFG_WR(SST1_PCI_INIT_ENABLE,
+        ((j & ~(SST_SCANLINE_SLV_OWNPCI)) | SST_SCANLINE_SLI_SLV)); 
+    /* Map both boards to same Master physical address */
+    PCICFG_WR(PCI_BASE_ADDRESS_0, MasterPhysAddr);
+    sst1InitReturnStatus(sstbase0); /* flush pci packer with reads */
+    sst1InitReturnStatus(sstbase0);
+    sst1InitReturnStatus(sstbase0);
+
+    /* Reset Video units simultaneously */
+    ISET(sstMaster->fbiInit1, MasterInit1 | SST_VIDEO_RESET);
+    sst1InitIdleFBINoNOP(sstbase0);
+    sst1InitIdleFBINoNOP(sstbase0);
+    sst1InitIdleFBINoNOP(sstbase0);
+    ISET(sstMaster->fbiInit1, MasterInit1);
+    if(sst1InitCheckBoard(sstbase0) == FXFALSE)
+        return(FXFALSE);
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, 0x0);  /* Disable writes to init regs */
+    sst1InitReturnStatus(sstbase0);
+    ISET(sstMaster->fbiInit1, SlaveInit1);
+    sst1InitIdleFBINoNOP(sstbase0);
+    /* Enable writes to init regs */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, (SST_INITWR_EN | SST_PCI_FIFOWR_EN));
+    sst1InitIdleFBINoNOP(sstbase0);
+
+    if(sst1InitCheckBoard(sstbase1) == FXFALSE)
+        return(FXFALSE);
+    /* Disable writes to slave Init Registers */
+    PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, (j & ~SST_INITWR_EN));
+
+    if(sst1InitCheckBoard(sstbase0) == FXFALSE)
+        return(FXFALSE);
+
+    /* Clear buffers as a result of new buffer offsets... */
+    if(!GETENV(("SST_VIDEO_NOCLEAR"))) {
+        /* Clear Screen */
+        FxU32 clearColor = 0x0;
+
+        if(GETENV(("SST_VIDEO_CLEARCOLOR")))
+            SSCANF(GETENV(("SST_VIDEO_CLEARCOLOR")), "%i", &clearColor);
+        ISET(sstMaster->c1, clearColor);
+        ISET(sstMaster->c0, clearColor);
+        ISET(sstMaster->zaColor, 0x0);
+        ISET(sstMaster->clipLeftRight, sst1CurrentBoard->fbiVideoWidth);
+        ISET(sstMaster->clipBottomTop, sst1CurrentBoard->fbiVideoHeight);
+        ISET(sstMaster->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK);
+        ISET(sstMaster->fastfillCMD, 0x0);    /* Frontbuffer & Z/A */
+        ISET(sstMaster->fbzMode, SST_RGBWRMASK | SST_DRAWBUFFER_BACK);
+        ISET(sstMaster->fastfillCMD, 0x0);
+        ISET(sstMaster->nopCMD, 0x1);
+    }
+    sst1InitSliEnabled = 1;
+    sst1InitSliSlaveVirtAddr = sstbase1;
+
+    sst1InitIdle(sstbase0);
+
+    /* Synchronize Boards */
+    for(j=0; j<3; j++) {
+        while(!(sst1InitReturnStatus(sstbase0) & SST_VRETRACE))
+            ;
+        IGET(sstMaster->status);
+        ISET(sstMaster->swapbufferCMD, 0x0);
+        IGET(sstMaster->status);
+        sst1InitIdle(sstbase0);
+    }
+    while(!(sst1InitReturnStatus(sstbase0) & SST_VRETRACE))
+        ;
+    IGET(sstMaster->status);
+    ISET(sstMaster->swapbufferCMD, 0x1);
+    IGET(sstMaster->status);
+    sst1InitIdle(sstbase0);
+
+    return(FXTRUE);
+}
+
+/*
+** sst1InitShutdownSli():
+**  Shutdown SLI configuration
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitShutdownSli(FxU32 *sstbase)
+{
+    volatile Sstregs *sstMaster = (Sstregs *) sstbase;
+    volatile Sstregs *sstSlave = (Sstregs *) sst1InitSliSlaveVirtAddr;
+    FxU32 n, j, cntr;
+
+    if(sst1InitSliEnabled) {
+        INIT_PRINTF(("sst1InitShutdownSli(): Disabling Scanline Interleaving...\n"));
+        sst1InitSliEnabled = 0;
+
+        cntr = 0;
+        while(1) {
+            if(sst1InitCheckBoard(sst1InitSliSlaveVirtAddr) == FXFALSE)
+                return(FXFALSE);
+            /* Remap slave to original physical address */
+            PCICFG_WR(PCI_BASE_ADDRESS_0, sst1CurrentBoard->physAddr);
+            /* Turn off scanline interleaving in slave */
+            /* Enable writes to init registers in slave */
+            PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+            PCICFG_WR(SST1_PCI_INIT_ENABLE,
+                (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV |
+                 SST_INITWR_EN | SST_PCI_FIFOWR_EN)); 
+            PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */
+            ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) &
+              ~SST_EN_SCANLINE_INTERLEAVE);
+            PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+            PCICFG_WR(SST1_PCI_INIT_ENABLE,
+                (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 
+            PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */
+            sst1InitIdle((FxU32 *) sstSlave);
+
+
+            if(IGET(sstSlave->fbiInit1) & SST_EN_SCANLINE_INTERLEAVE) {
+                if(++cntr < 10)
+                    continue;
+                else {
+                    INIT_PRINTF(("sst1InitShutdown(): Could not disable Slave SLI...\n"));
+                    return(FXFALSE);
+                }
+            }
+            break;
+        }
+        ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) &
+          ~SST_EN_SCANLINE_INTERLEAVE);
+        sst1InitIdle((FxU32 *) sstMaster);
+    }
+    return(FXTRUE);
+}
+
+/*
+** sst1InitSliPciOwner():
+**  Specify which SLI card owns PCI bus control
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitSliPciOwner(FxU32 *sstbase, FxU32 owner)
+{
+    FxU32 j, n;
+    static FxU32 masterIsOwner = 1;
+
+    if(!sst1InitSliEnabled)
+        return(FXTRUE);
+
+    /* Flush PCI packers... */
+    sst1InitReturnStatus(sstbase);
+    sst1InitReturnStatus(sstbase);
+    sst1InitReturnStatus(sstbase);
+
+    if(masterIsOwner) {
+        if(owner == SST_SLI_SLAVE_OWNPCI) {
+            masterIsOwner = 0;
+            if(sst1InitCheckBoard(sstbase) == FXFALSE)
+                return(FXFALSE);
+            PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+            PCICFG_WR(SST1_PCI_INIT_ENABLE, ((j & ~SST_SLI_OWNPCI) |
+                SST_SLI_SLAVE_OWNPCI));
+            if(sst1InitCheckBoard(sst1InitSliSlaveVirtAddr) == FXFALSE)
+                return(FXFALSE);
+            PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+            PCICFG_WR(SST1_PCI_INIT_ENABLE, ((j & ~SST_SLI_OWNPCI) |
+                SST_SLI_SLAVE_OWNPCI));
+        } else
+            return(FXTRUE);
+    } else {
+        if(owner == SST_SLI_MASTER_OWNPCI) {
+            masterIsOwner = 1;
+            if(sst1InitCheckBoard(sst1InitSliSlaveVirtAddr) == FXFALSE)
+                return(FXFALSE);
+            PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+            PCICFG_WR(SST1_PCI_INIT_ENABLE, ((j & ~SST_SLI_OWNPCI) |
+                SST_SLI_MASTER_OWNPCI));
+            if(sst1InitCheckBoard(sstbase) == FXFALSE)
+                return(FXFALSE);
+            PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+            PCICFG_WR(SST1_PCI_INIT_ENABLE, ((j & ~SST_SLI_OWNPCI) |
+                SST_SLI_MASTER_OWNPCI));
+        } else
+            return(FXTRUE);
+    }
+    return(FXTRUE);
+}
+
+/*
+** sst1InitSliDetect():
+**  Determine if scanline interleave has been detected (either through
+**   power-up settings or through SST_SLIDETECT)
+**
+*/
+FX_ENTRY FxU32 FX_CALL sst1InitSliDetect(FxU32 *sstbase)
+{
+    static int firstTime = 1;
+    static FxU32 sliDetected = 0;
+    FxU32 fbiRev;
+    volatile Sstregs *sst;
+
+    if(firstTime) {
+        firstTime = 0;
+        if(GETENV(("SST_SLIDETECT")))
+            sliDetected = ATOI(GETENV(("SST_SLIDETECT")));
+        else {
+            PCICFG_RD(PCI_REVISION_ID, fbiRev);
+            sst = (Sstregs *) sstbase;
+            if((IGET(sst->fbiInit1) & SST_SLI_DETECT) && (fbiRev > 1) &&
+               (boardsInSystem) > 1 &&
+               ((IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >>
+                (SST_FBI_MEM_TYPE_SHIFT + 2)))
+               sliDetected = 1;
+        }
+    }
+    return(sliDetected);
+}
+
+#pragma optimize ("",on)
Index: trunk/src/opengl/glide/sst1/init/initvg/sst1init.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/sst1init.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/sst1init.c	(revision 2885)
@@ -0,0 +1,918 @@
+/* 
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:35 $ 
+**
+*/
+
+/*
+** Initialization code for SST-1 board.
+**
+** NOTE: This code must compiled with optimizations DISABLED!!
+**
+** The following environment variables can optionally be used to alter 
+** functionality (A value of X is a "don't care"):
+**
+** Variable                    Value   Description
+** --------                    -----   -----------
+** SST_ARCADE                  X       Allow special configs for arcade use
+** SST_BACKPORCH               hex     Specify value of backPorch video register
+** SST_BOARDS                  val     Specify number of SST-1 boards in system
+** SST_DEBUGDAC                X       Print out debug information for DAC
+**                                     reads and writes
+** SST_DIMENSIONS              hex     Specify value of videoDimensions register
+** SST_FASTMEM                 1       Default. Enable fast memory timing
+** SST_FASTMEM                 0       Disable fast memory timing
+** SST_FASTPCIRD               X       Enable fast PCI reads
+** SST_FBICFG                  hex     Specify FBI configuration strapping bits
+** SST_FBIMEM_SIZE             val     Specify amount of frame buffer memory
+** SST_FT_CLK_DEL              hex     Fbi-to-Trex clock delay value
+** SST_GAMMA                   float   Floating point value for gamma correction
+** SST_GRXCLK                  val     16 <= Frequency < 80 (50 is default)
+** SST_HSYNC                   hex     Specify value of hSync video register
+** SST_IGNORE_INIT_GAMMA       X       Bypass sst1InitGamma call and return
+** SST_IGNORE_INIT_REGISTERS   X       Bypass sst1InitRegisters call and return
+** SST_IGNORE_INIT_VIDEO       X       Bypass sst1InitVideo call and return
+** SST_IGNORE_SLI_CHECK        X       Ignore checking for proper SLI install
+** SST_INITDEBUG               X       Enable debug output
+** SST_INITDEBUG_FILE          file    File to direct all debug output
+** SST_MEMFIFO                 0       Disable FBI Memory FIFO
+** SST_MEMFIFO                 1       Enable FBI Memory FIFO
+** SST_MEMFIFO_ENTRIES         hex     Set number of entries in memory fifo
+** SST_MEMFIFO_HWM             hex     Set memory fifo high water mark
+** SST_MEMFIFO_LFB             0 or 1  Specify LFB writes through Memory FIFO
+** SST_MEMFIFO_LWM             hex     Set memory fifo low water mark
+** SST_MEMFIFO_TEX             0 or 1  Specify Texture writes through Mem FIFO
+** SST_MEMOFFSET               hex     Specify value of memoffset video register
+** SST_NOCHECKHANG             X       Do not Check for FBI Hangs for texturing
+** SST_NODEVICEINFO            X       Ignore calls to sst1InitFillDeviceInfo()
+** SST_NOSHUTDOWN              X       Do not turn off monitor refresh on call
+**                                     to sst1InitShutdown()
+** SST_PCIFIFO_LWM             hex     Set pci fifo low water mark
+** SST_PFT_CLK_DEL             hex     Preliminary Fbi-to-Trex clock delay value
+** SST_PTF0_CLK_DEL            hex     Prelim TMU2Fbi clock delay value (TMU #0)
+** SST_PTF1_CLK_DEL            hex     Prelim TMU2Fbi clock delay value (TMU #1)
+** SST_PTF2_CLK_DEL            hex     Prelim TMU2Fbi clock delay value (TMU #2)
+** SST_SLIDETECT               0 or 1  Specify Scanline Interleaving detection
+** SST_SLIM_VIN_CLKDEL         hex     Specify FBI internal video clock delay
+**                                     (SLI Master)
+** SST_SLIM_VOUT_CLKDEL        hex     Specify FBI external video clock delay
+**                                     (SLI Master)
+** SST_SLIS_VIN_CLKDEL         hex     Specify FBI internal video clock delay
+**                                     (SLI Slave)
+** SST_SLIS_VOUT_CLKDEL        hex     Specify FBI external video clock delay
+**                                     (SLI Slave)
+** SST_SCREENREFRESH           60      Select 60Hz monitor refresh rate
+**                                     (overrides argument to sst1InitVideo)
+** SST_SCREENREFRESH           75      Select 75Hz monitor refresh rate
+** SST_SCREENREZ               512     Select 512x384 video resolution
+**                                     (overrides argument to sst1InitVideo)
+** SST_SCREENREZ               640     Select 640x480 video resolution
+** SST_SCREENREZ               800     Select 800x600 video resolution
+** SST_SLOWPCIWR               X       Enable 1 wait-state PCI writes
+** SST_TEXMAP_DISABLE          X       Disable texture mapping
+** SST_TF0_CLK_DEL             hex     Trex-to-Fbi clock delay value (TMU #0)
+** SST_TF1_CLK_DEL             hex     Trex-to-Fbi clock delay value (TMU #1)
+** SST_TF2_CLK_DEL             hex     Trex-to-Fbi clock delay value (TMU #2)
+** SST_TF_FIFO_THRESH          hex     Set TREX-to-FBI FIFO threshold
+** SST_TILESINX                hex     Specify value of tilesInX video register
+** SST_TMUCFG                  hex     Specify TMU configuration strapping bits
+** SST_TMUMEM                  X       Enable accurate determination of TMU mem
+** SST_TMUMEM_SIZE             val     Specify amount of texture memory
+** SST_TREX0INIT0              hex     Set trexInit0 register value - TMU #0
+** SST_TREX0INIT1              hex     Set trexInit1 register value - TMU #0
+** SST_TREX1INIT0              hex     Set trexInit0 register value - TMU #1
+** SST_TREX1INIT1              hex     Set trexInit1 register value - TMU #1
+** SST_TREX2INIT0              hex     Set trexInit0 register value - TMU #2
+** SST_TREX2INIT1              hex     Set trexInit1 register value - TMU #2
+** SST_TRIPLE_BUFFER           X       Enable Triple Buffering
+** SST_VIN_CLKDEL              hex     Specify FBI internal video clock delay
+** SST_VOUT_CLKDEL             hex     Specify FBI external video clock delay
+** SST_VGA_PASS                0,1     Force VGA_PASS output to {0,1}
+** SST_VIDCLK2X                val     Video clock frequency (2x dot clock)
+** SST_VIDEO_24BPP             0       Select 16-bit video output
+** SST_VIDEO_24BPP             1       Select 24-bit video output
+** SST_VIDEO_DISABLE           X       Turn off Video/Monitor refresh in FBI
+** SST_VIDEO_FILTER_DISABLE    X       Disable video filtering
+** SST_VIDEO_FILTER_THRESHOLD  hex     Set video filtering threshold
+** SST_VIDEO_NOCLEAR           X       Do not clear buffers in sst1InitVideo()
+** SST_VIDEO_CLEARCOLOR        hex     Clear screen color
+** SST_VFIFO_THRESH            0-31    Select video fifo threshold
+** SST_VSYNC                   hex     Specify value of vSync video register
+**
+** VOODOO_FILE                 name    Filename used in place of "voodoo.ini"
+** VOODOO_PATH                 path    Path used to locate "voodoo.ini" file
+**
+*/
+
+#pragma optimize ("",off)
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <sst.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <fxpci.h>
+#define SST1INIT_ALLOCATE /* Allocate variables in sst1init.h */
+#include <sst1vid.h>
+#include <sst1init.h>
+#include "rcver.h"
+
+#ifdef __WIN32__
+#include <windows.h>
+#endif
+
+#ifdef __OS2__
+#include <os2.h>
+#endif
+
+/* Allow SourceSafe to track Revision */
+static char codeIdent[] = "@#%" VERSIONSTR ;
+
+/*
+** sst1InitMapBoard():
+**  Find and map SST-1 board into virtual memory
+**
+**    Returns:
+**      FxU32 pointer to base of SST-1 board if successful mapping occurs
+**      FXFALSE if cannot map or find SST-1 board
+**
+*/
+FX_EXPORT FxU32 * FX_CSTYLE sst1InitMapBoard(FxU32 BoardNumber)
+{
+    static FxU32 firstTime = 1;
+    FxU32 sizeOfCard = 0x1000000;      /* 16 MBytes of addr space for SST-1 */
+    FxU32 *sst;
+    volatile Sstregs *sstptr;
+    FxU32 n, j;
+
+    if(firstTime) {
+        /* Make Watcom happy */
+        codeIdent[0] = '@';
+        headersIdent[0] = '@';
+
+        /* Find "voodoo.ini" file if it exists... */
+        sst1InitUseVoodooFile = sst1InitVoodooFile();
+
+        if(!(boardsInSystem = sst1InitNumBoardsInSystem()))
+            return(NULL);
+    }
+
+    if(BoardNumber == 0) {
+        INIT_PRINTF(("sst1Init Routines"));
+#ifdef FX_DLL_ENABLE
+        INIT_PRINTF(("(DLL)"));
+#endif
+        INIT_PRINTF((": %s\n", VERSIONSTR));
+        INIT_PRINTF(("sst1InitMapBoard(): BoardsInSystem = %d\n",
+          boardsInSystem));
+
+        /* Clear board info structure */
+        sst1InitClearBoardInfo();
+    }
+
+    if(firstTime) {
+        firstTime = 0;
+        sst1InitClearBoardInfo();
+
+        /* Map all boards in the system */
+        /* Check that scanline interleaving is not enabled... */
+        for(j=0; j<SST1INIT_MAX_BOARDS; j++) {
+          FxU32 vendorID = _3DFX_PCI_ID;     /* 3Dfx Vendor ID */
+          FxU32 deviceID = 1;                /* Find only sst1 boards */
+
+#ifndef DIRECTX
+            sst = pciMapCardMulti(vendorID, deviceID, sizeOfCard,
+                &sst1InitDeviceNumber, j, 0);
+#else
+            sst = pciMapCardMulti(vendorID, deviceID, sizeOfCard, 
+                &sst1InitDeviceNumber, j, 0);
+#endif /* DIRECTX */
+            if(sst) {
+                sst1BoardInfo[j].virtAddr = sst;
+                PCICFG_RD(PCI_BASE_ADDRESS_0, sst1BoardInfo[j].physAddr);
+                sst1BoardInfo[j].deviceNumber = sst1InitDeviceNumber;
+                sst1BoardInfo[j].numBoardInsystem = j;
+                PCICFG_RD(PCI_REVISION_ID, sst1BoardInfo[j].fbiRevision);
+                PCICFG_RD(PCI_DEVICE_ID, sst1BoardInfo[j].deviceID);
+                PCICFG_RD(PCI_VENDOR_ID, sst1BoardInfo[j].vendorID);
+
+                /* Enable Memory accesses to SST-1 */
+                /* Must be set for PnP BIOS which do not enable memory mapped */
+                /* accesses (sst1InitSliDetect reads memory mapped regs) */
+                PCICFG_WR(PCI_COMMAND, SST_PCIMEM_ACCESS_EN);
+                sstptr = (Sstregs *) sst;
+                /* Check SLI not enabled... */
+                if((IGET(sstptr->fbiInit1) & SST_EN_SCANLINE_INTERLEAVE) &&
+                    sst1InitSliDetect(sst)) {
+                    INIT_PRINTF(("sst1InitMapBoard(): Scanline Interleave detected at startup for board=%d\n", j));
+                    INIT_PRINTF(("                    System reboot required...\n"));
+                    return(NULL);
+                }
+            } else {
+                FxU32 code = pciGetErrorCode();
+                if (code == PCI_ERR_WRONGVXD) {
+#ifdef __WIN32__
+                    MessageBox(NULL, pciGetErrorString(), NULL, MB_OK);
+#endif /* __WIN32__ */
+#ifdef __OS2__
+                    WinMessageBox(HWND_DESKTOP, 0, (PSZ) pciGetErrorString(), 0, 0, MB_OK);
+#endif /* __OS2__ */
+                    exit(1);
+                }
+                sst1BoardInfo[j].virtAddr = (FxU32 *) NULL;
+                sst1BoardInfo[j].physAddr = (FxU32) NULL;
+                sst1BoardInfo[j].deviceNumber = 0xdead;
+                sst1BoardInfo[j].numBoardInsystem = 0xdead;
+                sst1BoardInfo[j].fbiRevision = 0xdead;
+                sst1BoardInfo[j].deviceID = 0xdead;
+                sst1BoardInfo[j].vendorID = 0xdead;
+            }
+        }
+    }
+
+    /* Max number of supported boards in system */
+    if(BoardNumber > SST1INIT_MAX_BOARDS) return(NULL);
+
+    if(!(sst = sst1BoardInfo[BoardNumber].virtAddr))
+        return (NULL);
+
+    INIT_PRINTF(("sst1InitMapBoard(): vAddr:0x%x pAddr:0x%x Dev:0x%x Board:%d\n",
+        (FxU32) sst1BoardInfo[BoardNumber].virtAddr,
+        (FxU32) sst1BoardInfo[BoardNumber].physAddr,
+        (FxU32) sst1BoardInfo[BoardNumber].deviceNumber, BoardNumber));
+
+    sstptr = (Sstregs *) sst;
+
+    /* Default settings */
+    if((IGET(sstptr->fbiInit3) & SST_FBI_VGA_PASS_POWERON) &&
+       (sst1BoardInfo[BoardNumber].fbiRevision > 0)) {
+        sst1BoardInfo[BoardNumber].vgaPassthruDisable = 0x0;
+        sst1BoardInfo[BoardNumber].vgaPassthruEnable = SST_EN_VGA_PASSTHRU;
+        sst1BoardInfo[BoardNumber].fbiRegulatorPresent = 0x1;
+    } else {
+        sst1BoardInfo[BoardNumber].vgaPassthruDisable = SST_EN_VGA_PASSTHRU;
+        sst1BoardInfo[BoardNumber].vgaPassthruEnable = 0x0;
+        sst1BoardInfo[BoardNumber].fbiRegulatorPresent = 0x0;
+    }
+    sst1BoardInfo[BoardNumber].fbiVideo16BPP = 0;
+
+    if(GETENV(("SST_VGA_PASS"))) {
+        INIT_PRINTF(("sst1InitMapBoard(): Using SST_VGA_PASS=%d\n",
+            ATOI(GETENV(("SST_VGA_PASS")))));
+        if(ATOI(GETENV(("SST_VGA_PASS")))) {
+            sst1BoardInfo[BoardNumber].vgaPassthruEnable = SST_EN_VGA_PASSTHRU;
+            sst1BoardInfo[BoardNumber].vgaPassthruDisable = 0x0;
+        } else {
+            sst1BoardInfo[BoardNumber].vgaPassthruDisable = SST_EN_VGA_PASSTHRU;
+            sst1BoardInfo[BoardNumber].vgaPassthruEnable = 0x0;
+        }
+    }
+    return(sst);
+}
+
+/*
+** sst1InitRegisters():
+**  Initialize registers and memory and return to power-on state
+**
+**    Returns:
+**      FXTRUE if successfully initializes SST-1
+**      FXFALSE if cannot initialize SST-1
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitRegisters(FxU32 *sstbase)
+{
+    FxU32 n, tf_fifo_thresh;
+    FxU32 ft_clk_del, tf0_clk_del, tf1_clk_del, tf2_clk_del;
+    sst1ClkTimingStruct sstGrxClk;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    if(!sst)
+        return(FXFALSE);
+
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    if(GETENV(("SST_IGNORE_INIT_REGISTERS"))) {
+        INIT_PRINTF(("WARNING: Ignoring sst1InitRegisters()...\n"));
+        sst1InitIdleFBINoNOP(sstbase);
+        return(FXTRUE);
+    }
+
+    /* Disable video clock */
+    PCICFG_WR(SST1_PCI_VCLK_DISABLE, 0x0);
+
+    /* Enable writes to the FBIINIT registers */
+    /* Do not allow writes into the pci fifo until everything is reset */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN);
+
+    /* Reset Snoop registers to default values */
+    PCICFG_WR(SST1_PCI_BUS_SNOOP_0, SST_PCI_BUS_SNOOP_DEFAULT);
+    PCICFG_WR(SST1_PCI_BUS_SNOOP_1, SST_PCI_BUS_SNOOP_DEFAULT);
+    sst1InitReturnStatus(sstbase); /* Stall - can't call IdleFbi because */
+                                   /* FBI could be hung at this stage */
+    sst1InitReturnStatus(sstbase);
+    sst1InitReturnStatus(sstbase);
+    
+    /* Adjust Fbi-to-Trex clock delay value */
+    /* Adjust Trex-to-Fbi FIFO */
+    if(GETENV(("SST_TF_FIFO_THRESH")))
+        SSCANF(GETENV(("SST_TF_FIFO_THRESH")), "%i", &tf_fifo_thresh);
+    else
+        tf_fifo_thresh = 0x8;
+    INIT_PRINTF(("sst1InitRegisters(): Setting TREX-to-FBI FIFO THRESHOLD to 0x%x...\n",
+        tf_fifo_thresh));
+    /* Set ft_clk_del for 16 MHz bringup */
+    if(sst1CurrentBoard->fbiRevision == 2)
+        /* .5 micron */
+        ft_clk_del = 0x8; /* Okay for 16 MHz startup... */
+    else
+        /* .6 micron */
+        ft_clk_del = 0xa; /* Okay for 16 MHz startup... */
+    if(GETENV(("SST_PFT_CLK_DEL")))
+        SSCANF(GETENV(("SST_PFT_CLK_DEL")), "%i", &ft_clk_del);
+    INIT_PRINTF(("sst1InitRegisters(): Setting PRELIM FT-CLK delay to 0x%x...\n", ft_clk_del));
+    ISET(sst->fbiInit3,
+        (SST_FBIINIT3_DEFAULT & ~(SST_FT_CLK_DEL_ADJ | SST_TF_FIFO_THRESH)) |
+        (ft_clk_del << SST_FT_CLK_DEL_ADJ_SHIFT) |
+        (tf_fifo_thresh << SST_TF_FIFO_THRESH_SHIFT));
+
+    /* Wait for Fbi-to-Trex clock delay value to propogate */
+    sst1InitReturnStatus(sstbase); /* Stall - can't call IdleFbi because */
+                                   /* FBI could be hung at this stage */
+
+    sst1InitReturnStatus(sstbase);
+    sst1InitReturnStatus(sstbase);
+
+    /* Reset graphics and video units */
+    /* Must reset video unit before graphics unit, otherwise video unit could */
+    /* potentially hang waiting for the graphics unit to respond */
+    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+
+    /* don't wait for idle b/c grx could be hung */
+    sst1InitReturnStatus(sstbase);
+    sst1InitReturnStatus(sstbase);
+    sst1InitReturnStatus(sstbase);
+    ISET(sst->fbiInit0,
+      IGET(sst->fbiInit0) | (SST_GRX_RESET | SST_PCI_FIFO_RESET));
+
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Unreset PCI FIFO... */
+    ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_PCI_FIFO_RESET);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Unreset graphics subsystem */
+    /* THIS MUST BE PRESENT OTHERWISE THE PCI FIFO WILL NEVER DRAIN! */
+    ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_GRX_RESET);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Reset all FBI and TREX Init registers */
+    ISET(sst->fbiInit0, SST_FBIINIT0_DEFAULT);
+    ISET(sst->fbiInit1, SST_FBIINIT1_DEFAULT);
+    ISET(sst->fbiInit2, SST_FBIINIT2_DEFAULT);
+    ISET(sst->fbiInit3,
+        (SST_FBIINIT3_DEFAULT & ~(SST_FT_CLK_DEL_ADJ | SST_TF_FIFO_THRESH)) |
+        (ft_clk_del << SST_FT_CLK_DEL_ADJ_SHIFT) |
+        (tf_fifo_thresh << SST_TF_FIFO_THRESH_SHIFT));
+    ISET(sst->fbiInit4, SST_FBIINIT4_DEFAULT);
+    sst1InitIdleFBINoNOP(sstbase);  /* Wait until init regs are reset */
+
+    /* Enable writes to the FBIINIT registers and allow pushes onto PCI FIFO */
+    PCICFG_WR(SST1_PCI_INIT_ENABLE, (SST_INITWR_EN | SST_PCI_FIFOWR_EN));
+
+    /* Determine DAC Type */
+    if(sst1InitDacDetect(sstbase) == FXFALSE) {
+        INIT_PRINTF(("sst1InitRegisters(): Could not detect DAC...\n"));
+        return(FXFALSE);
+    }
+
+    /* set TREX0 init values */
+    if(GETENV(("SST_TREX0INIT0"))) {
+        INIT_PRINTF(("sst1InitRegisters(): Using SST_TREX0INIT0 environment variable\n"));
+        SSCANF(GETENV(("SST_TREX0INIT0")), "%i",
+            &sst1CurrentBoard->tmuInit0[0]);
+    } else
+        sst1CurrentBoard->tmuInit0[0] = SST_TREX0INIT0_DEFAULT;
+
+    INIT_PRINTF(("sst1InitRegisters(): Storing TREX0INIT0=0x%x\n",
+        sst1CurrentBoard->tmuInit0[0]));
+    if(GETENV(("SST_TREX0INIT1"))) {
+
+        INIT_PRINTF(("sst1InitRegisters(): Using SST_TREX0INIT1 environment variable\n"));
+        SSCANF(GETENV(("SST_TREX0INIT1")), "%i",
+            &sst1CurrentBoard->tmuInit1[0]);
+    } else
+        sst1CurrentBoard->tmuInit1[0] = SST_TREX0INIT1_DEFAULT;
+    if(GETENV(("SST_PTF0_CLK_DEL"))) {
+        SSCANF(GETENV(("SST_PTF0_CLK_DEL")), "%i", &tf0_clk_del);
+        sst1CurrentBoard->tmuInit1[0] = (sst1CurrentBoard->tmuInit1[0] &
+            ~SST_TEX_TF_CLK_DEL_ADJ) |
+            (tf0_clk_del<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT);
+    }
+    INIT_PRINTF(("sst1InitRegisters(): Storing TREX0INIT1=0x%x\n",
+        sst1CurrentBoard->tmuInit1[0]));
+
+    ISET(SST_TREX(sst,0)->trexInit0, sst1CurrentBoard->tmuInit0[0]);
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(SST_TREX(sst,0)->trexInit1, sst1CurrentBoard->tmuInit1[0]);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* set TREX1 init values */
+    if(GETENV(("SST_TREX1INIT0"))) {
+        INIT_PRINTF(("sst1InitRegisters(): Using SST_TREX1INIT0 environment variable\n"));
+        SSCANF(GETENV(("SST_TREX1INIT0")), "%i",
+            &sst1CurrentBoard->tmuInit0[1]);
+    } else
+        sst1CurrentBoard->tmuInit0[1] = SST_TREX1INIT0_DEFAULT;
+    INIT_PRINTF(("sst1InitRegisters(): Storing TREX1INIT0=0x%x\n",
+        sst1CurrentBoard->tmuInit0[1]));
+    if(GETENV(("SST_TREX1INIT1"))) {
+        INIT_PRINTF(("sst1InitRegisters(): Using SST_TREX1INIT1 environment variable\n"));
+        SSCANF(GETENV(("SST_TREX1INIT1")), "%i",
+            &sst1CurrentBoard->tmuInit1[1]);
+    } else
+        sst1CurrentBoard->tmuInit1[1] = SST_TREX1INIT1_DEFAULT;
+    if(GETENV(("SST_PTF1_CLK_DEL"))) {
+        SSCANF(GETENV(("SST_PTF1_CLK_DEL")), "%i", &tf1_clk_del);
+        sst1CurrentBoard->tmuInit1[1] = (sst1CurrentBoard->tmuInit1[1] &
+            ~SST_TEX_TF_CLK_DEL_ADJ) |
+            (tf1_clk_del<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT);
+    }
+    INIT_PRINTF(("sst1InitRegisters(): Storing TREX1INIT1=0x%x\n",
+        sst1CurrentBoard->tmuInit1[1]));
+
+    ISET(SST_TREX(sst,1)->trexInit0, sst1CurrentBoard->tmuInit0[1]);
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(SST_TREX(sst,1)->trexInit1, sst1CurrentBoard->tmuInit1[1]);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* set TREX2 init values */
+    if(GETENV(("SST_TREX2INIT0"))) {
+        INIT_PRINTF(("sst1InitRegisters(): Using SST_TREX2INIT0 environment variable\n"));
+        SSCANF(GETENV(("SST_TREX2INIT0")), "%i",
+            &sst1CurrentBoard->tmuInit0[2]);
+    } else
+        sst1CurrentBoard->tmuInit0[2] = SST_TREX2INIT0_DEFAULT;
+    INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT0=0x%x\n",
+        sst1CurrentBoard->tmuInit0[2]));
+    if(GETENV(("SST_TREX2INIT1"))) {
+        INIT_PRINTF(("sst1InitRegisters(): Using SST_TREX2INIT1 environment variable\n"));
+        SSCANF(GETENV(("SST_TREX2INIT1")), "%i",
+            &sst1CurrentBoard->tmuInit1[2]);
+    } else
+        sst1CurrentBoard->tmuInit1[2] = SST_TREX2INIT1_DEFAULT;
+    if(GETENV(("SST_PTF2_CLK_DEL"))) {
+        SSCANF(GETENV(("SST_PTF2_CLK_DEL")), "%i", &tf2_clk_del);
+        sst1CurrentBoard->tmuInit1[2] = (sst1CurrentBoard->tmuInit1[2] &
+            ~SST_TEX_TF_CLK_DEL_ADJ) |
+            (tf2_clk_del<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT);
+    }
+    INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n", 
+        sst1CurrentBoard->tmuInit1[2]));
+
+    ISET(SST_TREX(sst,2)->trexInit0, sst1CurrentBoard->tmuInit0[2]);
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(SST_TREX(sst,2)->trexInit1, sst1CurrentBoard->tmuInit1[2]);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Set clock at 16 MHz to sense TREX configuration... */
+    if(sst1InitComputeClkParams((float) 16.0, &sstGrxClk) == FXFALSE)
+        return(FXFALSE);
+    if(sst1InitSetGrxClk(sstbase, &sstGrxClk) == FXFALSE)
+        return(FXFALSE);
+
+    /* Set PCI wait-states */
+    if(GETENV(("SST_SLOWPCIWR"))) {
+        INIT_PRINTF(("sst1InitRegisters(): Setting up SLOW PCI Writes...\n"));
+        ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_PCI_WRWS_1);
+    } else
+        ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_PCI_WRWS_1);
+
+    if(GETENV(("SST_FASTPCIRD"))) {
+        INIT_PRINTF(("sst1InitRegisters(): Setting up FAST PCI Reads...\n"));
+        ISET(sst->fbiInit4, IGET(sst->fbiInit4) & ~SST_PCI_RDWS_2);
+    }
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Enable Linear frame buffer reads */
+    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_LFB_READ_EN);
+
+    /* Swapbuffer algorithm is based on VSync initially */
+    ISET(sst->fbiInit2, (IGET(sst->fbiInit2) & ~SST_SWAP_ALGORITHM) |
+      SST_SWAP_VSYNC);
+
+    /* Enable LFB read-aheads */
+    ISET(sst->fbiInit4, IGET(sst->fbiInit4) | SST_EN_LFB_RDAHEAD);
+
+    /* Enable triangle alternate register mapping */
+    ISET(sst->fbiInit3, IGET(sst->fbiInit3) | SST_ALT_REGMAPPING);
+
+#if 0
+    /* Enable Endian Byte Swapping */
+    /* Do not enable byte swapping due to potential bug in FBI... */
+    ISET(sst->fbiInit0, IGET(sst->fbiInit0) | SST_EN_ENDIAN_SWAPPING);
+#endif
+
+    /* Setup DRAM Refresh */
+    ISET(sst->fbiInit2, (IGET(sst->fbiInit2) & ~SST_DRAM_REFRESH_CNTR) |
+        SST_DRAM_REFRESH_16MS);
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    if(GETENV(("SST_FASTMEM")))
+        n = ATOI(GETENV(("SST_FASTMEM")));
+    else
+        n = 1;
+
+    if(n) {
+        INIT_PRINTF(("sst1InitRegisters(): Setting up FAST DRAM Configuration\n"));
+        ISET(sst->fbiInit2, IGET(sst->fbiInit2) | (SST_EN_FAST_RAS_READ |
+          SST_EN_DRAM_RD_AHEAD_FIFO | SST_EN_FAST_RD_AHEAD_WR));
+    } else
+        ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_DISEN_RD_AHEAD_WR_RD);
+
+    /* Return all other registers to their power-on state */
+    sst1InitIdleFBINoNOP(sstbase);
+    sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Get DRAMs up and running (refresh is already enabled)... */
+    ISET(sst->c1, 0x0);
+    ISET(sst->c0, 0x0);
+    ISET(sst->zaColor, 0x0);
+    ISET(sst->clipLeftRight, 100); /* draw into 50x50 area */
+    ISET(sst->clipBottomTop, 100);
+    ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK);
+    ISET(sst->fastfillCMD, 0x0);   /* Frontbuffer & Z/A */
+    ISET(sst->nopCMD, 0x1); /* Clear fbistat registers after clearing screen */
+    sst1InitIdleFBINoNOP(sstbase);
+
+    sst1InitRenderingRegisters(sstbase);
+    if(sst1InitFillDeviceInfo(sstbase, sst1CurrentBoard) == FXFALSE) {
+        INIT_PRINTF(("sst1InitRegisters(): ERROR filling DeviceInfo...\n"));
+        return(FXFALSE);
+    }
+
+    sst1InitIdleFBINoNOP(sstbase);
+    sst1InitRenderingRegisters(sstbase);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* LFB writes stored in memory FIFO? */
+    if(GETENV(("SST_MEMFIFO_LFB")))
+        n = ATOI(GETENV(("SST_MEMFIFO_LFB")));
+    else
+        n = 1;
+    if(n) {
+        INIT_PRINTF(("sst1InitRegisters(): LFB Writes go through memory FIFO...\n"));
+        ISET(sst->fbiInit0, IGET(sst->fbiInit0) | SST_EN_LFB_MEMFIFO);
+        sst1InitIdleFBINoNOP(sstbase);
+    }
+
+    /* Texture memory writes stored in memory FIFO? */
+    if(GETENV(("SST_MEMFIFO_TEX")))
+        n = ATOI(GETENV(("SST_MEMFIFO_TEX")));
+    else
+        n = 1;
+    if(n) {
+        INIT_PRINTF(("sst1InitRegisters(): TEXTURE Writes go through memory FIFO...\n"));
+        ISET(sst->fbiInit0, IGET(sst->fbiInit0) | SST_EN_TEX_MEMFIFO);
+        sst1InitIdleFBINoNOP(sstbase);
+    }
+
+    ISET(sst->vRetrace, 0x0);
+    ISET(sst->backPorch, 0x0);
+    ISET(sst->videoDimensions, 0x0);
+    ISET(sst->hSync, 0x0);
+    ISET(sst->vSync, 0x0);
+    ISET(sst->videoFilterRgbThreshold, 0x0);
+
+    sst1InitIdleFBINoNOP(sstbase);  /* Wait until init regs are reset */
+
+    if(GETENV(("SST_TEXMAP_DISABLE"))) {
+        INIT_PRINTF(("sst1InitRegisters() WARNING: Disabling texture mapping\n"));
+        ISET(sst->fbiInit3, IGET(sst->fbiInit3) | SST_TEXMAP_DISABLE);
+        sst1InitIdleFBINoNOP(sstbase);
+    }
+    INIT_PRINTF(("sst1InitRegisters(): exiting with status %d...\n", FXTRUE));
+    return(FXTRUE);
+}
+
+FX_EXPORT void FX_CSTYLE sst1InitRenderingRegisters(FxU32 *sstbase)
+{
+    FxU32 i;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    ISET(sst->vA.x, 0x0); ISET(sst->vA.y, 0x0);
+    ISET(sst->vB.x, 0x0); ISET(sst->vB.y, 0x0);
+    ISET(sst->vC.x, 0x0); ISET(sst->vC.y, 0x0);
+
+    ISET(sst->r, 0x0); ISET(sst->g, 0x0);
+    ISET(sst->b, 0x0); ISET(sst->z, 0x0);
+    ISET(sst->a, 0x0); ISET(sst->s, 0x0);
+    ISET(sst->t, 0x0); ISET(sst->w, 0x0);
+
+    ISET(sst->drdx, 0x0); ISET(sst->dgdx, 0x0);
+    ISET(sst->dbdx, 0x0); ISET(sst->dzdx, 0x0);
+    ISET(sst->dadx, 0x0); ISET(sst->dsdx, 0x0);
+    ISET(sst->dtdx, 0x0); ISET(sst->dwdx, 0x0);
+
+    ISET(sst->drdy, 0x0); ISET(sst->dgdy, 0x0);
+    ISET(sst->dbdy, 0x0); ISET(sst->dzdy, 0x0);
+    ISET(sst->dady, 0x0); ISET(sst->dsdy, 0x0);
+    ISET(sst->dtdy, 0x0); ISET(sst->dwdy, 0x0);
+
+    ISET(sst->fbzColorPath, 0x0);
+    ISET(sst->fogMode, 0x0);
+    ISET(sst->alphaMode, 0x0);
+    ISET(sst->fbzMode, 0x0);
+    ISET(sst->lfbMode, 0x0);
+    ISET(sst->clipLeftRight, 0x0);
+    ISET(sst->clipBottomTop, 0x0);
+
+    ISET(sst->fogColor, 0x0);
+    ISET(sst->zaColor, 0x0);
+    ISET(sst->chromaKey, 0x0);
+    ISET(sst->stipple, 0x0);
+    ISET(sst->c0, 0x0);
+    ISET(sst->c1, 0x0);
+
+    ISET(sst->nopCMD, 0x1);   /* Clear fbistat registers */
+
+    for(i=0; i<32; i++)
+        ISET(sst->fogTable[i], 0x0);
+
+    /* clear TMU registers */
+    ISET(sst->textureMode, 0x0);
+    ISET(sst->tLOD, 0x0);
+    ISET(sst->tDetail, 0x0);
+    ISET(sst->texBaseAddr, 0x0);
+    ISET(sst->texBaseAddr1, 0x0);
+    ISET(sst->texBaseAddr2, 0x0);
+    ISET(sst->texBaseAddr38, 0x0);
+
+    for(i=0; i<12; i++) {
+        ISET(sst->nccTable0[i], 0x0);
+        ISET(sst->nccTable1[i], 0x0);
+    }
+    sst1InitIdle(sstbase);
+}
+
+/*
+** sst1InitShutdown():
+**  Shutdown SST-1
+**    Resets state of VGA_PASS to return monitor control back to the VGA
+**    Powers-down the DAC
+**    Resets the graphics clock in FBI to conserve power
+**
+**    Returns:
+**      FXTRUE if successfully shuts down SST-1
+**      FXFALSE if cannot shut down the SST-1
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitShutdown(FxU32 *sstbase)
+{
+    volatile Sstregs *sstMaster = (Sstregs *) sstbase;
+    volatile Sstregs *sstSlave = (Sstregs *) sst1InitSliSlaveVirtAddr;
+    volatile Sstregs *sstPtr;
+    FxU32 n;
+    FxU32 SliEnable = sst1InitSliEnabled;
+    sst1ClkTimingStruct sstGrxClk;
+
+    if(!sstbase)
+        return(FXFALSE);
+
+    /* Wait for the SST-1 to finish rendering... */
+    sst1InitIdle(sstbase);
+
+    if(sst1InitSliEnabled) {
+        if(sst1InitShutdownSli(sstbase) == FXFALSE)
+            return(FXFALSE);
+    }
+#ifdef __DOS32__
+    /* 
+     * HACK alert. -MS
+     *
+     * There's a pciClose(), but nobody calls it. This is needed by the
+     * DOS DPMI services to close fxmemmap.vxd.
+     * 
+     * We need to move this to the "appropriate" place, wherever that may be.
+     */
+    pciClose();
+#endif
+
+    if(GETENV(("SST_NOSHUTDOWN")))
+        INIT_PRINTF(("sst1InitShutdown(): Bypassing shutdown with SST_NOSHUTDOWN\n", n));
+
+    n = 0;
+    while(!GETENV(("SST_NOSHUTDOWN"))) {
+        if(!n)
+            sstPtr = sstMaster;
+        else
+            sstPtr = sstSlave;
+
+        if(sst1InitCheckBoard((FxU32 *) sstPtr) == FXFALSE)
+            return(FXFALSE);
+
+        INIT_PRINTF(("sst1InitShutdown(): Shutting down SST-1 #%d...\n", n));
+
+        /* Reset video unit to guarantee no contentions on the memory bus */
+        /* Blank DAC so VGA Passthru works properly */
+        ISET(sstPtr->fbiInit1,
+          IGET(sstPtr->fbiInit1) | (SST_VIDEO_RESET | SST_VIDEO_BLANK_EN));
+        /* Turn off dram refresh to guarantee no contentions on the
+           memory bus */
+        ISET(sstPtr->fbiInit2, IGET(sstPtr->fbiInit2) & ~SST_EN_DRAM_REFRESH);
+
+        /* Reset graphics subsystem */
+        ISET(sstPtr->fbiInit0,
+          IGET(sstPtr->fbiInit0) | (SST_GRX_RESET | SST_PCI_FIFO_RESET));
+        sst1InitIdleFBINoNOP((FxU32 *) sstPtr);
+        ISET(sstPtr->fbiInit0, IGET(sstPtr->fbiInit0) & ~SST_PCI_FIFO_RESET);
+        sst1InitIdleFBINoNOP((FxU32 *) sstPtr);
+        ISET(sstPtr->fbiInit0, IGET(sstPtr->fbiInit0) & ~SST_GRX_RESET);
+        sst1InitIdleFBINoNOP((FxU32 *) sstPtr);
+
+        /* Turnaround VGA_PASS to allow VGA monitor */
+        sst1InitVgaPassCtrl((FxU32 *) sstPtr, 1);
+
+        sst1InitIdleFBINoNOP((FxU32 *) sstPtr);
+
+        /* Set clock at 30 MHz to reduce power consumption... */
+        sst1InitComputeClkParams((float) 30.0, &sstGrxClk);
+        if(sst1InitSetGrxClk((FxU32 *) sstPtr, &sstGrxClk) == FXFALSE)
+            return(FXFALSE);
+        sst1CurrentBoard->initGrxClkDone = 0;
+        
+        if((++n > 1) || !SliEnable)
+            break;
+    }
+    sst1InitIdle(sstbase);
+    INIT_PRINTF(("sst1InitShutdown(): Returning with status %d...\n", FXTRUE));
+#ifdef INIT_OUTPUT
+    if ( sst1InitMsgFile != stdout && sst1InitMsgFile )
+        fclose(sst1InitMsgFile);
+#endif
+    return(FXTRUE);
+}
+
+/*
+** sst1InitCheckBoard():
+**  Set internal global variables for multiple SST-1 support
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitCheckBoard(FxU32 *sstbase)
+{
+    FxU32 n;
+    FxBool return_val = FXFALSE;
+
+    for(n=0; n<boardsInSystem; n++) {
+        if(sst1BoardInfo[n].virtAddr == sstbase) {
+            sst1InitDeviceNumber = sst1BoardInfo[n].deviceNumber;
+            sst1CurrentBoard = &sst1BoardInfo[n];
+            return_val = FXTRUE;
+            n = boardsInSystem;
+        }
+    }
+    return(return_val);
+}
+
+/*
+** sst1InitGetBaseAddr():
+**  Return virtual base address to hardware
+**  Returns NULL if board requested has not been mapped
+**
+*/
+FX_EXPORT FxU32 * FX_CSTYLE sst1InitGetBaseAddr(FxU32 boardNum)
+{
+    return(sst1BoardInfo[boardNum].virtAddr);
+}
+
+/*
+** sst1InitClearBoardInfo():
+**  Clear board configuration information
+**
+*/
+void sst1InitClearBoardInfo(void)
+{
+    FxU32 n, j;
+
+    for(n=0; n<SST1INIT_MAX_BOARDS; n++) {
+        //sst1BoardInfo[n].virtAddr = (FxU32 *) NULL;
+        //sst1BoardInfo[n].physAddr = (FxU32) NULL;
+        //sst1BoardInfo[n].deviceNumber = 0xdead;
+        //sst1BoardInfo[n].vendorID = 0xdead;
+        //sst1BoardInfo[n].deviceID = 0xdead;
+        //sst1BoardInfo[n].fbiRevision = 0xdead;
+        sst1BoardInfo[n].fbiBoardID = 0xdead;
+        sst1BoardInfo[n].fbiVideo16BPP = 0xdead;
+        sst1BoardInfo[n].fbiVideoWidth = 0xdead;
+        sst1BoardInfo[n].fbiVideoHeight = 0xdead;
+        sst1BoardInfo[n].fbiVideoRefresh = 0xdead;
+        sst1BoardInfo[n].fbiMemoryFifoEn = 0x0;
+        sst1BoardInfo[n].sstSliDetect = 0;
+        sst1BoardInfo[n].tmuRevision = 0xdead;
+        sst1BoardInfo[n].numberTmus = 0xdead;
+        sst1BoardInfo[n].tmuConfig = 0xdead;
+        sst1BoardInfo[n].fbiMemSize = 0x0;
+        for(j=0; j<MAX_NUM_TMUS; j++) {
+            sst1BoardInfo[n].tmuMemSize[j] = 0x0;
+            sst1BoardInfo[n].tmuInit0[j] = 0xdead;
+            sst1BoardInfo[n].tmuInit1[j] = 0xdead;
+        }
+        sst1BoardInfo[n].initGrxClkDone = 0;
+        sst1BoardInfo[n].vgaPassthruDisable = 0;
+        sst1BoardInfo[n].vgaPassthruEnable = 0;
+        sst1BoardInfo[n].fbiDacType = 0xdead;
+        sst1BoardInfo[n].memFifoStatusLwm = 0xdead;
+        //sst1BoardInfo[n].numBoardInsystem = 0xdead;
+        sst1BoardInfo[n].grxClkFreq = 0xdead;
+        sst1BoardInfo[n].fbiMemSpeed = 50;
+        sst1BoardInfo[n].tmuMemSpeed = 50;
+        sst1BoardInfo[n].tmuClkFixed = 0;
+        sst1BoardInfo[n].fbiRegulatorPresent = 0;
+        sst1BoardInfo[n].fbiTripleBufferingEnabled = FXFALSE;
+    }
+}
+
+/*
+** sst1InitNumBoardsInSystem():
+**  Returns the number of SST-1 boards in the system
+**
+*/
+FX_ENTRY FxU32 FX_CSTYLE sst1InitNumBoardsInSystem(void)
+{
+    FxU32 vendorID = _3DFX_PCI_ID;     /* 3Dfx Vendor ID */
+    FxU32 deviceID = 1;                /* Find only sst1 boards */
+    FxU32 numBoards, j, n;
+
+    if(GETENV(("SST_BOARDS")))
+        numBoards = ATOI(GETENV(("SST_BOARDS")));
+    else {
+        numBoards = 0;
+        for(j=0; j<SST1INIT_MAX_BOARDS; j++) {
+            if(pciFindCardMulti(vendorID, deviceID, &n, j))
+                numBoards++;
+        }
+    }
+    return(numBoards);
+}
+
+static FxU32 
+  mtrr;
+
+/*
+** sst1InitCachingOn
+**
+** Sets up memory caching on P6 systems.
+**
+*/
+FX_EXPORT void FX_CSTYLE 
+sst1InitCachingOn(void)
+{
+  FxU32 
+    physAddr;
+  FxBool
+    res;
+
+  /* Turn on Write combining for wrap 1-n  */
+  pciGetConfigData(PCI_BASE_ADDRESS_0, sst1InitDeviceNumber, &physAddr);
+
+  /* For some reason, there sometimes is a 008 at the end of the
+  physical address, so mask that puppy RTF out */
+  physAddr &= 0xfffff000;
+
+  /* Set up USWC MTRR */
+  res = pciFindMTRRMatch(physAddr, 0x1000000,
+                         PciMemTypeWriteCombining, &mtrr);
+
+  if (!res)
+    res = pciFindFreeMTRR(&mtrr);
+  else
+    return;                   /* It's already there.  We're done. */
+  
+  if (res)
+    pciSetMTRR(mtrr, physAddr, 0x1000000, PciMemTypeWriteCombining);
+
+} /* sst1InitSetCacheType */
+
+
+#pragma optimize ("",on)
Index: trunk/src/opengl/glide/sst1/init/initvg/sst1init.h
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/sst1init.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/sst1init.h	(revision 2885)
@@ -0,0 +1,1242 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:35 $ 
+**
+*/
+
+#ifndef __SST1INIT_H__
+#define __SST1INIT_H__
+
+/*
+** Copyright (c) 1996, 3Dfx Interactive, Inc.
+** All Rights Reserved.
+**
+** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.;
+** the contents of this file may not be disclosed to third parties, copied or
+** duplicated in any form, in whole or in part, without the prior written
+** permission of 3Dfx Interactive, Inc.
+**
+** RESTRICTED RIGHTS LEGEND:
+** Use, duplication or disclosure by the Government is subject to restrictions
+** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
+** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
+** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished  -
+** rights reserved under the Copyright Laws of the United States.
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:35 $
+**
+** SST-1 Initialization routine protypes
+**
+** If all initialization routines are called, it is assumed they are called
+** in the following order:
+**   1. sst1InitMapBoard();
+**   2. sst1InitRegisters();
+**   3. sst1InitGamma();
+**   4. sst1InitVideo();
+**
+** sst1InitShutdown() is called at the end of an application to turn off
+**  the SST-1 graphics subsystem
+**
+*/
+
+/* sst1init.h assumes "glide.h" and "sst.h" are already included */
+
+/* Init code debug print routine */
+#define INIT_OUTPUT
+#define INIT_PRINTF(a) sst1InitPrintf a
+#define INIT_INFO(A)
+
+#ifndef DIRECTX
+#undef GETENV
+#undef ATOI
+#undef ATOF
+#undef SSCANF
+#undef POW
+#define GETENV(A) sst1InitGetenv A
+#define ATOI(A) atoi(A)
+#define ATOF(A) atof(A)
+#define SSCANF( A, B, C ) sscanf( A, B, C )
+#define POW( A, B ) pow( A, B )
+#define FTOL( X ) ((FxU32)(X))
+
+/* Video resolution declarations */
+#include "sst1vid.h"
+
+#else /* DIRECTX */
+#include "ddglobal.h"
+#pragma optimize ("",off)   /* ddglobal.h tuns this on for retail builds */
+#undef INIT_PRINTF
+#undef INIT_INFO
+#undef GETENV
+#undef ATOI
+#undef ATOF
+#undef FTOL
+#undef ITOF_INV
+#undef SSCANF
+#undef POW
+/* #define INIT_PRINTF(a) */
+#ifdef FXTRACE
+  #define INIT_PRINTF DDPRINTF
+#else
+  #define INIT_PRINTF 1 ? (void) 0 : (void)
+#endif
+#define INIT_INFO(A)
+#define GETENV(A)  ddgetenv(A)
+#define ATOI(A) ddatoi(A)
+#define ATOF(A) ddatof(A)
+#define FTOL(A) ddftol(A)
+#define ITOF_INV(A) dd_itof_inv(A)
+#define SSCANF( A, B, C ) ddsscanf( A, B, C )
+#define POW( A, B ) ddpow( A, B )
+
+#endif /* DIRECTX */
+
+/* Defines to writing to/reading from SST-1 */
+#if 0
+#define IGET(A)    A
+#define ISET(A,D)  A = (D)
+#else
+#define IGET(A)    sst1InitRead32((FxU32 *) &(A))
+#define ISET(A,D)  sst1InitWrite32((FxU32 *) &(A), D)  
+#endif
+
+/*
+**  P6 Fence
+** 
+**  Here's the stuff to do P6 Fencing.  This is required for the
+**  certain things on the P6
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef SST1INIT_ALLOCATE
+  FxU32 p6FenceVar;
+#else
+  extern FxU32 p6FenceVar;
+#endif
+
+#if defined(__OS2__)
+
+extern void p6Fence(void);
+#define P6FENCE p6Fence()
+
+#elif defined(__WATCOMC__)
+
+void
+p6Fence(void);
+#pragma aux p6Fence = \
+  "xchg eax, p6FenceVar" \
+  modify [eax];
+
+#define P6FENCE p6Fence()
+
+#elif defined(__MSC__)
+
+#define P6FENCE {_asm xchg eax, p6FenceVar}
+
+#elif defined(__GNUC__)
+#if defined(__i386__)
+#define P6FENCE asm("xchg %%eax,%0" \
+		    : /* no outputs */ \
+		    : "m" (p6FenceVar) \
+		    : "eax" \
+		    );
+#endif
+#else
+#error "P6 Fencing in-line assembler code needs to be added for this compiler"
+#endif  
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifndef _FXPCI_H_
+#include <fxpci.h>
+#endif
+
+#define MAX_NUM_TMUS 3
+
+/* Following defines need to go in "sst.h" eventually */
+/*--------- SST PCI Configuration Command bits --------------*/
+#define SST_PCIMEM_ACCESS_EN               BIT(1)
+
+/*------- SST PCI Configuration Register defaults -----------*/
+#define SST_PCI_INIT_ENABLE_DEFAULT        0x0
+#define SST_PCI_BUS_SNOOP_DEFAULT          0x0
+
+/*--- SST PCI Init Enable Configuration Register defaults ---*/
+#define SST_SLI_OWNPCI                     SST_SCANLINE_SLV_OWNPCI
+#define SST_SLI_MASTER_OWNPCI              0x0
+#define SST_SLI_SLAVE_OWNPCI               SST_SCANLINE_SLV_OWNPCI
+
+/*----------------- SST fbiinit0 bits -----------------------*/
+#define SST_FBIINIT0_DEFAULT               0x00000410
+#define SST_GRX_RESET                      BIT(1)
+#define SST_PCI_FIFO_RESET                 BIT(2)
+#define SST_EN_ENDIAN_SWAPPING             BIT(3)
+
+/*----------------- SST fbiinit1 bits -----------------------*/
+#define SST_FBIINIT1_DEFAULT               0x00201102
+#define SST_SLI_DETECT                     BIT(2)
+
+/*----------------- SST fbiinit2 bits -----------------------*/
+#define SST_FBIINIT2_DEFAULT               0x80000040
+#define SST_DRAM_REFRESH_16MS              (0x30 << SST_DRAM_REFRESH_CNTR_SHIFT)
+
+/*----------------- SST fbiinit3 bits -----------------------*/
+#define SST_FBIINIT3_DEFAULT               0x001E4000
+#define SST_TEXMAP_DISABLE                 BIT(6)
+#define SST_FBI_MEM_TYPE_SHIFT             8
+#define SST_FBI_MEM_TYPE                   (0x7<<SST_FBI_MEM_TYPE_SHIFT)
+#define SST_FBI_VGA_PASS_POWERON           BIT(12)
+#define SST_FT_CLK_DEL_ADJ_SHIFT           13
+#define SST_FT_CLK_DEL_ADJ                 (0xF<<SST_FT_CLK_DEL_ADJ_SHIFT)
+#define SST_TF_FIFO_THRESH_SHIFT           17
+#define SST_TF_FIFO_THRESH                 (0x1F<<SST_TF_FIFO_THRESH_SHIFT)
+
+/*----------------- SST fbiinit4 bits -----------------------*/
+#define SST_FBIINIT4_DEFAULT               0x00000001
+#define SST_PCI_RDWS_1                     0x0
+#define SST_PCI_RDWS_2                     BIT(0)
+#define SST_EN_LFB_RDAHEAD                 BIT(1)
+#define SST_MEM_FIFO_LWM_SHIFT             2
+#define SST_MEM_FIFO_LWM                   (0x3F<<SST_MEM_FIFO_LWM_SHIFT)
+#define SST_MEM_FIFO_ROW_BASE_SHIFT        8
+#define SST_MEM_FIFO_ROW_BASE              (0x3FF<<SST_MEM_FIFO_ROW_BASE_SHIFT)
+#define SST_MEM_FIFO_ROW_ROLL_SHIFT        18
+#define SST_MEM_FIFO_ROW_ROLL              (0x3FF<<SST_MEM_FIFO_ROW_ROLL_SHIFT)
+
+/*----------------- SST trexInit0 bits -----------------------*/
+#define SST_EN_TEX_MEM_REFRESH             BIT(0)
+#define SST_TEX_MEM_REFRESH_SHIFT          1
+#define SST_TEX_MEM_REFRESH                (0x1FF<<SST_TEX_MEM_REFRESH_SHIFT)
+#define SST_TEX_MEM_PAGE_SIZE_SHIFT        10
+#define SST_TEX_MEM_PAGE_SIZE_8BITS        (0x0<<SST_TEX_MEM_PAGE_SIZE_SHIFT)
+#define SST_TEX_MEM_PAGE_SIZE_9BITS        (0x1<<SST_TEX_MEM_PAGE_SIZE_SHIFT)
+#define SST_TEX_MEM_PAGE_SIZE_10BITS       (0x2<<SST_TEX_MEM_PAGE_SIZE_SHIFT)
+#define SST_TEX_MEM_SECOND_RAS_BIT_SHIFT   12
+#define SST_TEX_MEM_SECOND_RAS_BIT_BIT17   (0x0<<SST_TEX_MEM_SECOND_RAS_BIT_SHIFT)
+#define SST_TEX_MEM_SECOND_RAS_BIT_BIT18   (0x1<<SST_TEX_MEM_SECOND_RAS_BIT_SHIFT)
+#define SST_EN_TEX_MEM_SECOND_RAS          BIT(14)
+#define SST_TEX_MEM_TYPE_SHIFT             15
+#define SST_TEX_MEM_TYPE_EDO               (0x0<<SST_TEX_MEM_TYPE_SHIFT)
+#define SST_TEX_MEM_TYPE_SYNC              (0x1<<SST_TEX_MEM_TYPE_SHIFT)
+#define SST_TEX_MEM_DATA_SIZE_16BIT        0x0
+#define SST_TEX_MEM_DATA_SIZE_8BIT         BIT(18)
+#define SST_TEX_MEM_DO_EXTRA_CAS           BIT(19)
+#define SST_TEX_MEM2                       BIT(20)
+
+#define SST_TREXINIT0_DEFAULT \
+  ( (SST_EN_TEX_MEM_REFRESH)  \
+  | (0x020 << SST_TEX_MEM_REFRESH_SHIFT) \
+  | (SST_TEX_MEM_PAGE_SIZE_9BITS) \
+  | (SST_TEX_MEM_SECOND_RAS_BIT_BIT18) \
+  | (SST_EN_TEX_MEM_SECOND_RAS) \
+  | (SST_TEX_MEM_TYPE_EDO) \
+  | (SST_TEX_MEM_DATA_SIZE_16BIT) \
+  | (0 & SST_TEX_MEM_DO_EXTRA_CAS) \
+  | (0 & SST_TEX_MEM2)  )
+
+#define SST_TREX0INIT0_DEFAULT             SST_TREXINIT0_DEFAULT
+#define SST_TREX1INIT0_DEFAULT             SST_TREXINIT0_DEFAULT
+#define SST_TREX2INIT0_DEFAULT             SST_TREXINIT0_DEFAULT
+
+/*----------------- SST trexInit1 bits -----------------------*/
+#define SST_TEX_SCANLINE_INTERLEAVE_MASTER 0x0
+#define SST_TEX_SCANLINE_INTERLEAVE_SLAVE  BIT(0)
+#define SST_EN_TEX_SCANLINE_INTERLEAVE     BIT(1)
+#define SST_TEX_FT_FIFO_SIL_SHIFT          2
+#define SST_TEX_FT_FIFO_SIL                (0x1F<<SST_TEX_FT_FIFO_SIL_SHIFT)
+#define SST_TEX_TT_FIFO_SIL_SHIFT          7
+#define SST_TEX_TT_FIFO_SIL                (0xF<<SST_TEX_TT_FIFO_SIL_SHIFT)
+#define SST_TEX_TF_CLK_DEL_ADJ_SHIFT       12
+#define SST_TEX_TF_CLK_DEL_ADJ             (0xF<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT)
+#define SST_TEX_RG_TTCII_INH               BIT(16)
+#define SST_TEX_USE_RG_TTCII_INH           BIT(17)
+#define SST_TEX_SEND_CONFIG                BIT(18)
+#define SST_TEX_RESET_FIFO                 BIT(19)
+#define SST_TEX_RESET_GRX                  BIT(20)
+#define SST_TEX_PALETTE_DEL_SHIFT          21
+#define SST_TEX_PALETTE_DEL                (0x3<<SST_TEX_PALETTE_DEL_SHIFT)
+#define SST_TEX_SEND_CONFIG_SEL_SHIFT      23
+#define SST_TEX_SEND_CONFIG_SEL            (0x7<<SST_TEX_SEND_CONFIG_SEL_SHIFT)
+
+/* After things stabilize, the fifo stall inputs levels should be backed off
+   from the max. conservative values that are being used now for better
+        performance.
+   SST_TEX_FT_FIFO_SIL =  ??
+   SST_TEX_TT_FIFO_SIL =  ??  (effects multi-trex only)
+        */
+
+/* for trex ver. 1 bringup, SST_TEX_PALETTE_DEL should be set to it's max
+   (== 3) for <50 MHz bringup */
+
+/* TF Clock delays for (FBI Revision, TMU Revision) */
+#define SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R10  0xf
+#define SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R11  0x6
+#define SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R20  0xf
+#define SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R21  0x5
+
+/* FT Clock delays for (FBI Revision, TMU Revision) */
+#define SST_FT_CLK_DEL_ADJ_DEFAULT_R10  0xa
+#define SST_FT_CLK_DEL_ADJ_DEFAULT_R11  0xa
+#define SST_FT_CLK_DEL_ADJ_DEFAULT_R20  0x5
+#define SST_FT_CLK_DEL_ADJ_DEFAULT_R21  0x5
+
+#define SST_TREXINIT1_DEFAULT \
+  ( (SST_TEX_SCANLINE_INTERLEAVE_MASTER) \
+  | (0 & SST_EN_TEX_SCANLINE_INTERLEAVE) \
+  | (0x8 << SST_TEX_FT_FIFO_SIL_SHIFT) \
+  | (0x8 << SST_TEX_TT_FIFO_SIL_SHIFT) \
+  | (0xf << SST_TEX_TF_CLK_DEL_ADJ_SHIFT) \
+  | (0 & SST_TEX_RG_TTCII_INH) \
+  | (0 & SST_TEX_USE_RG_TTCII_INH) \
+  | (0 & SST_TEX_SEND_CONFIG) \
+  | (0 & SST_TEX_RESET_FIFO) \
+  | (0 & SST_TEX_RESET_GRX) \
+  | (0 << SST_TEX_PALETTE_DEL_SHIFT) \
+  | (0 << SST_TEX_SEND_CONFIG_SEL_SHIFT) )
+
+#define SST_TREX0INIT1_DEFAULT              SST_TREXINIT1_DEFAULT
+#define SST_TREX1INIT1_DEFAULT              SST_TREXINIT1_DEFAULT
+#define SST_TREX2INIT1_DEFAULT              SST_TREXINIT1_DEFAULT
+
+/*----------------- SST clutData bits -----------------------*/
+#define SST_CLUTDATA_INDEX_SHIFT           24
+#define SST_CLUTDATA_RED_SHIFT             16
+#define SST_CLUTDATA_GREEN_SHIFT           8
+#define SST_CLUTDATA_BLUE_SHIFT            0
+
+/*----------------- SST video setup shifts ------------------*/
+#define SST_VIDEO_HSYNC_OFF_SHIFT          16
+#define SST_VIDEO_HSYNC_ON_SHIFT           0
+#define SST_VIDEO_VSYNC_OFF_SHIFT          16
+#define SST_VIDEO_VSYNC_ON_SHIFT           0
+#define SST_VIDEO_HBACKPORCH_SHIFT         0
+#define SST_VIDEO_VBACKPORCH_SHIFT         16
+#define SST_VIDEO_XDIM_SHIFT               0
+#define SST_VIDEO_YDIM_SHIFT               16
+
+/*----------------- SST dacData constants -------------------*/
+#define SST_DACREG_WMA                     0x0
+#define SST_DACREG_LUT                     0x1
+#define SST_DACREG_RMR                     0x2
+#define SST_DACREG_RMA                     0x3
+#define SST_DACREG_ICS_PLLADDR_WR          0x4 /* ICS only */
+#define SST_DACREG_ICS_PLLADDR_RD          0x7 /* ICS only */
+#define SST_DACREG_ICS_PLLADDR_DATA        0x5 /* ICS only */
+#define SST_DACREG_ICS_CMD                 0x6 /* ICS only */
+#define SST_DACREG_ICS_COLORMODE_16BPP     0x50 /* ICS only */
+#define SST_DACREG_ICS_COLORMODE_24BPP     0x70 /* ICS only */
+#define SST_DACREG_ICS_PLLADDR_VCLK0       0x0 /* ICS only */
+#define SST_DACREG_ICS_PLLADDR_VCLK1       0x1 /* ICS only */
+#define SST_DACREG_ICS_PLLADDR_VCLK7       0x7 /* ICS only */
+#define SST_DACREG_ICS_PLLADDR_VCLK1_DEFAULT 0x55 /* ICS only */
+#define SST_DACREG_ICS_PLLADDR_VCLK7_DEFAULT 0x71 /* ICS only */
+#define SST_DACREG_ICS_PLLADDR_GCLK0       0xa /* ICS only */
+#define SST_DACREG_ICS_PLLADDR_GCLK1       0xb /* ICS only */
+#define SST_DACREG_ICS_PLLADDR_GCLK1_DEFAULT 0x79 /* ICS only */
+#define SST_DACREG_ICS_PLLADDR_CTRL        0xe /* ICS only */
+#define SST_DACREG_ICS_PLLCTRL_CLK1SEL     BIT(4)
+#define SST_DACREG_ICS_PLLCTRL_CLK0SEL     BIT(5)
+#define SST_DACREG_ICS_PLLCTRL_CLK0FREQ    0x7
+#define SST_DACREG_INDEXADDR               SST_DACREG_WMA
+#define SST_DACREG_INDEXDATA               SST_DACREG_RMR
+#define SST_DACREG_INDEX_RMR               0x0
+#define SST_DACREG_INDEX_CR0               0x1
+#define SST_DACREG_INDEX_MIR               0x2
+#define SST_DACREG_INDEX_MIR_ATT_DEFAULT   0x84   /* AT&T */
+#define SST_DACREG_INDEX_MIR_TI_DEFAULT    0x97   /* TI */
+#define SST_DACREG_INDEX_DIR               0x3
+#define SST_DACREG_INDEX_DIR_ATT_DEFAULT   0x9    /* AT&T */
+#define SST_DACREG_INDEX_DIR_TI_DEFAULT    0x9    /* TI */
+#define SST_DACREG_INDEX_TST               0x4
+#define SST_DACREG_INDEX_CR1               0x5
+#define SST_DACREG_INDEX_CC                0x6
+#define SST_DACREG_INDEX_AA0               0xff  /* can't access */
+#define SST_DACREG_INDEX_AA1               0xff  /* can't access */
+#define SST_DACREG_INDEX_AB0               0xff  /* can't access */
+#define SST_DACREG_INDEX_AB1               0xff  /* can't access */
+#define SST_DACREG_INDEX_AB2               0xff  /* can't access */
+#define SST_DACREG_INDEX_AC0               0x48
+#define SST_DACREG_INDEX_AC1               0x49
+#define SST_DACREG_INDEX_AC2               0x4a
+#define SST_DACREG_INDEX_AD0               0x4c
+#define SST_DACREG_INDEX_AD1               0x4d
+#define SST_DACREG_INDEX_AD2               0x4e
+#define SST_DACREG_INDEX_BA0               0xff  /* can't access */
+#define SST_DACREG_INDEX_BA1               0xff  /* can't access */
+#define SST_DACREG_INDEX_BB0               0xff  /* can't access */
+#define SST_DACREG_INDEX_BB1               0xff  /* can't access */
+#define SST_DACREG_INDEX_BB2               0xff  /* can't access */
+#define SST_DACREG_INDEX_BC0               0xff  /* can't access */
+#define SST_DACREG_INDEX_BC1               0xff  /* can't access */
+#define SST_DACREG_INDEX_BC2               0xff  /* can't access */
+#define SST_DACREG_INDEX_BD0               0x6c
+#define SST_DACREG_INDEX_BD1               0x6d
+#define SST_DACREG_INDEX_BD2               0x6e
+
+#define SST_DACREG_CR0_INDEXED_ADDRESSING  BIT(0)
+#define SST_DACREG_CR0_8BITDAC             BIT(1)
+#define SST_DACREG_CR0_SLEEP               BIT(3)
+#define SST_DACREG_CR0_COLOR_MODE_SHIFT    4
+#define SST_DACREG_CR0_COLOR_MODE         (0xF<<SST_DACREG_CR0_COLOR_MODE_SHIFT)
+#define SST_DACREG_CR0_COLOR_MODE_16BPP   (0x3<<SST_DACREG_CR0_COLOR_MODE_SHIFT)
+#define SST_DACREG_CR0_COLOR_MODE_24BPP   (0x5<<SST_DACREG_CR0_COLOR_MODE_SHIFT)
+
+#define SST_DACREG_CR1_BLANK_PEDASTAL_EN  BIT(4)
+
+#define SST_DACREG_CC_BCLK_SEL_SHIFT       0
+#define SST_DACREG_CC_BCLK_SELECT_BD       BIT(3)
+#define SST_DACREG_CC_ACLK_SEL_SHIFT       4
+#define SST_DACREG_CC_ACLK_SELECT_AD       BIT(7)
+
+#define SST_DACREG_CLKREG_MSHIFT           0
+#define SST_DACREG_CLKREG_PSHIFT           6
+#define SST_DACREG_CLKREG_NSHIFT           0
+#define SST_DACREG_CLKREG_LSHIFT           4
+#define SST_DACREG_CLKREG_IBSHIFT          0
+
+#define SST_FBI_DACTYPE_ATT                0
+#define SST_FBI_DACTYPE_ICS                1
+#define SST_FBI_DACTYPE_TI                 2
+
+/* Definitions for parsing voodoo.ini file */
+#define DACRDWR_TYPE_WR                    0
+#define DACRDWR_TYPE_RDMODWR               1
+#define DACRDWR_TYPE_RDNOCHECK             2
+#define DACRDWR_TYPE_RDCHECK               3
+#define DACRDWR_TYPE_RDPUSH                4
+#define DACRDWR_TYPE_WRMOD_POP             5
+
+/* Other useful defines */
+#define PCICFG_WR(ADDR, DATA)                                         \
+    n = DATA;                                                         \
+    if(pciSetConfigData(ADDR, sst1InitDeviceNumber, &n) == FXFALSE)   \
+        return(FXFALSE)
+#define PCICFG_RD(ADDR, DATA)                                          \
+    if(pciGetConfigData(ADDR, sst1InitDeviceNumber, &DATA) == FXFALSE) \
+        return(FXFALSE)
+#define DAC_INDEXWRADDR(ADDR)                                         \
+    sst1InitDacWr(sstbase, SST_DACREG_INDEXADDR, ADDR)
+#define DAC_INDEXWR(DATA)                                             \
+    sst1InitDacWr(sstbase, SST_DACREG_INDEXDATA, (DATA))
+#define DAC_INDEXRD()                                                 \
+    sst1InitDacRd(sstbase, SST_DACREG_INDEXDATA)
+#define SLI_DRIVEOK()                                                 \
+      (!(sst1CurrentBoard->numBoardInsystem & 0x1) ||                 \
+       ((sst1CurrentBoard->numBoardInsystem & 0x1) &&                 \
+        (sst1InitSliDetect(sstbase) == 0)))
+
+/*-----------------------------------------------------------*/
+
+/*
+** SST-1 Initialization typedefs
+**
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+    float freq;
+    FxU32 clkTiming_M;
+    FxU32 clkTiming_P;
+    FxU32 clkTiming_N;
+    FxU32 clkTiming_L;
+    FxU32 clkTiming_IB;
+} sst1ClkTimingStruct;
+
+typedef struct {
+    FxU32 hSyncOn;
+    FxU32 hSyncOff;
+    FxU32 vSyncOn;
+    FxU32 vSyncOff;
+    FxU32 hBackPorch;
+    FxU32 vBackPorch;
+    FxU32 xDimension;
+    FxU32 yDimension;
+    FxU32 memOffset;
+    FxU32 memFifoEntries_1MB;
+    FxU32 memFifoEntries_2MB;
+    FxU32 memFifoEntries_4MB;
+    FxU32 tilesInX_Over2;
+    FxU32 vFifoThreshold;
+    FxBool video16BPPIsOK;
+    FxBool video24BPPIsOK;
+    float clkFreq16bpp;
+    float clkFreq24bpp;
+} sst1VideoTimingStruct;
+
+typedef struct {
+    FxU32 *virtAddr;        /* virtual memory base address */
+    FxU32 physAddr;         /* physical memory base address */
+    FxU32 deviceNumber;     /* PCI device number */
+    FxU32 vendorID;         /* PCI vendor ID */
+    FxU32 deviceID;         /* PCI device ID */
+    FxU32 fbiRevision;      /* FBI revision number */
+    FxU32 fbiBoardID;       /* FBI board ID (poweron strapping bits) */
+    FxU32 fbiVideo16BPP;    /* FBI video display mode */
+    FxU32 fbiVideoWidth;    /* FBI video display X-resolution */
+    FxU32 fbiVideoHeight;   /* FBI video display Y-resolution */
+    FxU32 fbiMemoryFifoEn;  /* FBI memory fifo enabled */
+    FxU32 sstSliDetect;     /* Scanline interleave detected */
+    FxU32 tmuRevision;      /* TMU revision number (for all TMUs) */
+    FxU32 numberTmus;       /* number of TMUs installed */
+    FxU32 tmuConfig;        /* TMU configuration bits */
+    FxU32 fbiMemSize;       /* FBI frame buffer memory (in MBytes) */
+    FxU32 tmuMemSize[MAX_NUM_TMUS]; /* TMU texture memory (in MBytes) */
+
+    /* These cannot be read from the hardware, so we shadow them here */
+    FxU32 tmuInit0[MAX_NUM_TMUS];
+    FxU32 tmuInit1[MAX_NUM_TMUS];
+
+    /* Misc */
+    FxU32 initGrxClkDone;
+    FxU32 vgaPassthruDisable;
+    FxU32 vgaPassthruEnable;
+    FxU32 fbiDacType;
+    FxU32 memFifoStatusLwm;
+    FxU32 numBoardInsystem;
+    FxU32 grxClkFreq;
+    FxU32 fbiMemSpeed;
+    FxU32 tmuMemSpeed;
+    FxU32 tmuClkFixed;
+    FxU32 fbiConfig;        /* FBI strapping pins */
+    FxU32 fbiVideoRefresh;  /* FBI video refresh rate */
+    FxU32 fbiRegulatorPresent;  /* FBI voltage regulator detected */
+    FxBool fbiTripleBufferingEnabled;  /* Specify video triple buffering */
+} sst1DeviceInfoStruct;
+
+typedef struct {
+    unsigned char type;
+    unsigned char addr;
+    FxU32 data;
+    FxU32 mask;
+    void *nextRdWr;
+} sst1InitDacRdWrStruct;
+
+typedef struct {
+    FxU32 width;
+    FxU32 height;
+    FxU32 refresh;
+    FxU32 video16BPP;
+    sst1InitDacRdWrStruct *setVideoRdWr;
+    void *nextSetVideo;
+} sst1InitDacSetVideoStruct;
+
+typedef struct {
+    FxU32 frequency;
+    sst1InitDacRdWrStruct *setMemClkRdWr;
+    void *nextSetMemClk;
+} sst1InitDacSetMemClkStruct;
+
+typedef struct {
+    FxU32 video16BPP;
+    sst1InitDacRdWrStruct *setVideoModeRdWr;
+    void *nextSetVideoMode;
+} sst1InitDacSetVideoModeStruct;
+
+typedef struct {
+    char dacManufacturer[100];
+    char dacDevice[100];
+    sst1InitDacRdWrStruct *detect;
+    sst1InitDacSetVideoStruct *setVideo;
+    sst1InitDacSetMemClkStruct *setMemClk;
+    sst1InitDacSetVideoModeStruct *setVideoMode;
+    void *nextDac;
+} sst1InitDacStruct;
+
+typedef struct {
+    char envVariable[100];
+    char envValue[256];
+    void *nextVar;
+} sst1InitEnvVarStruct;
+
+FX_ENTRY FxU32 * FX_CALL sst1InitMapBoard(FxU32);
+FX_ENTRY FxU32 FX_CALL sst1InitNumBoardsInSystem(void);
+FX_ENTRY FxBool FX_CALL sst1InitRegisters(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitGamma(FxU32 *, double);
+FX_ENTRY FxBool FX_CALL sst1InitGammaRGB(FxU32 *, double, double, double);
+FX_ENTRY FxBool FX_CALL sst1InitGammaTable(FxU32 *, FxU32, FxU32 *, FxU32 *, FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitVideo(FxU32 *, GrScreenResolution_t,
+  GrScreenRefresh_t, sst1VideoTimingStruct *);
+FX_ENTRY sst1VideoTimingStruct * FX_CALL sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution, 
+                                                     GrScreenRefresh_t screenRefresh);
+FX_ENTRY FxBool FX_CALL sst1InitShutdown(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitShutdownSli(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitSli(FxU32 *, FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitGetDeviceInfo(FxU32 *, sst1DeviceInfoStruct *);
+
+/* Miscellaneous routines */
+FX_ENTRY void FX_CALL sst1InitWrite32(FxU32 *, FxU32);
+FX_ENTRY FxU32 FX_CALL sst1InitRead32(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitIdle(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitIdleFBI(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitIdleFBINoNOP(FxU32 *);
+FX_ENTRY FxU32  FX_CALL sst1InitReturnStatus(FxU32 *);
+FX_ENTRY FxU32 FX_CALL sst1InitDacRd(FxU32 *, FxU32);
+FX_ENTRY void FX_CALL sst1InitDacWr(FxU32 *, FxU32, FxU32);
+FxBool sst1InitExecuteDacRdWr(FxU32 *, sst1InitDacRdWrStruct *);
+FX_ENTRY void FX_CALL sst1InitSetResolution(FxU32 *, sst1VideoTimingStruct *,
+    FxU32);
+FX_ENTRY FxBool FX_CALL sst1InitDacIndexedEnable(FxU32 *, FxU32);
+FX_ENTRY FxBool FX_CALL sst1InitGrxClk(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitCalcGrxClk(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitDacDetect(FxU32 *);
+FxBool sst1InitDacDetectATT(FxU32 *);
+FxBool sst1InitDacDetectTI(FxU32 *);
+FxBool sst1InitDacDetectICS(FxU32 *);
+FxBool sst1InitDacDetectINI(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitSetGrxClk(FxU32 *, sst1ClkTimingStruct *);
+FxBool sst1InitComputeClkParams(float, sst1ClkTimingStruct *);
+FxBool sst1InitSetGrxClkATT(FxU32 *, sst1ClkTimingStruct *);
+FxBool sst1InitSetGrxClkICS(FxU32 *, sst1ClkTimingStruct *);
+FxBool sst1InitSetGrxClkINI(FxU32 *, sst1ClkTimingStruct *);
+FX_ENTRY FxBool FX_CALL sst1InitSetVidClk(FxU32 *, float);
+FxBool sst1InitSetVidClkATT(FxU32 *, sst1ClkTimingStruct *);
+FxBool sst1InitSetVidClkICS(FxU32 *, sst1ClkTimingStruct *);
+FxBool sst1InitSetVidClkINI(FxU32 *, FxU32, FxU32, FxU32, FxU32);
+FxBool sst1InitSetVidMode(FxU32 *, FxU32);
+FxBool sst1InitSetVidModeATT(FxU32 *, FxU32);
+FxBool sst1InitSetVidModeICS(FxU32 *, FxU32);
+FxBool sst1InitSetVidModeINI(FxU32 *, FxU32);
+FX_ENTRY FxBool FX_CALL sst1InitCheckBoard(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitGetFbiInfo(FxU32 *, sst1DeviceInfoStruct *);
+FX_ENTRY FxBool FX_CALL sst1InitGetTmuInfo(FxU32 *, sst1DeviceInfoStruct *);
+FX_ENTRY void FX_CALL sst1InitRenderingRegisters(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitGetTmuMemory(FxU32 *sstbase,
+    sst1DeviceInfoStruct *info, FxU32 tmu, FxU32 *TmuMemorySize);
+FX_ENTRY FxBool FX_CALL sst1InitClearSwapPending(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitVgaPassCtrl(FxU32 *, FxU32);
+FxBool sst1InitResetTmus(FxU32 *);
+FX_ENTRY FxU32 FX_CALL sst1InitSliDetect(FxU32 *);
+FX_ENTRY FxBool FX_CALL sst1InitSliPciOwner(FxU32 *, FxU32);
+FX_ENTRY FxBool FX_CALL sst1InitVoodooFile(void);
+FX_ENTRY char * FX_CALL sst1InitGetenv(char *);
+FX_ENTRY FxU32 * FX_CALL sst1InitGetBaseAddr(FxU32);
+FxBool sst1InitFillDeviceInfo(FxU32 *, sst1DeviceInfoStruct *);
+void sst1InitIdleLoop(FxU32 *);
+void sst1InitClearBoardInfo(void);
+FX_ENTRY FxBool FX_CALL sst1InitSetTripleBuffering(FxU32 *, FxBool);
+FX_ENTRY void FX_CALL sst1InitCachingOn(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Info/Print routines */
+#ifdef INIT_OUTPUT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+FX_ENTRY void FX_CALL sst1InitPrintf(const char *, ...);
+#ifdef __cplusplus
+}
+#endif
+
+#ifndef _FILE_DEFINED
+#include <stdio.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef SST1INIT_ALLOCATE
+FILE *sst1InitMsgFile = NULL; /*stdout;*/
+#else
+extern FILE *sst1InitMsgFile;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* Maximum number of SST-1 boards supported in system */
+#define SST1INIT_MAX_BOARDS 16
+
+/* Maximum number of read pushes in "voodoo.ini" file */
+#define DACRDWR_MAX_PUSH    16
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef SST1INIT_ALLOCATE
+  static char headersIdent[] = "@#%InitHeaders $Revision: 1.1 $";
+  FxBool sst1InitUseVoodooFile = FXFALSE;
+  sst1InitEnvVarStruct *envVarsBase = (sst1InitEnvVarStruct *) NULL;
+  sst1InitDacStruct *dacStructBase = (sst1InitDacStruct *) NULL;
+  sst1InitDacStruct *iniDac = (sst1InitDacStruct *) NULL;
+  sst1InitDacSetVideoStruct *iniVideo = (sst1InitDacSetVideoStruct *) NULL;
+  sst1InitDacSetMemClkStruct *iniMemClk = (sst1InitDacSetMemClkStruct *) NULL;
+  FxU32 iniStack[DACRDWR_MAX_PUSH];
+  int iniStackPtr = 0;
+  sst1DeviceInfoStruct *sst1CurrentBoard;
+  FxU32 sst1InitDeviceNumber;
+  sst1DeviceInfoStruct sst1BoardInfo[SST1INIT_MAX_BOARDS];
+  FxU32 boardsInSystem;
+  FxU32 sst1InitSliEnabled = 0;
+  FxU32 *sst1InitSliSlaveVirtAddr;
+#else
+  extern FxBool sst1InitUseVoodooFile;
+  extern sst1InitEnvVarStruct *envVarsBase;
+  extern sst1InitDacStruct *dacStructBase;
+  extern sst1InitDacStruct *iniDac;
+  extern sst1InitDacSetVideoStruct *iniVideo;
+  extern sst1InitDacSetMemClkStruct *iniMemClk;
+  extern FxU32 iniStack[];
+  extern int iniStackPtr;
+  extern sst1DeviceInfoStruct *sst1CurrentBoard;
+  extern FxU32 sst1InitDeviceNumber;
+  extern sst1DeviceInfoStruct sst1BoardInfo[SST1INIT_MAX_BOARDS];
+  extern FxU32 boardsInSystem;
+  extern FxU32 sst1InitSliEnabled;
+  extern FxU32 *sst1InitSliSlaveVirtAddr;
+#endif /* SST1INIT_ALLOCATE */
+
+  extern PciRegister SST1_PCI_INIT_ENABLE;
+  extern PciRegister SST1_PCI_BUS_SNOOP_0;
+  extern PciRegister SST1_PCI_BUS_SNOOP_1;
+  extern PciRegister SST1_PCI_CFG_STATUS;
+  extern PciRegister SST1_PCI_VCLK_ENABLE;
+  extern PciRegister SST1_PCI_VCLK_DISABLE;
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef SST1INIT_VIDEO_ALLOCATE
+/* SST1INIT_VIDEO_ALLOCATE is only #defined in video.c
+  
+   Define useful clock and video timings
+   Clocks generated are follows:
+     Clock Freq. (MHz) =
+       [14.318 * (clkTiming_M+2)] / [(clkTiming_N+2) * (2^clkTiming_P)]
+  
+   Solving for clkTiming_M yields:
+     clkTiming_M =
+       [ [(Clock Freq (Mhz)) * (clkTiming_N+2) * (2^clkTiming_P)] / 14.318 ] - 2
+     
+   NOTE: [14.318 * (clkTiming_M+2)] / (clkTiming_N+2) should be between
+    120 and 240
+   NOTE: Max. M is 127
+   NOTE: Max. N is 31
+   NOTE: Max. P is 3
+   NOTE: Max. L is 15
+   NOTE: Max. IB is 15
+*/
+
+/* 512x256@60 only syncs to Arcade-style monitors */
+sst1VideoTimingStruct SST_VREZ_512X256_60 = {
+    41,        /* hSyncOn */
+    626,       /* hSyncOff */
+    4,         /* vSyncOn */
+    286,       /* vSyncOff */
+    65,        /* hBackPorch */
+    24,        /* vBackPorch */
+    512,       /* xDimension */
+    256,       /* yDimension */
+    64,        /* memOffset */
+    0x410,     /* memFifoEntries_1MB  ... 32256 entries in memory fifo (no Z) */
+    0x100,     /* memFifoEntries_2MB  ... 57344 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    8,         /* tilesInX_Over2 */
+    23,        /* vFifoThreshold */
+    FXFALSE,   /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    23.334F,   /* clkFreq16bpp */
+    23.334F    /* clkFreq24bpp */
+};
+
+/* 512x384@60 only syncs to Arcade-style monitors */
+sst1VideoTimingStruct SST_VREZ_512X384_60 = {
+    23,        /* hSyncOn */
+    640,       /* hSyncOff */
+    3,         /* vSyncOn */
+    411,       /* vSyncOff */
+    90,        /* hBackPorch */
+    24,        /* vBackPorch */
+    512,       /* xDimension */
+    384,       /* yDimension */
+    96,        /* memOffset */
+    0x410,     /* memFifoEntries_1MB  ... 32256 entries in memory fifo (no Z) */
+    0x100,     /* memFifoEntries_2MB  ... 57344 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    8,         /* tilesInX_Over2 */
+    23,        /* vFifoThreshold */
+    FXFALSE,   /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    33.0F,     /* clkFreq16bpp */
+    33.0F      /* clkFreq24bpp */
+};
+
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_512X384_72 = {
+    51,        /* hSyncOn */
+    591,       /* hSyncOff */
+    3,         /* vSyncOn */
+    430,       /* vSyncOff */
+    55,        /* hBackPorch */
+    25,        /* vBackPorch */
+    512,       /* xDimension */
+    384,       /* yDimension */
+    96,        /* memOffset */
+    0x410,     /* memFifoEntries_1MB  ... 32256 entries in memory fifo (no Z) */
+    0x100,     /* memFifoEntries_2MB  ... 57344 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    8,         /* tilesInX_Over2 */
+    23,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    20.093F,   /* clkFreq16bpp .. 72 Hz refresh rate */
+    40.186F    /* clkFreq24bpp */
+};
+
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_512X384_75 = {
+    44,        /* hSyncOn */
+    616,       /* hSyncOff */
+    3,         /* vSyncOn */
+    415,       /* vSyncOff */
+    55,        /* hBackPorch */
+    25,        /* vBackPorch */
+    512,       /* xDimension */
+    384,       /* yDimension */
+    96,        /* memOffset */
+    0x410,     /* memFifoEntries_1MB  ... 32256 entries in memory fifo (no Z) */
+    0x100,     /* memFifoEntries_2MB  ... 57344 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    8,         /* tilesInX_Over2 */
+    23,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    20.8F,     /* clkFreq16bpp .. 72 Hz refresh rate */
+    41.6F      /* clkFreq24bpp */
+};
+
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_512X384_85 = {
+    55,        /* hSyncOn */
+    599,       /* hSyncOff */
+    3,         /* vSyncOn */
+    401,       /* vSyncOff */
+    70,        /* hBackPorch */
+    16,        /* vBackPorch */
+    512,       /* xDimension */
+    384,       /* yDimension */
+    96,        /* memOffset */
+    0x410,     /* memFifoEntries_1MB  ... 32256 entries in memory fifo (no Z) */
+    0x100,     /* memFifoEntries_2MB  ... 57344 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    8,         /* tilesInX_Over2 */
+    23,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    22.527F,   /* clkFreq16bpp .. 72 Hz refresh rate */
+    45.054F    /* clkFreq24bpp */
+};
+
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_512X384_120 = {
+    25,        /* hSyncOn */
+    650,       /* hSyncOff */
+    3,         /* vSyncOn */
+    409,       /* vSyncOff */
+    110,       /* hBackPorch */
+    25,        /* vBackPorch */
+    512,       /* xDimension */
+    384,       /* yDimension */
+    96,        /* memOffset */
+    0x410,     /* memFifoEntries_1MB  ... 32256 entries in memory fifo (no Z) */
+    0x100,     /* memFifoEntries_2MB  ... 57344 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    8,         /* tilesInX_Over2 */
+    20,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    33.5F,     /* clkFreq16bpp .. 72 Hz refresh rate */
+    67.0F      /* clkFreq24bpp */
+};
+
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_640X400_70 = {
+    96,        /* hSyncOn */
+    704,       /* hSyncOff */
+    2,         /* vSyncOn */
+    447,       /* vSyncOff */
+    48,        /* hBackPorch */
+    35,        /* vBackPorch */
+    640,       /* xDimension */
+    400,       /* yDimension */
+    150,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... memory fifo not supported */
+    0x430,     /* memFifoEntries_2MB  ... 31232 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    10,        /* tilesInX_Over2 */
+    21,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    25.175F,   /* clkFreq16bpp */
+    50.350F    /* clkFreq24bpp */
+};
+
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_640X400_75 = {
+    99,        /* hSyncOn */
+    733,       /* hSyncOff */
+    3,         /* vSyncOn */
+    429,       /* vSyncOff */
+    52,        /* hBackPorch */
+    25,        /* vBackPorch */
+    640,       /* xDimension */
+    400,       /* yDimension */
+    150,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... memory fifo not supported */
+    0x430,     /* memFifoEntries_2MB  ... 31232 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    10,        /* tilesInX_Over2 */
+    19,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    27.0F,     /* clkFreq16bpp */
+    54.0F      /* clkFreq24bpp */
+};
+
+/* VESA Standard */
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_640X400_85 = {
+    63,        /* hSyncOn */
+    767,       /* hSyncOff */
+    3,         /* vSyncOn */
+    442,       /* vSyncOff */
+    94,        /* hBackPorch */
+    41,        /* vBackPorch */
+    640,       /* xDimension */
+    400,       /* yDimension */
+    150,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... memory fifo not supported */
+    0x430,     /* memFifoEntries_2MB  ... 31232 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    10,        /* tilesInX_Over2 */
+    18,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    31.5F,     /* clkFreq16bpp */
+    63.0F      /* clkFreq24bpp */
+};
+
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_640X400_120 = {
+    67,        /* hSyncOn */
+    798,       /* hSyncOff */
+    3,         /* vSyncOn */
+    424,       /* vSyncOff */
+    94,        /* hBackPorch */
+    16,        /* vBackPorch */
+    640,       /* xDimension */
+    400,       /* yDimension */
+    150,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... memory fifo not supported */
+    0x430,     /* memFifoEntries_2MB  ... 31232 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    10,        /* tilesInX_Over2 */
+    18,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    44.47F,    /* clkFreq16bpp */
+    88.94F     /* clkFreq24bpp */
+};
+
+/* VESA Standard */
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_640X480_60 = {
+    96,        /* hSyncOn */
+    704,       /* hSyncOff */
+    2,         /* vSyncOn */
+    523,       /* vSyncOff */
+    38,        /* hBackPorch */
+    25,        /* vBackPorch */
+    640,       /* xDimension */
+    480,       /* yDimension */
+    150,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... unsupported resolution */
+    0x430,     /* memFifoEntries_2MB  ... 31232 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    10,        /* tilesInX_Over2 */
+    23,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    25.175F,   /* clkFreq16bpp */
+    50.350F    /* clkFreq24bpp */
+};
+
+/* VESA Standard */
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_640X480_75 = {
+    63,        /* hSyncOn */
+    775,       /* hSyncOff */
+    3,         /* vSyncOn */
+    497,       /* vSyncOff */
+    118,       /* hBackPorch */
+    16,        /* vBackPorch */
+    640,       /* xDimension */
+    480,       /* yDimension */
+    150,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... unsupported resolution */
+    0x430,     /* memFifoEntries_2MB  ... 31232 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    10,        /* tilesInX_Over2 */
+    21,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    31.5F,     /* clkFreq16bpp */
+    63.0F      /* clkFreq24bpp */
+};
+
+/* VESA Standard */
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_640X480_85 = {
+    55,        /* hSyncOn */
+    776,       /* hSyncOff */
+    3,         /* vSyncOn */
+    506,       /* vSyncOff */
+    78,        /* hBackPorch */
+    25,        /* vBackPorch */
+    640,       /* xDimension */
+    480,       /* yDimension */
+    150,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... unsupported resolution */
+    0x430,     /* memFifoEntries_2MB  ... 31232 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    10,        /* tilesInX_Over2 */
+    21,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    36.0F,     /* clkFreq16bpp */
+    72.0F      /* clkFreq24bpp */
+};
+
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_640X480_120 = {
+    45,        /* hSyncOn */
+    785,       /* hSyncOff */
+    3,         /* vSyncOn */
+    506,       /* vSyncOff */
+    100,       /* hBackPorch */
+    18,        /* vBackPorch */
+    640,       /* xDimension */
+    480,       /* yDimension */
+    150,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... unsupported resolution */
+    0x430,     /* memFifoEntries_2MB  ... 31232 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    10,        /* tilesInX_Over2 */
+    17,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    50.82F,    /* clkFreq16bpp */
+    101.64F    /* clkFreq24bpp */
+};
+
+#ifdef H3D
+sst1VideoTimingStruct SST_VREZ_640X502_60 = {
+    96,        /* hSyncOn */
+    704,       /* hSyncOff */
+    2,         /* vSyncOn */
+    523,       /* vSyncOff */
+    38,        /* hBackPorch */
+    15,        /* vBackPorch */
+    640,       /* xDimension */
+    502,       /* yDimension */
+    //    150,       /* memOffset */
+    160,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... unsupported resolution */
+    0x610,     /* memFifoEntries_2MB  ... 31232 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    10,        /* tilesInX_Over2 */
+    23,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    25.175F,   /* clkFreq16bpp */
+    50.350F    /* clkFreq24bpp */
+};
+
+sst1VideoTimingStruct SST_VREZ_800X620_60 = {
+    127,       /* hSyncOn */
+    927,       /* hSyncOff */
+    4,         /* vSyncOn */
+    624,       /* vSyncOff */
+    86,        /* hBackPorch */
+    13,        /* vBackPorch */
+    800,       /* xDimension */
+    620,       /* yDimension */
+    254,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... unsupported resolution */
+    0x0,       /* memFifoEntries_2MB  ... 9152 entries in memory fifo (no Z) */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    13,        /* tilesInX_Over2 */
+    14,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    40.0F,     /* clkFreq16bpp */
+    80.0F      /* clkFreq24bpp */
+};
+
+#endif
+
+/* VESA Standard */
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_800X600_60 = {
+    127,       /* hSyncOn */
+    927,       /* hSyncOff */
+    4,         /* vSyncOn */
+    624,       /* vSyncOff */
+    86,        /* hBackPorch */
+    23,        /* vBackPorch */
+    800,       /* xDimension */
+    600,       /* yDimension */
+    247,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... unsupported resolution */
+    0x6e2,     /* memFifoEntries_2MB  ... 9152 entries in memory fifo (no Z) */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    13,        /* tilesInX_Over2 */
+    14,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    40.0F,     /* clkFreq16bpp */
+    80.0F      /* clkFreq24bpp */
+};
+
+/* VESA Standard */
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_800X600_75 = {
+    79,        /* hSyncOn */
+    975,       /* hSyncOff */
+    3,         /* vSyncOn */
+    622,       /* vSyncOff */
+    158,       /* hBackPorch */
+    21,        /* vBackPorch */
+    800,       /* xDimension */
+    600,       /* yDimension */
+    247,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... unsupported resolution */
+    0x6e2,     /* memFifoEntries_2MB  ... 9152 entries in memory fifo (no Z) */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    13,        /* tilesInX_Over2 */
+    14,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    49.5F,     /* clkFreq16bpp */
+    99.0F      /* clkFreq24bpp */
+};
+
+/* VESA Standard */
+/* Verified 10/21/96 */
+sst1VideoTimingStruct SST_VREZ_800X600_85 = {
+    63,        /* hSyncOn */
+    983,       /* hSyncOff */
+    3,         /* vSyncOn */
+    628,       /* vSyncOff */
+    150,       /* hBackPorch */
+    27,        /* vBackPorch */
+    800,       /* xDimension */
+    600,       /* yDimension */
+    247,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... unsupported resolution */
+    0x6e2,     /* memFifoEntries_2MB  ... 9152 entries in memory fifo (no Z) */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    13,        /* tilesInX_Over2 */
+    14,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    56.25F,    /* clkFreq16bpp */
+    112.5F     /* clkFreq24bpp */
+};
+
+sst1VideoTimingStruct SST_VREZ_856X480_60 = {
+    136,       /* hSyncOn */
+    1008,      /* hSyncOff */
+    2,         /* vSyncOn */
+    523,       /* vSyncOff */
+    100,       /* hBackPorch */
+    23,        /* vBackPorch */
+    856,       /* xDimension */
+    480,       /* yDimension */
+    210,       /* memOffset */
+    0x0,       /* memFifoEntries_1MB  ... unsupported resolution */
+    0x430,     /* memFifoEntries_2MB  ... 31232 entries in memory fifo */
+    0x100,     /* memFifoEntries_4MB  ... 57344 entries in memory fifo */
+    14,        /* tilesInX_Over2 */
+    14,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    36.0F,     /* clkFreq16bpp */
+    72.0F      /* clkFreq24bpp */
+};
+
+sst1VideoTimingStruct SST_VREZ_960X720_60 = {
+    200,       /* hSyncOn */
+    1013,      /* hSyncOff */
+    4,         /* vSyncOn */
+    750,       /* vSyncOff */
+    30,        /* hBackPorch */
+    23,        /* vBackPorch */
+    960,       /* xDimension */
+    720,       /* yDimension */
+    338,       /* memOffset (really 337.5) */
+    0x0,       /* memFifoEntries_1MB  ... unsupported resolution */
+    0x0,       /* memFifoEntries_2MB  ... unsupported resolution */
+    0x765,     /* memFifoEntries_4MB  ... 4959 entries in memory fifo */
+    15,        /* tilesInX_Over2 */
+    14,        /* vFifoThreshold */
+    FXTRUE,    /* video16BPPIsOK */
+    FXTRUE,    /* video24BPPIsOK */
+    56.0F,     /* clkFreq16bpp */
+    112.0F     /* clkFreq24bpp */
+};
+
+#else /* SST1INIT_VIDEO_ALLOCATE */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern sst1VideoTimingStruct SST_VREZ_640X480_60;
+extern sst1VideoTimingStruct SST_VREZ_800X600_60;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SST1INIT_VIDEO_ALLOCATE */
+
+#endif /* !__SST1INIT_H__ */
Index: trunk/src/opengl/glide/sst1/init/initvg/util.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/util.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/util.c	(revision 2885)
@@ -0,0 +1,359 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:35 $ 
+**
+** Utility routines for SST-1 Initialization code
+**
+*/
+#pragma optimize ("",off)
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <sst.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#include <sst1vid.h>
+#include <sst1init.h>
+
+/*
+** sst1InitIdle():
+**  Return idle condition of SST-1
+**
+**    Returns:
+**      FXTRUE if SST-1 is idle (fifos are empty, graphics engines are idle)
+**      FXFALSE if SST-1 has not been mapped
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitIdle(FxU32 *sstbase)
+{
+    if(!sstbase)
+        return(FXFALSE);
+
+    if(!sst1InitSliEnabled)
+        sst1InitIdleLoop(sstbase);
+    else {
+        FxU32 j, n;
+
+        if(sst1InitCheckBoard(sstbase) == FXFALSE)
+            return(FXFALSE);
+        /* Check idle for Master... */
+        sst1InitIdleLoop(sstbase);
+
+        /* Cause slave to drive PCI bus */
+        PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+        PCICFG_WR(SST1_PCI_INIT_ENABLE, j | SST_SCANLINE_SLV_OWNPCI);
+        if(sst1InitCheckBoard(sst1InitSliSlaveVirtAddr) == FXFALSE)
+            return(FXFALSE);
+        PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+        PCICFG_WR(SST1_PCI_INIT_ENABLE, j | SST_SCANLINE_SLV_OWNPCI);
+
+        /* Check idle for Slave... */
+        sst1InitIdleLoop(sstbase);
+
+        /* Restore normal SLI conditions */
+        PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+        PCICFG_WR(SST1_PCI_INIT_ENABLE, j & ~SST_SCANLINE_SLV_OWNPCI);
+        if(sst1InitCheckBoard(sstbase) == FXFALSE)
+            return(FXFALSE);
+        PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
+        PCICFG_WR(SST1_PCI_INIT_ENABLE, j & ~SST_SCANLINE_SLV_OWNPCI);
+    }
+    return(FXTRUE);
+}
+
+void sst1InitIdleLoop(FxU32 *sstbase)
+{
+    FxU32 cntr;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    ISET(sst->nopCMD, 0x0);
+    cntr = 0;
+    while(1) {
+        if(!(sst1InitReturnStatus(sstbase) & SST_BUSY)) {
+            if(++cntr >= 3)
+                break;
+        } else
+            cntr = 0;
+    }
+}
+
+/*
+** sst1InitIdleFBI():
+**  Return idle condition of FBI (ignoring idle status of TMU)
+**
+**    Returns:
+**      FXTRUE if FBI is idle (fifos are empty, graphics engines are idle)
+**      FXFALSE if FBI has not been mapped
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitIdleFBI(FxU32 *sstbase)
+{
+    FxU32 cntr;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    if(!sst)
+        return(FXFALSE);
+
+    ISET(sst->nopCMD, 0x0);
+    cntr = 0;
+    while(1) {
+        if(!(sst1InitReturnStatus(sstbase) & SST_FBI_BUSY)) {
+            if(++cntr >= 3)
+                break;
+        } else
+            cntr = 0;
+    }
+    return(FXTRUE);
+}
+
+/*
+** sst1InitIdleFBINoNOP():
+**  Return idle condition of FBI (ignoring idle status of TMU)
+**  sst1InitIdleFBINoNOP() differs from sst1InitIdleFBI() in that no NOP command
+**  is issued to flush the graphics pipeline.
+**
+**    Returns:
+**      FXTRUE if FBI is idle (fifos are empty, graphics engines are idle)
+**      FXFALSE if FBI has not been mapped
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitIdleFBINoNOP(FxU32 *sstbase)
+{
+    FxU32 cntr;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    if(!sst)
+        return(FXFALSE);
+
+    /* ISET(sst->nopCMD, 0x0); */
+    cntr = 0;
+    while(1) {
+        if(!(sst1InitReturnStatus(sstbase) & SST_FBI_BUSY)) {
+            if(++cntr > 5)
+                break;
+        } else
+            cntr = 0;
+    }
+    return(FXTRUE);
+}
+
+/* Included so compiler doesn't optimize out loop code waiting on status bits */
+FX_EXPORT FxU32 FX_CSTYLE sst1InitReturnStatus(FxU32 *sstbase)
+{
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    return(IGET(sst->status));
+}
+
+
+/*
+** sst1InitClearSwapPending():
+**  Clear any swaps pending in the status register
+**  NOTE: The video unit of FBI must be initialized before calling this routine
+**
+**    Returns:
+**      FXTRUE
+**
+*/
+FX_ENTRY FxBool FX_CALL sst1InitClearSwapPending(FxU32 *sstbase)
+{
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+    FxU32 displayedBuffer, i;
+
+    INIT_PRINTF(("sst1InitClearSwapPending() WARNING: Clearing pending swapbufferCMDs...\n"));
+
+    sst1InitIdle(sstbase);
+    displayedBuffer =
+        (IGET(sst->status) & SST_DISPLAYED_BUFFER) >>
+          SST_DISPLAYED_BUFFER_SHIFT;
+
+    /* Wait until vsync is inactive to guarantee that swaps queue in the */
+    /* PCI fifo properly */
+    while(!(IGET(sst->status) & SST_VRETRACE) ||
+      ((IGET(sst->vRetrace) & 0xfff) > 100) || ((IGET(sst->vRetrace) & 0xfff)
+        < 10))
+        ;
+
+    /* First swap syncs to Vsync...Subsequent ones do not... */
+    ISET(sst->swapbufferCMD, 0x1);
+    ISET(sst->nopCMD, 0x0);
+    for(i=0; i<17; i++) {
+        ISET(sst->swapbufferCMD, 0x0);
+        ISET(sst->nopCMD, 0x0);
+    }
+    if(displayedBuffer) {
+        ISET(sst->swapbufferCMD, 0x0);
+        ISET(sst->nopCMD, 0x0);
+    }
+    sst1InitIdle(sstbase);
+
+    return(FXTRUE);
+}
+
+/*
+** sst1InitVgaPassCtrl():
+**  Control VGA passthrough setting
+**
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitVgaPassCtrl(FxU32 *sstbase, FxU32 enable)
+{
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    if(enable) {
+        /* VGA controls monitor */
+        ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 
+            sst1CurrentBoard->vgaPassthruEnable);
+        ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_BLANK_EN);
+    } else {
+        /* SST-1 controls monitor */
+        ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 
+            sst1CurrentBoard->vgaPassthruDisable);
+        ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_BLANK_EN);
+    }
+
+    return(FXTRUE);
+}
+
+/*
+** sst1InitResetTmus():
+**  Reset TMUs after changing graphics clocks
+**  Occasionally when changing the frequency of the graphics clock, the TMUs
+**  get in an unknown state.  sst1InitResetTmus() cleans up the problem.
+**
+*/
+FxBool sst1InitResetTmus(FxU32 *sstbase)
+{
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+    FxU32 n;
+
+    /* Clear FBI registers */
+    ISET(sst->fbzColorPath, 0x0);
+    ISET(sst->fogMode, 0x0);
+    ISET(sst->alphaMode, 0x0);
+    ISET(sst->fbzMode, 0x0);
+    ISET(sst->lfbMode, 0x0);
+    ISET(sst->fogColor, 0x0);
+    ISET(sst->zaColor, 0x0);
+    ISET(sst->chromaKey, 0x0);
+    ISET(sst->stipple, 0x0);
+    ISET(sst->c0, 0x0);
+    ISET(sst->c1, 0x0);
+
+    /* clear TMU registers */
+    ISET(sst->textureMode, 0x0);
+    ISET(sst->tLOD, 0x0);
+    ISET(sst->tDetail, 0x0);
+    ISET(sst->texBaseAddr, 0x0);
+    ISET(sst->texBaseAddr1, 0x0);
+    ISET(sst->texBaseAddr2, 0x0);
+    ISET(sst->texBaseAddr38, 0x0);
+
+    /* Set downstream TMU to intentionally overflow TT Fifo... */
+    ISET(SST_TREX(sst,0)->trexInit1, sst1CurrentBoard->tmuInit1[0] &
+        ~SST_TEX_TT_FIFO_SIL);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Draw 256-pixel textured triangle to overflow TT fifo in downstream */
+    /* TMU.  Create numerous page misses in downstream TMU so upstream TMU */
+    /* is always running faster */
+    ISET(sst->fbzColorPath, SST_ENTEXTUREMAP);
+    ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT);
+    ISET(sst->vA.x, 0);
+    ISET(sst->vA.y, 0);
+    ISET(sst->vB.x, (25<<SST_XY_FRACBITS));
+    ISET(sst->vB.y, 0);
+    ISET(sst->vC.x, 0);
+    ISET(sst->vC.y, (25<<SST_XY_FRACBITS));
+    ISET(sst->s, 0x0);
+    ISET(sst->t, 0x0);
+    ISET(sst->w, 0x0);
+    ISET(sst->dwdx, 0x0);
+    ISET(sst->dwdy, 0x0);
+    ISET(SST_TREX(sst,0)->dsdx, (69<<SST_ST_FRACBITS));
+    ISET(SST_TREX(sst,0)->dsdy, (69<<SST_ST_FRACBITS));
+    ISET(SST_TREX(sst,0)->dsdx, (69<<SST_ST_FRACBITS));
+    ISET(SST_TREX(sst,0)->dsdy, (69<<SST_ST_FRACBITS));
+    ISET(SST_TREX(sst,1)->dsdx, (0<<SST_ST_FRACBITS));
+    ISET(SST_TREX(sst,1)->dsdy, (0<<SST_ST_FRACBITS));
+    ISET(SST_TREX(sst,1)->dsdx, (0<<SST_ST_FRACBITS));
+    ISET(SST_TREX(sst,1)->dsdy, (0<<SST_ST_FRACBITS));
+    ISET(sst->triangleCMD, 0x0);
+    ISET(sst->nopCMD, 0x1);  /* This will reset pixel counter registers... */
+
+    /* Wait for command to execute... */
+    for(n=0; n<25000; n++)
+        sst1InitReturnStatus(sstbase);
+
+    /* Upstream TMU is now idle */
+    /* Set downstream TMU to always accept upstream data */
+    /* This will flush pending pixels in the downstream TMU */
+    ISET(SST_TREX(sst,0)->trexInit1, sst1CurrentBoard->tmuInit1[0] |
+        SST_TEX_RG_TTCII_INH | SST_TEX_USE_RG_TTCII_INH);
+    for(n=0; n<100; n++)
+        sst1InitReturnStatus(sstbase);
+
+    /* Wait for command to execute... */
+    for(n=0; n<25000; n++)
+        sst1InitReturnStatus(sstbase);
+
+    /* Restore registers */
+    ISET(SST_TREX(sst,0)->trexInit1, sst1CurrentBoard->tmuInit1[0]);
+    ISET(sst->fbzColorPath, 0x0);
+    ISET(sst->fbzMode, 0x0);
+    for(n=0; n<100; n++)
+        sst1InitReturnStatus(sstbase);
+
+    if(sst1InitReturnStatus(sstbase) & SST_TREX_BUSY) {
+        INIT_PRINTF(("sst1InitResetTmus(): Could not reset TMUs...\n"));
+        return(FXFALSE);
+    } else
+        return(FXTRUE);
+}
+
+/*
+** sst1InitWrite32():
+**  Write 32-bit Word to specified address
+**
+*/
+FX_EXPORT void FX_CSTYLE sst1InitWrite32(FxU32 *addr, FxU32 data)
+{
+    P6FENCE;
+    *addr = data;
+    P6FENCE;
+}
+
+/*
+** sst1InitRead32():
+**  Read 32-bit Word from specified address
+**
+*/
+FX_EXPORT FxU32 FX_CSTYLE sst1InitRead32(FxU32 *addr)
+{
+    P6FENCE;
+    return(*addr);
+}
+
+#pragma optimize ("",on)
Index: trunk/src/opengl/glide/sst1/init/initvg/video.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/initvg/video.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/initvg/video.c	(revision 2885)
@@ -0,0 +1,1106 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:35 $ 
+**
+** Initialization code for initializing SST-1 video unit
+**
+*/
+#pragma optimize ("",off)
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <sst.h>
+#define FX_DLL_DEFINITION
+#include <fxdll.h>
+#define SST1INIT_VIDEO_ALLOCATE /* allocate data structures for video timing */
+#include <sst1vid.h>
+#include <sst1init.h>
+
+/*
+** sst1InitVideo():
+**  Initialize video (including DAC setup) for the specified resolution
+**
+**    Returns:
+**      FXTRUE if successfully initializes specified SST-1 video resolution
+**      FXFALSE if cannot initialize SST-1 to specified video resolution
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitVideo(FxU32 *sstbase,
+  GrScreenResolution_t screenResolution, GrScreenRefresh_t screenRefresh,
+  sst1VideoTimingStruct *altVideoTiming)
+{
+    FxU32 n, vtmp;
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+    sst1VideoTimingStruct *sstVideoRez;
+    FxU32 sst1MonitorRefresh;
+    FxU32 sst1MonitorRez;
+    FxU32 video16BPP;
+    FxU32 memFifoEntries;
+    FxU32 memFifoLwm, memFifoHwm, pciFifoLwm;
+    FxU32 vInClkDel, vOutClkDel;
+    FxU32 tf0_clk_del, tf1_clk_del, tf2_clk_del;
+    FxU32 ft_clk_del;
+
+    if(!sst)
+        return(FXFALSE);
+
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    if(GETENV(("SST_IGNORE_INIT_VIDEO"))) {
+        INIT_PRINTF(("WARNING: Ignoring sst1InitVideo()...\n"));
+        sst1InitIdleFBINoNOP(sstbase);
+        return(FXTRUE);
+    }
+
+    switch(screenResolution) {
+        case(GR_RESOLUTION_512x256):
+            sst1MonitorRez = 512256;
+            sst1CurrentBoard->fbiVideoWidth = 512;
+            sst1CurrentBoard->fbiVideoHeight = 256;
+            break;
+        case(GR_RESOLUTION_512x384):
+            sst1MonitorRez = 512;
+            sst1CurrentBoard->fbiVideoWidth = 512;
+            sst1CurrentBoard->fbiVideoHeight = 384;
+            break;
+        case(GR_RESOLUTION_640x400):
+            sst1MonitorRez = 640400;
+            sst1CurrentBoard->fbiVideoWidth = 640;
+            sst1CurrentBoard->fbiVideoHeight = 400;
+            break;
+        case(GR_RESOLUTION_640x480):
+            sst1MonitorRez = 640;
+            sst1CurrentBoard->fbiVideoWidth = 640;
+            sst1CurrentBoard->fbiVideoHeight = 480;
+            break;
+#ifdef H3D
+        case(GR_RESOLUTION_640x240_AUTOFLIPPED):
+            sst1MonitorRez = 640502;
+            sst1CurrentBoard->fbiVideoWidth = 640;
+            sst1CurrentBoard->fbiVideoHeight = 502;
+            break;
+        case(GR_RESOLUTION_800x300_AUTOFLIPPED):
+            sst1MonitorRez = 800620;
+            sst1CurrentBoard->fbiVideoWidth = 800;
+            sst1CurrentBoard->fbiVideoHeight = 620;
+            break;
+#endif
+        case(GR_RESOLUTION_800x600):
+            sst1MonitorRez = 800;
+            sst1CurrentBoard->fbiVideoWidth = 800;
+            sst1CurrentBoard->fbiVideoHeight = 600;
+            break;
+        case(GR_RESOLUTION_856x480):
+            sst1MonitorRez = 856;
+            sst1CurrentBoard->fbiVideoWidth = 856;
+            sst1CurrentBoard->fbiVideoHeight = 480;
+            break;
+        case(GR_RESOLUTION_960x720):
+            sst1MonitorRez = 960;
+            sst1CurrentBoard->fbiVideoWidth = 960;
+            sst1CurrentBoard->fbiVideoHeight = 720;
+            break;
+        default:
+            INIT_PRINTF(("sst1InitVideo(): Unsupported Resolution...\n"));
+            return(FXFALSE);
+            break;
+    }
+
+    switch(screenRefresh) {
+        case(GR_REFRESH_60Hz):
+            sst1MonitorRefresh = 60;
+            break;
+        case(GR_REFRESH_70Hz):
+            sst1MonitorRefresh = 70;
+            break;
+        case(GR_REFRESH_72Hz):
+            sst1MonitorRefresh = 72;
+            break;
+        case(GR_REFRESH_75Hz):
+            sst1MonitorRefresh = 75;
+            break;
+        case(GR_REFRESH_80Hz):
+            sst1MonitorRefresh = 80;
+            break;
+        case(GR_REFRESH_85Hz):
+            sst1MonitorRefresh = 85;
+            break;
+        case(GR_REFRESH_90Hz):
+            sst1MonitorRefresh = 90;
+            break;
+        case(GR_REFRESH_100Hz):
+            sst1MonitorRefresh = 100;
+            break;
+        case(GR_REFRESH_120Hz):
+            sst1MonitorRefresh = 120;
+            break;
+        default:
+            INIT_PRINTF(("sst1InitVideo(): Unsupported Refresh Rate...\n"));
+            return(FXFALSE);
+            break;
+    }
+
+    /* Override settings with environment variables */
+    if(GETENV(("SST_SCREENREZ"))) {
+        if(ATOI(GETENV(("SST_SCREENREZ"))) == 640) {
+            sst1MonitorRez = 640;
+            sst1CurrentBoard->fbiVideoWidth = 640;
+            sst1CurrentBoard->fbiVideoHeight = 480;
+        } else if(ATOI(GETENV(("SST_SCREENREZ"))) == 640400) {
+            sst1MonitorRez = 640400;
+            sst1CurrentBoard->fbiVideoWidth = 640;
+            sst1CurrentBoard->fbiVideoHeight = 400;
+        } else if(ATOI(GETENV(("SST_SCREENREZ"))) == 800) {
+            sst1MonitorRez = 800;
+            sst1CurrentBoard->fbiVideoWidth = 800;
+            sst1CurrentBoard->fbiVideoHeight = 600;
+        } else if(ATOI(GETENV(("SST_SCREENREZ"))) == 512256) {
+            sst1MonitorRez = 512256;
+            sst1CurrentBoard->fbiVideoWidth = 512;
+            sst1CurrentBoard->fbiVideoHeight = 256;
+        } else if(ATOI(GETENV(("SST_SCREENREZ"))) == 512) {
+            sst1MonitorRez = 512;
+            sst1CurrentBoard->fbiVideoWidth = 512;
+            sst1CurrentBoard->fbiVideoHeight = 384;
+        } else if(ATOI(GETENV(("SST_SCREENREZ"))) == 856) {
+            sst1MonitorRez = 856;
+            sst1CurrentBoard->fbiVideoWidth = 856;
+            sst1CurrentBoard->fbiVideoHeight = 480;
+        } else if(ATOI(GETENV(("SST_SCREENREZ"))) == 960) {
+            sst1MonitorRez = 960;
+            sst1CurrentBoard->fbiVideoWidth = 960;
+            sst1CurrentBoard->fbiVideoHeight = 720;
+        } else {
+            sst1MonitorRez = 640;
+            sst1CurrentBoard->fbiVideoWidth = 640;
+            sst1CurrentBoard->fbiVideoHeight = 480;
+        }
+    }
+    if(GETENV(("SST_SCREENREFRESH"))) {
+        if(ATOI(GETENV(("SST_SCREENREFRESH"))) == 60)
+            sst1MonitorRefresh = 60;
+        else if(ATOI(GETENV(("SST_SCREENREFRESH"))) == 72)
+            sst1MonitorRefresh = 72;
+        else if(ATOI(GETENV(("SST_SCREENREFRESH"))) == 75)
+            sst1MonitorRefresh = 75;
+        else if(ATOI(GETENV(("SST_SCREENREFRESH"))) == 85)
+            sst1MonitorRefresh = 85;
+        else if(ATOI(GETENV(("SST_SCREENREFRESH"))) == 120)
+            sst1MonitorRefresh = 120;
+        else
+            sst1MonitorRefresh = 60;
+    }
+
+    /* SLI only supports up to 60 Hz refresh at high resolutions */
+    if(sst1CurrentBoard->sstSliDetect && sst1CurrentBoard->fbiBoardID == 0x1)
+        sst1MonitorRefresh = 60;
+
+    if(altVideoTiming && !GETENV(("SST_SCREENREZ")) &&
+       !GETENV(("SST_SCREENREFRESH"))) {
+        sstVideoRez = altVideoTiming;
+        sst1CurrentBoard->fbiVideoRefresh = 60;
+        sst1CurrentBoard->fbiVideoWidth = sstVideoRez->xDimension;
+        sst1CurrentBoard->fbiVideoHeight = sstVideoRez->yDimension;
+    } else {
+        switch(sst1MonitorRez) {
+            case(512256):
+                sstVideoRez = &SST_VREZ_512X256_60;
+                break;
+            case(512):
+                if(sst1MonitorRefresh == 120)
+                    sstVideoRez = &SST_VREZ_512X384_120;
+                else if(sst1MonitorRefresh == 85)
+                    sstVideoRez = &SST_VREZ_512X384_85;
+                else if(sst1MonitorRefresh == 75)
+                    sstVideoRez = &SST_VREZ_512X384_75;
+                else if(sst1MonitorRefresh == 60 && GETENV(("SST_ARCADE")))
+                    sstVideoRez = &SST_VREZ_512X384_60;
+                else {
+                    sst1MonitorRefresh = 72;
+                    sstVideoRez = &SST_VREZ_512X384_72;
+                }
+                break;
+            case(640400):
+                if(sst1MonitorRefresh == 120)
+                    sstVideoRez = &SST_VREZ_640X400_120;
+                else if(sst1MonitorRefresh == 85)
+                    sstVideoRez = &SST_VREZ_640X400_85;
+                else if(sst1MonitorRefresh == 75)
+                    sstVideoRez = &SST_VREZ_640X400_75;
+                else {
+                    sst1MonitorRefresh = 70;
+                    sstVideoRez = &SST_VREZ_640X400_70;
+                }
+                break;
+            case(640):
+                if(sst1MonitorRefresh == 120)
+                    sstVideoRez = &SST_VREZ_640X480_120;
+                else if(sst1MonitorRefresh == 85)
+                    sstVideoRez = &SST_VREZ_640X480_85;
+                else if(sst1MonitorRefresh == 75)
+                    sstVideoRez = &SST_VREZ_640X480_75;
+                else {
+                    sst1MonitorRefresh = 60;
+                    sstVideoRez = &SST_VREZ_640X480_60;
+                }
+                break;
+#ifdef H3D
+            case(640502):
+              sst1MonitorRefresh = 60;
+              sstVideoRez = &SST_VREZ_640X502_60;
+              break;
+            case(800620):
+              sst1MonitorRefresh = 60;
+              sstVideoRez = &SST_VREZ_800X620_60;
+              break;
+#endif
+            case(800):
+                if(sst1MonitorRefresh == 85)
+                    sstVideoRez = &SST_VREZ_800X600_85;
+                else if(sst1MonitorRefresh == 75)
+                    sstVideoRez = &SST_VREZ_800X600_75;
+                else {
+                    sst1MonitorRefresh = 60;
+                    sstVideoRez = &SST_VREZ_800X600_60;
+                }
+                break;
+            case(856):
+                sst1MonitorRefresh = 60;
+                sstVideoRez = &SST_VREZ_856X480_60;
+                break;
+            case(960):
+                sst1MonitorRefresh = 60;
+                sstVideoRez = &SST_VREZ_960X720_60;
+                break;
+            default:
+                INIT_PRINTF(("sst1InitVideo(): Unsupported Resolution %d...\n",
+                    screenResolution));
+                return(FXFALSE);
+                break;
+        }
+        sst1CurrentBoard->fbiVideoRefresh = sst1MonitorRefresh;
+    }
+
+    if(GETENV(("SST_VIDEO_24BPP")))
+        sst1CurrentBoard->fbiVideo16BPP =
+            (ATOI(GETENV(("SST_VIDEO_24BPP")))) ^ 0x1;
+    else {
+        sst1CurrentBoard->fbiVideo16BPP = 0;
+
+        if(sst1CurrentBoard->fbiVideo16BPP && (sstVideoRez->video16BPPIsOK ==
+           FXFALSE))
+               sst1CurrentBoard->fbiVideo16BPP = 0;
+        if(!sst1CurrentBoard->fbiVideo16BPP && (sstVideoRez->video24BPPIsOK ==
+           FXFALSE))
+               sst1CurrentBoard->fbiVideo16BPP = 1;
+
+        if(altVideoTiming == (sst1VideoTimingStruct *) NULL) {
+            if(sst1CurrentBoard->sstSliDetect &&
+              (sst1CurrentBoard->fbiBoardID == 0x1) &&
+              (sstVideoRez->clkFreq24bpp > 52.0F)) {
+                 sst1CurrentBoard->fbiVideo16BPP = 1;
+            } else if(sst1CurrentBoard->fbiBoardID == 0x1) {
+                 // Obsidian Pro Board...
+                 if(sstVideoRez->clkFreq24bpp > 81.0F)
+                    sst1CurrentBoard->fbiVideo16BPP = 1;
+            } else {
+                if((sst1MonitorRefresh >= 85) || (sst1MonitorRez == 800) ||
+                   (sst1MonitorRez == 960))
+                    sst1CurrentBoard->fbiVideo16BPP = 1;
+            }
+        }
+#if 0
+#if 0
+        if(sst1CurrentBoard->fbiRevision == 2 &&
+           (altVideoTiming == (sst1VideoTimingStruct *) NULL) &&
+           (((sst1MonitorRez > 640) && (sst1MonitorRez != 512256) &&
+            (sst1MonitorRez != 640400)) || (sst1MonitorRefresh > 85)))
+            sst1CurrentBoard->fbiVideo16BPP = 1;
+#else
+        if((sst1MonitorRefresh >= 85) || (sst1MonitorRez == 800) ||
+           (sst1MonitorRez == 960))
+            sst1CurrentBoard->fbiVideo16BPP = 1;
+#endif
+#endif
+    }
+    video16BPP = sst1CurrentBoard->fbiVideo16BPP;
+
+    /* Reset Video Refresh Unit */
+    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+    
+    /* Enable video clock */
+    if(SLI_DRIVEOK()) {
+        INIT_PRINTF(("sst1InitVideo(): Enabling Video Clock...\n"));
+        PCICFG_WR(SST1_PCI_VCLK_ENABLE, 0x0);
+    }
+
+    /* Setup SST video timing registers */
+    if(GETENV(("SST_HSYNC"))) {
+        SSCANF(GETENV(("SST_HSYNC")), "%i", &vtmp);
+        INIT_PRINTF(("sst1InitVideo(): Using SST_HSYNC=0x%x\n", vtmp));
+        ISET(sst->hSync, vtmp);
+    } else
+        ISET(sst->hSync, ((sstVideoRez->hSyncOff << SST_VIDEO_HSYNC_OFF_SHIFT) |
+                      (sstVideoRez->hSyncOn << SST_VIDEO_HSYNC_ON_SHIFT)));
+    if(GETENV(("SST_VSYNC"))) {
+        SSCANF(GETENV(("SST_VSYNC")), "%i", &vtmp);
+        INIT_PRINTF(("sst1InitVideo(): Using SST_VSYNC=0x%x\n", vtmp));
+        ISET(sst->vSync, vtmp);
+    } else
+        ISET(sst->vSync, ((sstVideoRez->vSyncOff << SST_VIDEO_VSYNC_OFF_SHIFT) |
+                      (sstVideoRez->vSyncOn << SST_VIDEO_VSYNC_ON_SHIFT)));
+    if(GETENV(("SST_BACKPORCH"))) {
+        SSCANF(GETENV(("SST_BACKPORCH")), "%i", &vtmp);
+        INIT_PRINTF(("sst1InitVideo(): Using SST_BACKPORCH=0x%x\n", vtmp));
+        ISET(sst->backPorch, vtmp);
+    } else
+        ISET(sst->backPorch,
+                     ((sstVideoRez->vBackPorch << SST_VIDEO_VBACKPORCH_SHIFT) |
+                      (sstVideoRez->hBackPorch << SST_VIDEO_HBACKPORCH_SHIFT)));
+    if(GETENV(("SST_DIMENSIONS"))) {
+        SSCANF(GETENV(("SST_DIMENSIONS")), "%i", &vtmp);
+        INIT_PRINTF(("sst1InitVideo(): Using SST_DIMENSIONS=0x%x\n", vtmp));
+        sstVideoRez->yDimension = (vtmp >>  SST_VIDEO_YDIM_SHIFT) & 0x3ff;
+        sstVideoRez->xDimension = vtmp & 0x3ff;
+    }
+    ISET(sst->videoDimensions,
+                     ((sstVideoRez->yDimension << SST_VIDEO_YDIM_SHIFT) |
+                      ((sstVideoRez->xDimension-1) << SST_VIDEO_XDIM_SHIFT)));
+    if(GETENV(("SST_MEMOFFSET"))) {
+        SSCANF(GETENV(("SST_MEMOFFSET")), "%i", &vtmp);
+        INIT_PRINTF(("sst1InitVideo(): Using video memOffset=0x%x\n", vtmp));
+        sstVideoRez->memOffset = vtmp;
+    }
+    if(GETENV(("SST_TILESINX"))) {
+        SSCANF(GETENV(("SST_TILESINX")), "%i", &vtmp);
+        INIT_PRINTF(("sst1InitVideo(): Using video tilesInX=0x%x\n", vtmp));
+        sstVideoRez->tilesInX_Over2 = vtmp;
+    }
+
+    /* Setup SST memory mapper for desired resolution */
+    if(sst1CurrentBoard->fbiMemSize == 4)
+        sst1InitSetResolution(sstbase, sstVideoRez, 1); 
+    else
+        sst1InitSetResolution(sstbase, sstVideoRez, 0); 
+
+    if((GETENV(("SST_TRIPLE_BUFFER"))) ||
+       (sst1CurrentBoard->fbiTripleBufferingEnabled == FXTRUE)) {
+        INIT_PRINTF(("sst1InitVideo(): Enabling Triple Buffering\n"));
+        ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_TRIPLE_BUFFERING);
+    }
+
+    /* Calculate graphics clock frequency */
+    if(sst1InitCalcGrxClk(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    /* Setup video fifo */
+    /* NOTE: Lower values for the video fifo threshold improve video fifo */
+    /* underflow problems */
+    if(GETENV(("SST_VFIFO_THRESH"))) {
+        INIT_PRINTF(("sst1InitVideo(): Overriding Default Video Fifo Threshold %d and Storing %d\n",
+            sstVideoRez->vFifoThreshold, ATOI(GETENV(("SST_VFIFO_THRESH")))));
+        ISET(sst->fbiInit3, (IGET(sst->fbiInit3) & ~SST_VIDEO_FIFO_THRESH) |
+            ((ATOI(GETENV(("SST_VFIFO_THRESH"))))
+             << SST_VIDEO_FIFO_THRESH_SHIFT));
+    } else {
+        FxU32 vFifoThresholdVal = sstVideoRez->vFifoThreshold;
+
+        if(sst1CurrentBoard->grxClkFreq < 45)
+            /* Lower threshold value for slower graphics clocks */
+            vFifoThresholdVal = sstVideoRez->vFifoThreshold - 4;
+        ISET(sst->fbiInit3, (IGET(sst->fbiInit3) & ~SST_VIDEO_FIFO_THRESH) |
+            (vFifoThresholdVal << SST_VIDEO_FIFO_THRESH_SHIFT));
+    }
+
+    INIT_PRINTF(("sst1InitVideo() Setting up video for resolution (%d, %d), Refresh:%d Hz...\n",
+        sstVideoRez->xDimension, sstVideoRez->yDimension, sst1MonitorRefresh));
+    INIT_PRINTF(("sst1InitVideo(): Video Fifo Threshold = %d\n",
+        (IGET(sst->fbiInit3) & SST_VIDEO_FIFO_THRESH) >>
+         SST_VIDEO_FIFO_THRESH_SHIFT));
+
+    /* Initialize Y-Origin */
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit3, (IGET(sst->fbiInit3) & ~SST_YORIGIN_TOP) |
+        ((sstVideoRez->yDimension - 1) << SST_YORIGIN_TOP_SHIFT));
+
+    sst1InitIdleFBINoNOP(sstbase);
+
+    memFifoLwm = 23;
+    if(GETENV(("SST_MEMFIFO_LWM")))
+        SSCANF(GETENV(("SST_MEMFIFO_LWM")), "%i", &memFifoLwm);
+    memFifoHwm = 54;
+    if(GETENV(("SST_MEMFIFO_HWM")))
+        SSCANF(GETENV(("SST_MEMFIFO_HWM")), "%i", &memFifoHwm);
+    pciFifoLwm = 13;
+    if(GETENV(("SST_PCIFIFO_LWM")))
+        SSCANF(GETENV(("SST_PCIFIFO_LWM")), "%i", &pciFifoLwm);
+    INIT_PRINTF(("sst1InitVideo(): pciFifoLwm:%d  memFifoLwm:%d  memFifoHwm:%d\n",
+        pciFifoLwm, memFifoLwm, memFifoHwm));
+
+    /* Setup Memory FIFO */
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit4, IGET(sst->fbiInit4) &
+      ~(SST_MEM_FIFO_ROW_BASE | SST_MEM_FIFO_ROW_ROLL | SST_MEM_FIFO_LWM));
+    sst1InitIdleFBINoNOP(sstbase);
+    if(sst1CurrentBoard->fbiMemSize == 1)
+        ISET(sst->fbiInit4, IGET(sst->fbiInit4) |
+          (0xff << SST_MEM_FIFO_ROW_ROLL_SHIFT));
+    else if (sst1CurrentBoard->fbiMemSize == 2)
+        ISET(sst->fbiInit4, IGET(sst->fbiInit4) |
+          (0x1ff << SST_MEM_FIFO_ROW_ROLL_SHIFT));
+    else
+        /* 4 MBytes frame buffer memory... */
+        ISET(sst->fbiInit4, IGET(sst->fbiInit4) |
+          (0x3ff << SST_MEM_FIFO_ROW_ROLL_SHIFT));
+    sst1InitIdleFBINoNOP(sstbase);
+
+    if((sst1CurrentBoard->fbiMemSize == 1 && sst1MonitorRez == 512) ||
+       (sst1CurrentBoard->fbiMemSize == 1 && sst1MonitorRez == 512256) ||
+       (sst1CurrentBoard->fbiMemSize == 2 && sst1MonitorRez == 800) ||
+       (sst1CurrentBoard->fbiMemSize == 2 && sst1MonitorRez == 856))
+        ISET(sst->fbiInit4, IGET(sst->fbiInit4) |
+            ((2*sstVideoRez->memOffset) << SST_MEM_FIFO_ROW_BASE_SHIFT));
+    else if(sst1CurrentBoard->fbiMemSize < 4 && sst1MonitorRez == 960 &&
+        sst1CurrentBoard->sstSliDetect == 0)
+        return(FXFALSE);
+    else
+        ISET(sst->fbiInit4, IGET(sst->fbiInit4) |
+            ((3*sstVideoRez->memOffset) << SST_MEM_FIFO_ROW_BASE_SHIFT));
+    sst1InitIdleFBINoNOP(sstbase);
+    ISET(sst->fbiInit4, IGET(sst->fbiInit4) |
+      (memFifoLwm << SST_MEM_FIFO_LWM_SHIFT));
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Set PCI FIFO LWM */
+    ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_PCI_FIFO_LWM) |
+            (pciFifoLwm << SST_PCI_FIFO_LWM_SHIFT));
+    sst1InitIdleFBINoNOP(sstbase);
+
+    /* Enable Memory Fifo... */
+    if(GETENV(("SST_MEMFIFO")))
+        n = ATOI(GETENV(("SST_MEMFIFO")));
+    else
+        n = 1;
+
+    /* Prohibit illegal memory fifo settings... */
+    if(sst1CurrentBoard->fbiMemSize == 1 && sstVideoRez->xDimension > 512)
+        n = 0;
+    
+    if(n) {
+        sst1CurrentBoard->fbiMemoryFifoEn = 1;
+        if(sst1CurrentBoard->fbiMemSize == 1)
+            memFifoEntries = sstVideoRez->memFifoEntries_1MB;
+        else if(sst1CurrentBoard->fbiMemSize == 2)
+            memFifoEntries = sstVideoRez->memFifoEntries_2MB;
+        else
+            memFifoEntries = sstVideoRez->memFifoEntries_4MB;
+        if(GETENV(("SST_MEMFIFO_ENTRIES")))
+            SSCANF(GETENV(("SST_MEMFIFO_ENTRIES")), "%i", &memFifoEntries);
+        INIT_PRINTF(("sst1InitVideo(): Enabling Memory FIFO (Entries=%d)...\n",
+            0xffff - (memFifoEntries << 5)));
+
+        sst1CurrentBoard->memFifoStatusLwm = (memFifoEntries << 5) | 0x1f;
+        ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~(SST_MEM_FIFO_EN |
+            SST_MEM_FIFO_HWM | SST_PCI_FIFO_LWM | SST_MEM_FIFO_BURST_HWM)) |
+            (memFifoEntries << SST_MEM_FIFO_HWM_SHIFT) |
+            (pciFifoLwm << SST_PCI_FIFO_LWM_SHIFT) |
+            (memFifoHwm << SST_MEM_FIFO_BURST_HWM_SHIFT) |
+            SST_MEM_FIFO_EN);
+    }
+    INIT_PRINTF(("sst1InitVideo(): Setting memory FIFO LWM to 0x%x (%d)\n",
+                 sst1CurrentBoard->memFifoStatusLwm,
+                 sst1CurrentBoard->memFifoStatusLwm));  
+
+    vInClkDel = 0;
+    if((sst1MonitorRez == 960 && !video16BPP) ||
+       (sst1MonitorRez == 640 && !video16BPP && sst1MonitorRefresh == 120) ||
+       (sst1MonitorRez == 800 && !video16BPP && sst1MonitorRefresh == 75) ||
+       (sst1MonitorRez == 800 && !video16BPP && sst1MonitorRefresh == 85))
+        vInClkDel = 2;
+    if(sst1CurrentBoard->fbiRevision == 2)
+        vInClkDel = 0;
+    if(GETENV(("SST_VIN_CLKDEL")))
+        SSCANF(GETENV(("SST_VIN_CLKDEL")), "%i", &vInClkDel);
+
+    if(sst1CurrentBoard->fbiRevision == 2)
+        vOutClkDel = 2;
+    else
+        vOutClkDel = 0;
+    if(GETENV(("SST_VOUT_CLKDEL")))
+        SSCANF(GETENV(("SST_VOUT_CLKDEL")), "%i", &vOutClkDel);
+
+    INIT_PRINTF(("sst1InitVideo(): vInClkDel=0x%x  vOutClkDel=0x%x\n",
+        vInClkDel, vOutClkDel));
+
+    /* Drive dac output signals and select input video clock */
+    if(video16BPP) {
+        INIT_PRINTF(("sst1InitVideo(): Setting 16BPP video mode...\n"));
+        ISET(sst->fbiInit1, (IGET(sst->fbiInit1) & ~SST_VIDEO_MASK) |
+            (SST_VIDEO_DATA_OE_EN |
+             SST_VIDEO_BLANK_OE_EN |
+             SST_VIDEO_HVSYNC_OE_EN |
+             SST_VIDEO_DCLK_OE_EN |
+             SST_VIDEO_VID_CLK_2X |
+             (vInClkDel << SST_VIDEO_VCLK_DEL_SHIFT) |
+             (vOutClkDel << SST_VIDEO_VCLK_2X_OUTPUT_DEL_SHIFT) |
+             SST_VIDEO_VCLK_SEL));
+        sst1InitIdleFBINoNOP(sstbase);
+    } else {
+        INIT_PRINTF(("sst1InitVideo(): Setting 24BPP video mode...\n"));
+        ISET(sst->fbiInit1, (IGET(sst->fbiInit1) & ~SST_VIDEO_MASK) |
+            (SST_VIDEO_DATA_OE_EN |
+             SST_VIDEO_BLANK_OE_EN |
+             SST_VIDEO_HVSYNC_OE_EN |
+             SST_VIDEO_DCLK_OE_EN |
+             SST_VIDEO_VID_CLK_2X |
+             SST_VIDEO_VCLK_DIV2 |
+             (vInClkDel << SST_VIDEO_VCLK_DEL_SHIFT) |
+             (vOutClkDel << SST_VIDEO_VCLK_2X_OUTPUT_DEL_SHIFT) |
+             SST_VIDEO_24BPP_EN));
+        sst1InitIdleFBINoNOP(sstbase);
+        if(!GETENV(("SST_VIDEO_FILTER_DISABLE"))) {
+            ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_FILTER_EN);
+            if(GETENV(("SST_VIDEO_FILTER_THRESHOLD"))) {
+                SSCANF(GETENV(("SST_VIDEO_FILTER_THRESHOLD")), "%i", &n);
+                INIT_PRINTF(("sst1InitVideo(): Setting Video Filtering Treshold to 0x%x...\n", n));
+
+                ISET(sst->videoFilterRgbThreshold, n);
+            } else
+                /* sst->videoFilterRgbThreshold = 0x180c18; */
+                ISET(sst->videoFilterRgbThreshold, 0x080408);
+        } else
+            INIT_PRINTF(("sst1InitVideo(): Disabling Video Filtering...\n"));
+    }
+
+    /* Adjust FT-clock delay */
+    if(sst1CurrentBoard->fbiRevision == 2) {
+        /* .5 micron */
+        if(sst1CurrentBoard->tmuRevision == 1)
+            ft_clk_del = SST_FT_CLK_DEL_ADJ_DEFAULT_R21;
+        else
+            ft_clk_del = SST_FT_CLK_DEL_ADJ_DEFAULT_R20;
+    } else {
+        /* .6 micron */
+        if(sst1CurrentBoard->tmuRevision == 1)
+            ft_clk_del = SST_FT_CLK_DEL_ADJ_DEFAULT_R11;
+        else
+            ft_clk_del = SST_FT_CLK_DEL_ADJ_DEFAULT_R10;
+    }
+
+    /* Adjust TF-clock delay */
+    if(sst1CurrentBoard->tmuRevision == 1) {
+        if(sst1CurrentBoard->fbiRevision == 2) {
+            tf0_clk_del = SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R21;
+            tf1_clk_del = SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R21;
+            tf2_clk_del = SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R21;
+        } else {
+            tf0_clk_del = SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R11;
+            tf1_clk_del = SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R11;
+            tf2_clk_del = SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R11;
+        }
+    } else {
+        if(sst1CurrentBoard->fbiRevision == 2) {
+            tf0_clk_del = SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R20;
+            tf1_clk_del = SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R20;
+            tf2_clk_del = SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R20;
+        } else {
+            tf0_clk_del = SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R10;
+            tf1_clk_del = SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R10;
+            tf2_clk_del = SST_TEX_TF_CLK_DEL_ADJ_DEFAULT_R10;
+        }
+    }
+    /* Adjust clock delays for .5 micron to account for frequency
+       dependencies */
+    if(sst1CurrentBoard->fbiRevision == 2 && sst1CurrentBoard->tmuRevision == 1)
+    {
+        if(sst1CurrentBoard->grxClkFreq >= 55) {
+            ft_clk_del = tf0_clk_del = tf1_clk_del = tf2_clk_del = 0x4;
+        } else if(sst1CurrentBoard->grxClkFreq >= 50) {
+            ft_clk_del = tf0_clk_del = tf1_clk_del = tf2_clk_del = 0x5;
+        } else if(sst1CurrentBoard->grxClkFreq >= 48) {
+            ft_clk_del = tf0_clk_del = tf1_clk_del = tf2_clk_del = 0x6;
+        } else if(sst1CurrentBoard->grxClkFreq >= 45) {
+            ft_clk_del = tf0_clk_del = tf1_clk_del = tf2_clk_del = 0x7;
+        } else if(sst1CurrentBoard->grxClkFreq >= 43) {
+            ft_clk_del = tf0_clk_del = tf1_clk_del = tf2_clk_del = 0x8;
+        } else {
+            ft_clk_del = tf0_clk_del = tf1_clk_del = tf2_clk_del = 0x9;
+        }
+    }
+
+    /* Override with environment variables */
+    if(GETENV(("SST_FT_CLK_DEL")))
+        SSCANF(GETENV(("SST_FT_CLK_DEL")), "%i", &ft_clk_del);
+    if(GETENV(("SST_TF0_CLK_DEL")))
+        SSCANF(GETENV(("SST_TF0_CLK_DEL")), "%i", &tf0_clk_del);
+    if(GETENV(("SST_TF1_CLK_DEL")))
+        SSCANF(GETENV(("SST_TF1_CLK_DEL")), "%i", &tf1_clk_del);
+    if(GETENV(("SST_TF2_CLK_DEL")))
+        SSCANF(GETENV(("SST_TF2_CLK_DEL")), "%i", &tf2_clk_del);
+
+    INIT_PRINTF(("sst1InitVideo(): Setting FBI-to-TREX clock delay to 0x%x...\n", ft_clk_del));
+    INIT_PRINTF(("sst1InitVideo(): Setting TREX#0 TREX-to-FBI clock delay to 0x%x\n",
+        tf0_clk_del));
+    INIT_PRINTF(("sst1InitVideo(): Setting TREX#1 TREX-to-FBI clock delay to 0x%x\n",
+        tf1_clk_del));
+    INIT_PRINTF(("sst1InitVideo(): Setting TREX#2 TREX-to-FBI clock delay to 0x%x\n",
+        tf2_clk_del));
+
+    ISET(sst->fbiInit3, (IGET(sst->fbiInit3) & ~SST_FT_CLK_DEL_ADJ) |
+        (ft_clk_del << SST_FT_CLK_DEL_ADJ_SHIFT));
+    sst1InitIdleFBINoNOP(sstbase);
+
+    sst1CurrentBoard->tmuInit1[0] = (sst1CurrentBoard->tmuInit1[0] &
+        ~SST_TEX_TF_CLK_DEL_ADJ) | (tf0_clk_del<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT);
+    sst1CurrentBoard->tmuInit1[1] = (sst1CurrentBoard->tmuInit1[1] &
+        ~SST_TEX_TF_CLK_DEL_ADJ) | (tf1_clk_del<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT);
+    sst1CurrentBoard->tmuInit1[2] = (sst1CurrentBoard->tmuInit1[2] &
+        ~SST_TEX_TF_CLK_DEL_ADJ) | (tf2_clk_del<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT);
+
+    ISET(SST_TREX(sst,0)->trexInit1, sst1CurrentBoard->tmuInit1[0]);
+    /* sst1InitIdleFBINoNOP(sstbase); */
+    /* Can't use sst1InitIdleFbi because changing the tf clock delay may */
+    /* incorrectly put data into the TREX-to-FBI fifo */
+    for(n=0; n<100; n++) sst1InitReturnStatus(sstbase);
+    ISET(SST_TREX(sst,1)->trexInit1, sst1CurrentBoard->tmuInit1[1]);
+    for(n=0; n<100; n++) sst1InitReturnStatus(sstbase);
+    ISET(SST_TREX(sst,2)->trexInit1, sst1CurrentBoard->tmuInit1[2]);
+    for(n=0; n<100; n++) sst1InitReturnStatus(sstbase);
+
+    /* Setup graphics clock */
+    if(sst1InitGrxClk(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    /* Setup video mode */
+    if(sst1InitSetVidMode(sstbase, video16BPP) == FXFALSE)
+        return(FXFALSE);
+
+    /* Adjust Video Clock */
+#ifndef DIRECTX
+    if(GETENV(("SST_VIDCLK2X"))) {
+        float vidClkFreq;
+
+        SSCANF(GETENV(("SST_VIDCLK2X")), "%f", &vidClkFreq);
+        if(sst1InitSetVidClk(sstbase, vidClkFreq) == FXFALSE)
+            return(FXFALSE);
+    } else {
+#endif
+        if(sst1InitUseVoodooFile == FXTRUE) {
+            if(sst1InitSetVidClkINI(sstbase, sst1CurrentBoard->fbiVideoWidth,
+              sst1CurrentBoard->fbiVideoHeight,
+              sst1CurrentBoard->fbiVideoRefresh, video16BPP) == FXFALSE)
+                return(FXFALSE);
+        } else {
+            if(video16BPP) {
+                if(sst1InitSetVidClk(sstbase, sstVideoRez->clkFreq16bpp) ==
+                  FXFALSE)
+                    return(FXFALSE);
+            } else {
+                if(sst1InitSetVidClk(sstbase, sstVideoRez->clkFreq24bpp) ==
+                  FXFALSE)
+                    return(FXFALSE);
+            }
+        }
+#ifndef DIRECTX
+    }
+#endif
+
+    /* Wait for video clock to stabilize */
+    for(n=0; n<200000; n++)
+        sst1InitReturnStatus(sstbase);
+
+    /* Run Video Reset Module */
+    ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_RESET);
+    sst1InitIdleFBINoNOP(sstbase);
+
+    ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH);
+
+    sst1InitIdleFBINoNOP(sstbase);
+
+    if(!GETENV(("SST_VIDEO_NOCLEAR"))) {
+        /* Clear Screen */
+        FxU32 clearColor = 0x0;
+
+        if(GETENV(("SST_VIDEO_CLEARCOLOR")))
+            SSCANF(GETENV(("SST_VIDEO_CLEARCOLOR")), "%i", &clearColor);
+        ISET(sst->c1, clearColor);
+        ISET(sst->c0, clearColor);
+        ISET(sst->zaColor, 0x0);
+        ISET(sst->clipLeftRight, sstVideoRez->xDimension);
+        ISET(sst->clipBottomTop, sstVideoRez->yDimension);
+        ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK);
+        ISET(sst->fastfillCMD, 0x0);   /* Frontbuffer & Z/A */
+        ISET(sst->fbzMode, SST_RGBWRMASK | SST_DRAWBUFFER_BACK);/* Backbuffer */
+        ISET(sst->fastfillCMD, 0x0);
+        /* Clear fbistat registers after clearing screen */
+        ISET(sst->nopCMD, 0x1);
+        sst1InitIdleFBINoNOP(sstbase);
+    } else
+        INIT_PRINTF(("sst1InitVideo(): Not Clearing Frame Buffer(s)...\n"));
+
+    sst1InitVgaPassCtrl(sstbase, 0);
+
+    if(GETENV(("SST_VIDEO_DISABLE"))) {
+        INIT_PRINTF(("sst1InitVideo(): Disabling video timing...\n"));
+        ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
+        sst1InitIdleFBINoNOP(sstbase);
+    }
+    sst1InitIdle(sstbase);
+
+    if(((IGET(sst->status) & SST_SWAPBUFPENDING) >>
+      SST_SWAPBUFPENDING_SHIFT) > 0)
+        sst1InitClearSwapPending(sstbase);
+
+    INIT_PRINTF(("sst1InitVideo() exiting with status %d...\n", FXTRUE));
+    return(FXTRUE);
+}
+
+/*
+** sst1InitFindVideoTimingStruct():
+**    Returns:
+**      Video Timing Structure
+*/
+FX_EXPORT sst1VideoTimingStruct * FX_CSTYLE sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution, 
+                                                                          GrScreenRefresh_t screenRefresh)
+{
+    sst1VideoTimingStruct *sstVideoRez = NULL;
+    FxU32 sst1MonitorRefresh;
+    FxU32 sst1MonitorRez;
+
+    switch(screenResolution) {
+        case(GR_RESOLUTION_512x256):
+            sst1MonitorRez = 512256;
+            break;
+        case(GR_RESOLUTION_512x384):
+            sst1MonitorRez = 512;
+            break;
+        case(GR_RESOLUTION_640x400):
+            sst1MonitorRez = 640400;
+            break;
+        case(GR_RESOLUTION_640x480):
+            sst1MonitorRez = 640;
+            break;
+#ifdef H3D
+        case(GR_RESOLUTION_640x240_AUTOFLIPPED):
+            sst1MonitorRez = 640502;
+            break;
+        case(GR_RESOLUTION_800x300_AUTOFLIPPED):
+            sst1MonitorRez = 800620;
+            break;
+#endif
+        case(GR_RESOLUTION_800x600):
+            sst1MonitorRez = 800;
+            break;
+        case(GR_RESOLUTION_856x480):
+            sst1MonitorRez = 856;
+            break;
+        case(GR_RESOLUTION_960x720):
+            sst1MonitorRez = 960;
+            break;
+        default:
+            return(NULL);
+            break;
+    }
+
+    switch(screenRefresh) {
+        case(GR_REFRESH_60Hz):
+            sst1MonitorRefresh = 60;
+            break;
+        case(GR_REFRESH_70Hz):
+            sst1MonitorRefresh = 70;
+            break;
+        case(GR_REFRESH_72Hz):
+            sst1MonitorRefresh = 72;
+            break;
+        case(GR_REFRESH_75Hz):
+            sst1MonitorRefresh = 75;
+            break;
+        case(GR_REFRESH_80Hz):
+            sst1MonitorRefresh = 80;
+            break;
+        case(GR_REFRESH_85Hz):
+            sst1MonitorRefresh = 85;
+            break;
+        case(GR_REFRESH_90Hz):
+            sst1MonitorRefresh = 90;
+            break;
+        case(GR_REFRESH_100Hz):
+            sst1MonitorRefresh = 100;
+            break;
+        case(GR_REFRESH_120Hz):
+            sst1MonitorRefresh = 120;
+            break;
+        default:
+            return(NULL);
+            break;
+    }
+
+    /* Override settings with environment variables */
+    if(GETENV(("SST_SCREENREZ"))) {
+        if(ATOI(GETENV(("SST_SCREENREZ"))) == 640) {
+            sst1MonitorRez = 640;
+        } else if(ATOI(GETENV(("SST_SCREENREZ"))) == 640400) {
+            sst1MonitorRez = 640400;
+        } else if(ATOI(GETENV(("SST_SCREENREZ"))) == 800) {
+            sst1MonitorRez = 800;
+        } else if(ATOI(GETENV(("SST_SCREENREZ"))) == 512256) {
+            sst1MonitorRez = 512256;
+        } else if(ATOI(GETENV(("SST_SCREENREZ"))) == 512) {
+            sst1MonitorRez = 512;
+        } else if(ATOI(GETENV(("SST_SCREENREZ"))) == 856) {
+            sst1MonitorRez = 856;
+        } else if(ATOI(GETENV(("SST_SCREENREZ"))) == 960) {
+            sst1MonitorRez = 960;
+        } else {
+            sst1MonitorRez = 640;
+        }
+    }
+    if(GETENV(("SST_SCREENREFRESH"))) {
+        if(ATOI(GETENV(("SST_SCREENREFRESH"))) == 60)
+            sst1MonitorRefresh = 60;
+        else if(ATOI(GETENV(("SST_SCREENREFRESH"))) == 72)
+            sst1MonitorRefresh = 72;
+        else if(ATOI(GETENV(("SST_SCREENREFRESH"))) == 75)
+            sst1MonitorRefresh = 75;
+        else if(ATOI(GETENV(("SST_SCREENREFRESH"))) == 85)
+            sst1MonitorRefresh = 85;
+        else if(ATOI(GETENV(("SST_SCREENREFRESH"))) == 120)
+            sst1MonitorRefresh = 120;
+        else
+            sst1MonitorRefresh = 60;
+    }
+
+    switch(sst1MonitorRez) {
+    case(512256):
+      sstVideoRez = &SST_VREZ_512X256_60;
+      break;
+    case(512):
+      if(sst1MonitorRefresh == 120)
+        sstVideoRez = &SST_VREZ_512X384_120;
+      else if(sst1MonitorRefresh == 85)
+        sstVideoRez = &SST_VREZ_512X384_85;
+      else if(sst1MonitorRefresh == 75)
+        sstVideoRez = &SST_VREZ_512X384_75;
+      else if(sst1MonitorRefresh == 60 && GETENV(("SST_ARCADE")))
+        sstVideoRez = &SST_VREZ_512X384_60;
+      else {
+        sstVideoRez = &SST_VREZ_512X384_72;
+      }
+      break;
+    case(640400):
+      if(sst1MonitorRefresh == 120)
+        sstVideoRez = &SST_VREZ_640X400_120;
+      else if(sst1MonitorRefresh == 85)
+        sstVideoRez = &SST_VREZ_640X400_85;
+      else if(sst1MonitorRefresh == 75)
+        sstVideoRez = &SST_VREZ_640X400_75;
+      else {
+        sstVideoRez = &SST_VREZ_640X400_70;
+      }
+      break;
+    case(640):
+      if(sst1MonitorRefresh == 120)
+        sstVideoRez = &SST_VREZ_640X480_120;
+      else if(sst1MonitorRefresh == 85)
+        sstVideoRez = &SST_VREZ_640X480_85;
+      else if(sst1MonitorRefresh == 75)
+        sstVideoRez = &SST_VREZ_640X480_75;
+      else {
+        sstVideoRez = &SST_VREZ_640X480_60;
+      }
+      break;
+#ifdef H3D
+    case(640502):
+      sstVideoRez = &SST_VREZ_640X502_60;
+      break;
+    case(800620):
+      sstVideoRez = &SST_VREZ_800X620_60;
+      break;
+#endif
+    case(800):
+      if(sst1MonitorRefresh == 85)
+        sstVideoRez = &SST_VREZ_800X600_85;
+      else if(sst1MonitorRefresh == 75)
+        sstVideoRez = &SST_VREZ_800X600_75;
+      else {
+        sstVideoRez = &SST_VREZ_800X600_60;
+      }
+      break;
+    case(856):
+      sstVideoRez = &SST_VREZ_856X480_60;
+      break;
+    case(960):
+      sstVideoRez = &SST_VREZ_960X720_60;
+      break;
+    default:
+      return(NULL);
+      break;
+    }
+    return(sstVideoRez);
+}
+
+/*
+** sst1InitSetVidMode():
+**  Set video Mode
+**
+*/
+FxBool sst1InitSetVidMode(FxU32 *sstbase, FxU32 video16BPP)
+{
+    int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+
+    if(helper)
+        INIT_PRINTF(("sst1InitSetVidMode(): Entered...\n"));
+
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    if(sst1InitUseVoodooFile == FXTRUE) {
+        return(sst1InitSetVidModeINI(sstbase, video16BPP));
+    } else {
+        if((sst1CurrentBoard->fbiDacType == SST_FBI_DACTYPE_ATT) ||
+           (sst1CurrentBoard->fbiDacType == SST_FBI_DACTYPE_TI))
+           return(sst1InitSetVidModeATT(sstbase, video16BPP));
+        else if(sst1CurrentBoard->fbiDacType == SST_FBI_DACTYPE_ICS)
+           return(sst1InitSetVidModeICS(sstbase, video16BPP));
+        else
+            return(FXFALSE);
+    }
+}
+
+/*
+** sst1InitSetResolution():
+**  Setup FBI video resolution registers
+**  This routine is used by sst1InitVideo()
+**
+**
+*/
+FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase, 
+    sst1VideoTimingStruct *sstVideoRez, FxU32 Banked)
+{
+    volatile Sstregs *sst = (Sstregs *) sstbase;
+
+    if(Banked)
+        ISET(sst->fbiInit2, (IGET(sst->fbiInit2) & ~SST_VIDEO_BUFFER_OFFSET) |
+            (sstVideoRez->memOffset << SST_VIDEO_BUFFER_OFFSET_SHIFT) |
+            SST_DRAM_BANKING_CONFIG | SST_EN_DRAM_BANKED);
+    else
+        ISET(sst->fbiInit2, (IGET(sst->fbiInit2) & ~SST_VIDEO_BUFFER_OFFSET) |
+            (sstVideoRez->memOffset << SST_VIDEO_BUFFER_OFFSET_SHIFT));
+
+    ISET(sst->fbiInit1, (IGET(sst->fbiInit1) & ~SST_VIDEO_TILES_IN_X) |
+        (sstVideoRez->tilesInX_Over2 << SST_VIDEO_TILES_IN_X_SHIFT));
+}
+
+/*
+** sst1InitSetVidClk():
+**  Set video clock
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitSetVidClk(FxU32 *sstbase, float vidClkFreq)
+{
+    sst1ClkTimingStruct vidClkTiming;
+    int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+
+    if(helper)
+
+        INIT_PRINTF(("sst1InitSetVidClk(): Entered...\n"));
+
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    if(sst1InitComputeClkParams(vidClkFreq, &vidClkTiming) == FXFALSE)
+        return(FXFALSE);
+
+    INIT_PRINTF(("sst1InitSetVidClk(): Setting up %.2f MHz Video Clock...\n",
+        vidClkFreq));
+
+    if((sst1CurrentBoard->fbiDacType == SST_FBI_DACTYPE_ATT) ||
+       (sst1CurrentBoard->fbiDacType == SST_FBI_DACTYPE_TI))
+       return(sst1InitSetVidClkATT(sstbase, &vidClkTiming));
+    else if(sst1CurrentBoard->fbiDacType == SST_FBI_DACTYPE_ICS)
+       return(sst1InitSetVidClkICS(sstbase, &vidClkTiming));
+    else
+        return(FXFALSE);
+}
+
+/*
+** sst1InitSetGrxClk():
+**  Set graphics clock
+**  NOTE: sst1InitSetGrxClk() resets the PCI fifo and the graphics subsystem
+**  of FBI
+**
+*/
+FX_EXPORT FxBool FX_CSTYLE sst1InitSetGrxClk(FxU32 *sstbase,
+  sst1ClkTimingStruct *sstGrxClk)
+{
+    FxBool retVal = FXFALSE;
+    int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
+
+    if(helper)
+        INIT_PRINTF(("sst1InitSetGrxClk(): Entered...\n"));
+
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    if(sst1InitUseVoodooFile == FXTRUE) {
+        retVal = sst1InitSetGrxClkINI(sstbase, sstGrxClk);
+    } else {
+        if((sst1CurrentBoard->fbiDacType == SST_FBI_DACTYPE_ATT) ||
+           (sst1CurrentBoard->fbiDacType == SST_FBI_DACTYPE_TI))
+           retVal = sst1InitSetGrxClkATT(sstbase, sstGrxClk);
+        else if(sst1CurrentBoard->fbiDacType == SST_FBI_DACTYPE_ICS)
+           retVal = sst1InitSetGrxClkICS(sstbase, sstGrxClk);
+    }
+    if(retVal == FXFALSE)
+        return(FXFALSE);
+
+    /* Fix problem where first Texture downloads to TMU weren't being
+       received properly */
+    ISET(*(long *) (0xf00000 + (long) sstbase), 0xdeadbeef);
+
+    if(sst1InitReturnStatus(sstbase) & SST_TREX_BUSY) {
+        INIT_PRINTF(("sst1InitSetGrxClk(): Resetting TMUs after clock change...\n"));
+        return(sst1InitResetTmus(sstbase));
+    }
+    return(FXTRUE);
+}
+
+/*
+** sst1InitSetTripleBuffering():
+**  Specify Video Triple Buffering
+**  NOTE: sst1InitSetTripleBuffering() must be called prior to calling 
+**   sst1InitVideo() to properly setup Video Triple Buffering
+**
+*/
+FX_ENTRY FxBool FX_CALL sst1InitSetTripleBuffering(FxU32 *sstbase,
+  FxBool enableTripleBuffering)
+{
+    if(sst1InitCheckBoard(sstbase) == FXFALSE)
+        return(FXFALSE);
+
+    sst1CurrentBoard->fbiTripleBufferingEnabled = enableTripleBuffering;
+
+    return(FXTRUE);
+}
+
+#pragma optimize ("",on)
Index: trunk/src/opengl/glide/sst1/init/makefile
===================================================================
--- trunk/src/opengl/glide/sst1/init/makefile	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/makefile	(revision 2885)
@@ -0,0 +1,57 @@
+# $Id: makefile,v 1.1 2000-02-25 00:31:27 sandervl Exp $
+#
+# PD-Win32 API
+#
+#       Glide makefile
+#
+
+PDWIN32_INCLUDE = ..\..\..\..\..\include
+PDWIN32_LIB = ..\..\..\..\..\lib
+PDWIN32_BIN = ..\..\..\..\..\bin
+PDWIN32_TOOLS = ..\..\..\..\..\tools\bin
+
+!include $(PDWIN32_INCLUDE)/pdwin32.mk
+!include ..\3dfx.mak
+
+TARGET1=init
+TARGET2=initvg
+
+CINCLUDE=-I..\incsrc;..\..\swlibs\fxmisc;initvg;..\glide;..\texus;..\..\swlibs\pcilib
+
+CFLAGS = $(CFLAGS) $(CINCLUDE)
+CXXFLAGS = $(CXXFLAGS) $(CINCLUDE)
+
+OBJS =	H3DRVR.OBJ      INIT.OBJ        VG96DRVR.OBJ    VGDRVR.OBJ \
+ 	$(TARGET2)\DAC.OBJ         $(TARGET2)\GAMMA.OBJ       $(TARGET2)\GDEBUG.OBJ      $(TARGET2)\INFO.OBJ        $(TARGET2)\PARSE.OBJ \
+	$(TARGET2)\PRINT.OBJ       $(TARGET2)\SLI.OBJ         $(TARGET2)\SST1INIT.OBJ    $(TARGET2)\UTIL.OBJ        $(TARGET2)\VIDEO.OBJ
+
+all: $(TARGET2).lib $(TARGET1).lib
+
+$(TARGET1).lib: $(OBJS)
+	$(RM) $(TARGET1).lib
+	$(ILIB) $(ILIBFLAGS) $(TARGET1).lib $(OBJS),,
+
+
+$(TARGET2).lib:
+    cd initvg
+    $(MAKE_CMD)
+    cd ..
+
+dep:
+    $(DEPEND) -I$(PDWIN32_INCLUDE);$(PDWIN32_INCLUDE)\win $(CINCLUDE) \
+        *.c *.cpp *.h *.asm *.inc $(PDWIN32_INCLUDE)\*.h \
+        ..\incsrc\*.h ..\..\swlibs\fxmisc\*.h initvg\*.h ..\glide\*.h ..\texus\*.h ..\..\swlibs\pcilib\*.h 
+    cd initvg
+    $(MAKE_CMD) NODEP=1 dep
+
+!ifndef NODEP
+!include .depend
+!endif
+
+clean:
+    $(RM) *.obj *.pch
+    $(RM) *.lib
+    cd initvg
+    $(MAKE_CMD) clean
+    cd ..
+
Index: trunk/src/opengl/glide/sst1/init/project.txt
===================================================================
--- trunk/src/opengl/glide/sst1/init/project.txt	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/project.txt	(revision 2885)
@@ -0,0 +1,80 @@
+What happens when glide initializes:
+
+* Identify Installed Hardware
+        - What if both an SST-1 and an AT3D are installed?
+          some behavior must be defined.  We could have an
+          enumerate3DfxHardware?
+* Locate and Load the correct DLL for the desired hardware.
+        - This requires that the interface be very well defined,
+          and we want it to be binary compatible across revisions.
+        - Under DOS either all init code must be statically linked in,
+          or we need a DOS DLL mechanism.
+* Map the desired device into virtual memory
+* Describe the selected hardware to the user/glide
+* Do card soft reset.
+        - this sets all register state to desired power on defaults so
+          that future operations can proceed from a known, well-defined
+          hardware state
+* Do card initialization:
+        - Under full screen this will involve setting up video timing
+          for the desired resolution and setting up whatever registers
+          are necessary to enable requrested color, alpha, depth buffers,
+          as well as configuring a command fifo if necessary.
+        - In a window this will negotiate with the operating system
+          for whatever shared resources are necessary. 
+* Initialize gamma correction
+        - Under Win95 this does nothing probably
+
+
+What happens when glide shuts down:
+
+* Idle the graphics hardware
+* Shut down graphics
+        - Win95 ( window )
+          free all ddraw resources.
+        - Win95 ( full-screen )
+          switch back to desktop
+          free all ddraw resources
+        - Dos   ( full-screen )
+          switch back to mode 3
+* Unmap card from virtual memory
+
+
+What happens when the user wants to write to the LFB:
+** Two approaches:
+* Define a code region in which LFB accesses are permitted
+        - Win95 ( window )
+          take a DDRAW lock on the surface and give pointer to users
+          lfbBegin( enum READWRITE ) - now returns a write pointer
+          do lfb writes
+          release ddraw lock - ( invalidates pointer )
+        - Win95 ( fullscreen )
+          same
+        - DOS ( fullscreen )
+          return pointer to frame buffer that was mapped at init time
+          
+* Don't ever allow user direct access to LFB
+        - All ugliness of lfb writes is 
+          hidden in writepixel/writerect functions
+
+What happens when the user wants to read from the LFB:
+** Two approaches:
+* Define a code region in which LFB accesses are permitted
+        - Win95 ( window )
+          take a readable DDRAW lock on the surface and give pointer to users
+          lfbBegin( enum READWRITE ) - now returns a readpointer pointer
+          do lfb writes
+          release ddraw lock - ( invalidates pointer )
+        - Win95 ( fullscreen )
+          same
+        - DOS ( fullscreen )
+          return pointer to frame buffer that was mapped at init time
+          
+* Don't ever allow user direct access to LFB
+        - All ugliness of lfb reads is 
+          hidden in readpixel/readrect functions
+        
+
+
+
+
Index: trunk/src/opengl/glide/sst1/init/sst1vid.h
===================================================================
--- trunk/src/opengl/glide/sst1/init/sst1vid.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/sst1vid.h	(revision 2885)
@@ -0,0 +1,112 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glide/sst1/init/sst1vid.h,v 1.1 2000-02-25 00:31:27 sandervl Exp $
+** $Log: sst1vid.h,v $
+** Revision 1.1  2000-02-25 00:31:27  sandervl
+** Created new Voodoo 1 Glide dir
+**
+ * 
+ * 4     9/09/97 7:35p Sellers
+ * Added 400x300 resolution
+ * 
+ * 3     8/24/97 9:31a Sellers
+ * moved new video timing to sst1vid.h
+ * redefined 1600x1280 to be 1600x1200
+ * 
+ * 2     6/05/97 11:14p Pgj
+ * 
+ * 5     7/24/96 3:43p Sellers
+ * added 512x384 @ 60 Hz for arcade monitors
+ * added 512x256 @ 60 Hz for arcade monitors
+ * 
+ * 4     7/18/96 10:58a Sellers
+ * fixed FT and TF clock delay values for lower frequencies with
+ * .5/.5 combos
+ * 
+ * 3     6/18/96 6:54p Sellers
+ * added sst1InitShutdownSli() to fix Glide Splash screen problems with
+ * SLI
+ * 
+ * 2     6/13/96 7:45p Sellers
+ * added "voodoo.ini" support
+ * added DirectX support
+ * misc cleanup
+ * 
+ * 2     6/11/96 1:43p Sellers
+ * added support for 60, 75, 85, and 120 Hz refresh rates for "most"
+ * resolutions
+ * 
+ * 1     5/08/96 5:43p Paik
+ * Video definitions
+*/
+#ifndef __SST1VID_H__
+#define __SST1VID_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Video defines */
+
+typedef FxI32 GrScreenRefresh_t;
+#define GR_REFRESH_60Hz   0x0
+#define GR_REFRESH_70Hz   0x1
+#define GR_REFRESH_72Hz   0x2
+#define GR_REFRESH_75Hz   0x3
+#define GR_REFRESH_80Hz   0x4
+#define GR_REFRESH_90Hz   0x5
+#define GR_REFRESH_100Hz  0x6
+#define GR_REFRESH_85Hz   0x7
+#define GR_REFRESH_120Hz  0x8
+#define GR_REFRESH_NONE   0xff
+
+typedef FxI32 GrScreenResolution_t;
+#define GR_RESOLUTION_320x200   0x0
+#define GR_RESOLUTION_320x240   0x1
+#define GR_RESOLUTION_400x256   0x2
+#define GR_RESOLUTION_512x384   0x3
+#define GR_RESOLUTION_640x200   0x4
+#define GR_RESOLUTION_640x350   0x5
+#define GR_RESOLUTION_640x400   0x6
+#define GR_RESOLUTION_640x480   0x7
+#define GR_RESOLUTION_800x600   0x8
+#define GR_RESOLUTION_960x720   0x9
+#define GR_RESOLUTION_856x480   0xa
+#define GR_RESOLUTION_512x256   0xb
+#define GR_RESOLUTION_1024x768  0xC
+#define GR_RESOLUTION_1280x1024 0xD
+#define GR_RESOLUTION_1600x1200 0xE
+#define GR_RESOLUTION_400x300   0xF
+#define GR_RESOLUTION_NONE      0xff
+
+#ifdef GR_RESOLUTION_MAX
+#undef GR_RESOLUTION_MAX
+#endif
+#ifdef GR_RESOLUTION_MIN
+#undef GR_RESOLUTION_MIN
+#endif
+#define GR_RESOLUTION_MIN       GR_RESOLUTION_320x200
+#define GR_RESOLUTION_MAX       GR_RESOLUTION_1600x1200
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SST1VID_H__ */
Index: trunk/src/opengl/glide/sst1/init/vg96drvr.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/vg96drvr.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/vg96drvr.c	(revision 2885)
@@ -0,0 +1,192 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:27 $ 
+**
+*/
+
+#include <3dfx.h>
+#include <sst1vid.h>
+#include "init.h"
+#include "init96\init96.h"
+#include "fxinit.h"
+
+/* hack */
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gdebug.h>
+
+/* This is currently disabled, thus breaking rush, until we can get some
+ * sources from Aliance Semiconductor */
+#if 0
+static FxBool setVideo( FxU32                   hWnd,
+                        GrScreenResolution_t    sRes,
+                        GrScreenRefresh_t       vRefresh,
+                        InitColorFormat_t       cFormat,
+                        InitOriginLocation_t    yOrigin,
+                        int                     nColBuffers,
+                        int                     nAuxBuffers,
+                        int                     *xres,
+                        int                     *yres,
+                        int                     *fbStride,
+                        sst1VideoTimingStruct   *vidTimings) {
+    return init96SetVideo( hWnd, sRes, vRefresh, cFormat, yOrigin, 
+                           nColBuffers, nAuxBuffers,
+                           &context->info.regs,
+                           xres, yres, fbStride );
+}
+
+static void restoreVideo( void ) {
+    init96RestoreVideo( &context->info.regs );
+}
+
+static FxBool enableTransport( InitFIFOData *info ) {
+    return init96EnableTransport( info, &context->info.regs );
+}
+
+static void disableTransport( void ) {
+    init96DisableTransport();
+}
+
+static InitSwapType_t swapBuffers( FxU32 code ) {
+    if ( context && context->writeMethod )
+        init96Swap( code, &context->info.regs, context->writeMethod );
+    return INIT_SWAP_FLIP;
+} 
+
+static FxU32 status( void ) {
+  return *(context->info.regs.hwDep.VG96RegDesc.serialStatus);
+} 
+
+static FxBool busy(void) {
+  FxBool rv;
+
+  rv = (status() & 0x1) ? FXTRUE : FXFALSE;
+
+  return rv;
+} 
+
+static void idle( void ) {
+    init96Idle(context->writeMethod);
+}
+
+static void *getBufferPtr( InitBuffer_t buffer, int *strideBytes ) {
+    return init96GetBufferPtr( buffer, strideBytes );
+}
+
+static void renderBuffer( InitBuffer_t buffer ) {
+    init96RenderBuffer( buffer, context->writeMethod );
+    return;
+}
+
+static void origin( InitOriginLocation_t origin ) {
+    init96Origin( origin, context->writeMethod );
+    return;
+}
+
+static void ioCtl( FxU32 token, void *argument ) {
+    return;
+}
+
+static FxBool control( FxU32 code ) {
+    FxBool rv = FXFALSE;
+    GDBG_INFO((80, "vg96drvr: control: code = %d\n", code));
+    if (context) 
+        rv = init96Control( code, &context->info.regs);
+    return rv;
+}
+
+static FxBool wrapFIFO(InitFIFOData *fd) {
+    return init96WrapFIFO(&(context->info.regs), fd);
+}
+
+static void gamma( double gamma ) {
+}
+
+static void sliPciOwner( FxU32 *regbase, FxU32 owner ) {
+}
+
+static FxBool gammargb( double r, double g, double b ) {
+  return FXFALSE;
+}
+
+static FxBool gammatable( FxU32 nentries, FxU32 *r, FxU32 *g, FxU32 *b ) {
+  return FXFALSE;
+}
+
+static sst1VideoTimingStruct *findvidtiming( GrScreenResolution_t sRes, GrScreenRefresh_t vRefresh) {
+  return NULL;
+}
+
+void vg96DriverInit( InitContext *context ) {
+    context->setVideo         = setVideo;
+    context->restoreVideo     = restoreVideo;
+    context->enableTransport  = enableTransport;
+    context->disableTransport = disableTransport;
+    context->swapBuffers      = swapBuffers;
+    context->status           = status;
+    context->busy             = busy;
+    context->idle             = idle;
+    context->getBufferPtr     = getBufferPtr;
+    context->renderBuffer     = renderBuffer;
+    context->origin           = origin;
+    context->ioCtl            = ioCtl;
+    context->control          = control;
+    context->wrapFIFO         = wrapFIFO;
+
+    context->gamma            = gamma;
+    context->sliPciOwner      = sliPciOwner;
+
+    context->gammaRGB         = gammargb;
+    context->initGammaTable   = gammatable;
+    context->findVidTimingStruct = findvidtiming;
+} 
+#else
+/* I've got to stub this one to get the Voodoo Graphics glide to link */
+void vg96DriverInit( InitContext *context ) {
+    context->setVideo         = NULL;
+    context->restoreVideo     = NULL;
+    context->enableTransport  = NULL;
+    context->disableTransport = NULL;
+    context->swapBuffers      = NULL;
+    context->status           = NULL;
+    context->busy             = NULL;
+    context->idle             = NULL;
+    context->getBufferPtr     = NULL;
+    context->renderBuffer     = NULL;
+    context->origin           = NULL;
+    context->ioCtl            = NULL;
+    context->control          = NULL;
+    context->wrapFIFO         = NULL;
+
+    context->gamma            = NULL;
+    context->sliPciOwner      = NULL;
+
+    context->gammaRGB         = NULL;
+    context->initGammaTable   = NULL;
+    context->findVidTimingStruct = NULL; 
+
+}
+#endif
+
+
+
Index: trunk/src/opengl/glide/sst1/init/vgdrvr.c
===================================================================
--- trunk/src/opengl/glide/sst1/init/vgdrvr.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/init/vgdrvr.c	(revision 2885)
@@ -0,0 +1,201 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+**
+** $Revision: 1.1 $ 
+** $Date: 2000-02-25 00:31:27 $ 
+**
+*/
+
+#include <3dfx.h>
+#include <sst1init.h>
+#include "init.h"
+#include "fxinit.h"
+#include <sst1init.h>
+#include <sst.h>
+
+static FxBool FX_CALL setVideo( FxU32                   hWnd,
+                        GrScreenResolution_t    sRes,
+                        GrScreenRefresh_t       vRefresh,
+                        InitColorFormat_t       cFormat,
+                        InitOriginLocation_t    yOrigin,
+                        int                     nColBuffers,
+                        int                     nAuxBuffers,
+                        int                     *xres,
+                        int                     *yres,
+                        int                     *fbStride,
+                        sst1VideoTimingStruct   *vidTimings) {
+    FxBool rv;
+    static int _w[] = {320,320,400,512,640,640,640,640,800,960,856,512};
+    static int _h[] = {200,240,256,384,200,350,400,480,600,720,480,256};
+    
+    rv = sst1InitVideo( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr,
+                        sRes,
+                        vRefresh, 
+                        vidTimings );
+
+    if ( !rv ) goto BAIL;
+
+    if ( context->info.hwDep.vgInfo.sliDetect ) {
+        rv = sst1InitRegisters((FxU32*)context->info.hwDep.vgInfo.slaveBaseAddr);
+        if ( !rv ) goto BAIL;
+        rv = sst1InitVideo( (FxU32*)context->info.hwDep.vgInfo.slaveBaseAddr,
+                            sRes,
+                            vRefresh, 
+                            vidTimings );
+        if ( !rv ) goto BAIL;
+        rv = sst1InitSli( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr,
+                          (FxU32*)context->info.hwDep.vgInfo.slaveBaseAddr );
+        if ( !rv ) goto BAIL;
+    }
+
+    if(vidTimings) {
+        *xres = vidTimings->xDimension;
+        *yres = vidTimings->yDimension;
+    } else {
+        *xres = _w[sRes];
+        *yres = _h[sRes];
+    }
+    *fbStride = 1024; /* 1024 always */
+
+BAIL:
+    return rv;
+}
+
+static void FX_CALL restoreVideo( void ) {
+   sst1InitShutdown( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr );
+}
+
+static FxBool FX_CALL enableTransport( InitFIFOData *info ) {
+    FxBool rv = FXFALSE;
+    sst1DeviceInfoStruct sstInfo;
+
+    if ( info ) {
+        rv = sst1InitGetDeviceInfo( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr, 
+                                    &sstInfo );
+        info->hwDep.vgFIFOData.memFifoStatusLwm = sstInfo.memFifoStatusLwm;
+    }
+
+    sst1InitCachingOn();
+
+    return rv;
+}
+
+static void FX_CALL disableTransport( void ) {
+}
+
+static InitSwapType_t FX_CALL swapBuffers( FxU32 code ) {
+    return INIT_SWAP_FLIP;
+} 
+
+static FxU32 FX_CALL status( void ) {
+  return sst1InitReturnStatus((FxU32 *) context->info.hwDep.vgInfo.vgBaseAddr);
+} 
+
+static FxBool FX_CALL busy(void) {
+  FxU32 stat = status();
+  FxBool ret = (stat & SST_BUSY) ? FXTRUE : FXFALSE;
+  
+  return ret;
+} 
+
+static void FX_CALL idle( void ) {
+  sst1InitIdle((FxU32 *)context->info.hwDep.vgInfo.vgBaseAddr);
+}
+
+static void * FX_CALL getBufferPtr( InitBuffer_t buffer, int *strideBytes ) {
+    return 0;
+}
+
+static void FX_CALL renderBuffer( InitBuffer_t buffer ) {
+    return;
+}
+
+static void FX_CALL origin( InitOriginLocation_t origin ) {
+    return;
+}
+
+static void FX_CALL ioCtl( FxU32 token, void *argument ) {
+    return;
+}
+
+static FxBool FX_CALL control( FxU32 code ) {
+    switch ( code ) {
+    case INIT_CONTROL_DEACTIVATE:
+        sst1InitVgaPassCtrl( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr,
+                             FXTRUE );
+        break;
+    case INIT_CONTROL_ACTIVATE:
+        sst1InitVgaPassCtrl( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr,
+                             FXFALSE );
+        break;
+    }
+    return FXTRUE;
+}
+
+static FxBool FX_CALL wrapFIFO(InitFIFOData *fd) {
+    return FXTRUE;
+}
+
+static void FX_CALL gamma( double gamma ) {
+  sst1InitGamma((FxU32 *) context->info.hwDep.vgInfo.vgBaseAddr, gamma);
+}
+
+static void FX_CALL sliPciOwner( FxU32 *regbase, FxU32 owner ) {
+  sst1InitSliPciOwner(regbase, owner);
+}
+
+static FxBool FX_CALL gammargb( double r, double g, double b ) {
+  return sst1InitGammaRGB((FxU32 *) context->info.hwDep.vgInfo.vgBaseAddr, r, g, b);
+}
+
+static FxBool FX_CALL gammatable( FxU32 nentries, FxU32 *r, FxU32 *g, FxU32 *b ) {
+  return sst1InitGammaTable((FxU32 *) context->info.hwDep.vgInfo.vgBaseAddr, nentries, r, g, b);
+}
+
+static sst1VideoTimingStruct * FX_CALL findvidtiming( GrScreenResolution_t sRes, GrScreenRefresh_t vRefresh) {
+  return sst1InitFindVideoTimingStruct(sRes, vRefresh);
+}
+
+void vgDriverInit( InitContext *context ) {
+    context->setVideo         = setVideo;
+    context->restoreVideo     = restoreVideo;
+    context->enableTransport  = enableTransport;
+    context->disableTransport = disableTransport;
+    context->swapBuffers      = swapBuffers;
+    context->status           = status;
+    context->busy             = busy;
+    context->idle             = idle;
+    context->getBufferPtr     = getBufferPtr;
+    context->renderBuffer     = renderBuffer;
+    context->origin           = origin;
+    context->ioCtl            = ioCtl;
+    context->control          = control;
+    context->wrapFIFO         = wrapFIFO;
+
+
+    context->gamma            = gamma;
+    context->sliPciOwner      = sliPciOwner;
+
+    context->gammaRGB         = gammargb;
+    context->initGammaTable   = gammatable;
+    context->findVidTimingStruct = findvidtiming;
+
+}
+
Index: trunk/src/opengl/glide/sst1/initterm.cpp
===================================================================
--- trunk/src/opengl/glide/sst1/initterm.cpp	(revision 2885)
+++ trunk/src/opengl/glide/sst1/initterm.cpp	(revision 2885)
@@ -0,0 +1,113 @@
+/* $Id: initterm.cpp,v 1.1 2000-02-25 00:31:06 sandervl Exp $ */
+
+/*
+ * DLL entry point
+ *
+ * Copyright 1998 Sander van Leeuwen
+ * Copyright 1998 Peter Fitzsimmons
+ *
+ *
+ */
+
+/*-------------------------------------------------------------*/
+/* INITERM.C -- Source for a custom dynamic link library       */
+/*              initialization and termination (_DLL_InitTerm) */
+/*              function.                                      */
+/*                                                             */
+/* When called to perform initialization, this sample function */
+/* gets storage for an array of integers, and initializes its  */
+/* elements with random integers.  At termination time, it     */
+/* frees the array.  Substitute your own special processing.   */
+/*-------------------------------------------------------------*/
+
+
+/* Include files */
+#define  INCL_DOSMODULEMGR
+#define  INCL_DOSPROCESS
+#include <os2wrap.h>                   /* Odin32 OS/2 api wrappers         */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <odin.h>
+#include <win32type.h>
+#include <winconst.h>
+#include <odinlx.h>
+#include <misc.h>                      /* PLF Wed  98-03-18 23:18:15       */
+
+extern "C" {
+void CDECL _ctordtorInit( void );
+void CDECL _ctordtorTerm( void );
+
+ //Win32 resource table (produced by wrc)
+ extern DWORD _Resource_PEResTab;
+}
+
+BOOL WINAPI DllMain(HANDLE hInst, ULONG  ul_reason_for_call, LPVOID lpReserved);
+
+//******************************************************************************
+//******************************************************************************
+BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
+{
+   switch (fdwReason)
+   {
+   case DLL_PROCESS_ATTACH:
+   case DLL_THREAD_ATTACH:
+   case DLL_THREAD_DETACH:
+	return DllMain(hinstDLL, fdwReason, fImpLoad);
+
+   case DLL_PROCESS_DETACH:
+   	_ctordtorTerm();
+	DllMain(hinstDLL, fdwReason, fImpLoad);
+	return TRUE;
+   }
+   return FALSE;
+}
+/****************************************************************************/
+/* _DLL_InitTerm is the function that gets called by the operating system   */
+/* loader when it loads and frees this DLL for each process that accesses   */
+/* this DLL.  However, it only gets called the first time the DLL is loaded */
+/* and the last time it is freed for a particular process.  The system      */
+/* linkage convention MUST be used because the operating system loader is   */
+/* calling this function.                                                   */
+/****************************************************************************/
+unsigned long SYSTEM _DLL_InitTerm(unsigned long hModule, unsigned long
+                                   ulFlag)
+{
+   size_t i;
+   APIRET rc;
+
+   /*-------------------------------------------------------------------------*/
+   /* If ulFlag is zero then the DLL is being loaded so initialization should */
+   /* be performed.  If ulFlag is 1 then the DLL is being freed so            */
+   /* termination should be performed.                                        */
+   /*-------------------------------------------------------------------------*/
+
+   switch (ulFlag) {
+      case 0 :
+         _ctordtorInit();
+
+         CheckVersionFromHMOD(PE2LX_VERSION, hModule);/* PLF Wed  98-03-18 05:28:48*/
+
+         /*******************************************************************/
+         /* A DosExitList routine must be used to clean up if runtime calls */
+         /* are required and the runtime is dynamically linked.             */
+         /*******************************************************************/
+
+         if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE)
+                return 0UL;
+
+         break;
+
+      case 1 :
+         UnregisterLxDll(hModule);
+         break;
+
+      default  :
+         return 0UL;
+   }
+
+   /***********************************************************/
+   /* A non-zero value must be returned to indicate success.  */
+   /***********************************************************/
+   return 1UL;
+}
Index: trunk/src/opengl/glide/sst1/makefile
===================================================================
--- trunk/src/opengl/glide/sst1/makefile	(revision 2885)
+++ trunk/src/opengl/glide/sst1/makefile	(revision 2885)
@@ -0,0 +1,102 @@
+# $Id: makefile,v 1.1 2000-02-25 00:31:07 sandervl Exp $
+#
+# PD-Win32 API
+#
+#       Glide makefile
+#
+
+PDWIN32_INCLUDE = ..\..\..\..\include
+PDWIN32_LIB = ..\..\..\..\lib
+PDWIN32_BIN = ..\..\..\..\bin
+PDWIN32_TOOLS = ..\..\..\..\tools\bin
+
+TARGET = glide2x
+
+!include $(PDWIN32_INCLUDE)/pdwin32.mk
+
+CFLAGS = $(CFLAGS)  -I$(PDWIN32_INCLUDE)
+CXXFLAGS = $(CXXFLAGS)  -I$(PDWIN32_INCLUDE)
+
+OBJS =	initterm.obj \
+	glideres.obj \
+	..\swlibs\pcilib\pcilib.lib \
+	texus\texus.lib \
+	init\init.lib \
+        glide\glide.lib \
+ 
+all: ..\swlibs\pcilib\pcilib.lib init\init.lib texus\texus.lib glide\glide.lib $(TARGET).dll $(TARGET).lib
+
+..\swlibs\pcilib\pcilib.lib:
+    cd ..\swlibs\pcilib
+    $(MAKE_CMD)
+    cd ..\..\sst1
+
+init\init.lib:
+    cd init
+    $(MAKE_CMD)
+    cd ..
+
+glide\glide.lib:
+    cd glide
+    $(MAKE_CMD)
+    cd ..
+
+texus\texus.lib:
+    cd texus
+    $(MAKE_CMD)
+    cd ..
+
+$(TARGET).dll: $(OBJS) $(TARGET).def
+    $(LD) $(LDFLAGS) -Fm -Fe$@ $(OBJS) $(TARGET).def \
+          $(PDWIN32_LIB)/kernel32.lib \
+          $(PDWIN32_LIB)/odincrt.lib OS2386.LIB $(RTLLIB_O)
+    $(CP) $@ $(PDWIN32_BIN)\Glide\Voodoo1
+
+lib: $(TARGET).lib $(PDWIN32_LIB)\$(TARGET).lib
+
+$(PDWIN32_LIB)\$(TARGET).lib: $(TARGET).lib
+    $(CP) $** $@
+
+$(TARGET).lib: $(TARGET).def
+    $(IMPLIB) $(IMPLIBFLAGS) $@ $(TARGET).def
+    $(CP) $@ $(PDWIN32_LIB)
+
+RCFLAGS = $(RCFLAGS) -I..\swlibs\fxmisc -Iglide
+
+glideres.asm: glide\glide.rc
+    $(RC) $(RCFLAGS) -o glideres.asm glide\glide.rc
+
+initterm.obj: initterm.cpp
+
+dep:
+    $(DEPEND) -I$(PDWIN32_INCLUDE);$(PDWIN32_INCLUDE)\win \
+        *.c *.cpp *.h *.asm *.inc $(PDWIN32_INCLUDE)\*.h
+    cd ..\swlibs\pcilib
+    $(MAKE_CMD) NODEP=1 dep
+    cd ..\..\sst1\glide
+    $(MAKE_CMD) NODEP=1 dep
+    cd ..\init
+    $(MAKE_CMD) NODEP=1 dep
+    cd ..\texus
+    $(MAKE_CMD) NODEP=1 dep
+    cd ..
+
+!ifndef NODEP
+!include .depend
+!endif
+
+clean:
+    $(RM) *.obj *.pch
+    $(RM) *.map *.dll
+    $(RM) *.lib
+    $(RM) glideres.asm
+    cd ..\swlibs\pcilib
+    $(MAKE_CMD) clean
+    cd ..\..\sst1\glide
+    $(MAKE_CMD) clean
+    cd ..\init
+    $(MAKE_CMD) clean
+    cd ..\texus
+    $(MAKE_CMD) clean
+    cd ..
+
Index: trunk/src/opengl/glide/sst1/texus/.depend
===================================================================
--- trunk/src/opengl/glide/sst1/texus/.depend	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/.depend	(revision 2885)
@@ -0,0 +1,316 @@
+3df.obj: \
+       3df.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+clamp.obj: \
+       clamp.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+dequant.obj: \
+       dequant.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+diffuse.obj: \
+       diffuse.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+gldutil.obj: \
+       gldutil.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\glide\glide.h \
+       .\texus.h \
+       .\texusint.h
+mipmap.obj: \
+       mipmap.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+ncc.obj: \
+       ncc.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+nccnnet.obj: \
+       nccnnet.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+pal256.obj: \
+       pal256.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\memory.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+ppm.obj: \
+       ppm.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+quantize.obj: \
+       quantize.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+read.obj: \
+       read.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+resample.obj: \
+       resample.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+rgt.obj: \
+       rgt.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+texuslib.obj: \
+       texuslib.c \
+       k:\ibmcpp\INCLUDE\string.h \
+       ..\glide\glide.h \
+       k:\ibmcpp\INCLUDE\malloc.h \
+       .\texus.h \
+       .\texusint.h
+tga.obj: \
+       tga.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+util.obj: \
+       util.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+view.obj: \
+       view.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+write.obj: \
+       write.c \
+       k:\ibmcpp\INCLUDE\stdio.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\string.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       .\texusint.h
+texus.h: \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\stdio.h
+texusint.h: \
+       .\texus.h
+..\..\..\..\..\include\codepage.h: \
+       k:\toolkit\H\uconv.h
+..\..\..\..\..\include\comtype.h:
+..\..\..\..\..\include\cpuhlp.h:
+..\..\..\..\..\include\dcdata.h:
+..\..\..\..\..\include\exceptions.h: \
+       ..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\include\misc.h
+..\..\..\..\..\include\excpt.h:
+..\..\..\..\..\include\exitlist.h:
+..\..\..\..\..\include\HandleManager.h: \
+       ..\..\..\..\..\include\winos2def.h
+..\..\..\..\..\include\heap.h: \
+       ..\..\..\..\..\include\win\winbase.h
+..\..\..\..\..\include\heapcode.h: \
+       ..\..\..\..\..\include\heapshared.h
+..\..\..\..\..\include\heapshared.h: \
+       k:\ibmcpp\INCLUDE\stddef.h \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\umalloc.h
+..\..\..\..\..\include\heapstring.h: \
+       ..\..\..\..\..\include\odin.h
+..\..\..\..\..\include\midimapr.h:
+..\..\..\..\..\include\misc.h: \
+       ..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\include\versionos2.h \
+       ..\..\..\..\..\include\unicode.h
+..\..\..\..\..\include\nameid.h:
+..\..\..\..\..\include\odin.h: \
+       k:\ibmcpp\INCLUDE\builtin.h
+..\..\..\..\..\include\odinlx.h:
+..\..\..\..\..\include\odinrsrc.h:
+..\..\..\..\..\include\odinwrap.h: \
+       ..\..\..\..\..\include\os2sel.h \
+       k:\ibmcpp\INCLUDE\malloc.h
+..\..\..\..\..\include\os2mewrap.h: \
+       k:\toolkit\H\os2me.h
+..\..\..\..\..\include\os2newapi.h:
+..\..\..\..\..\include\os2sel.h:
+..\..\..\..\..\include\OS2WIN.H: \
+       ..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\include\odin.h \
+       ..\..\..\..\..\include\win\windef.h \
+       ..\..\..\..\..\include\win\winbase.h \
+       ..\..\..\..\..\include\win\wingdi.h \
+       ..\..\..\..\..\include\win\winuser.h \
+       ..\..\..\..\..\include\win\winerror.h \
+       ..\..\..\..\..\include\win\commdlg.h \
+       ..\..\..\..\..\include\win\ddeml.h \
+       ..\..\..\..\..\include\win\mmsystem.h \
+       ..\..\..\..\..\include\os2sel.h \
+       ..\..\..\..\..\include\misc.h
+..\..\..\..\..\include\os2wrap.h: \
+       k:\toolkit\H\os2.h \
+       ..\..\..\..\..\include\os2sel.h \
+       ..\..\..\..\..\include\os2newapi.h
+..\..\..\..\..\include\pefile.h: \
+       k:\toolkit\H\os2.h \
+       ..\..\..\..\..\include\win32type.h \
+       ..\..\..\..\..\include\win\peexe.h \
+       k:\ibmcpp\INCLUDE\stdlib.h
+..\..\..\..\..\include\pmmenu.h:
+..\..\..\..\..\include\spy.h:
+..\..\..\..\..\include\unicode.h: \
+       ..\..\..\..\..\include\uniconv.h
+..\..\..\..\..\include\uniconv.h: \
+       k:\ibmcpp\INCLUDE\stddef.h \
+       k:\ibmcpp\INCLUDE\time.h
+..\..\..\..\..\include\versionos2.h:
+..\..\..\..\..\include\virtual.h:
+..\..\..\..\..\include\vmutex.h:
+..\..\..\..\..\include\win32type.h: \
+       ..\..\..\..\..\include\odin.h
+..\..\..\..\..\include\win32util.h:
+..\..\..\..\..\include\win32wnd.h:
+..\..\..\..\..\include\winaccel.h:
+..\..\..\..\..\include\winconst.h:
+..\..\..\..\..\include\wincursor.h:
+..\..\..\..\..\include\windllbase.h: \
+       ..\..\..\..\..\include\winimagebase.h \
+       ..\..\..\..\..\include\odinlx.h
+..\..\..\..\..\include\windlllx.h: \
+       ..\..\..\..\..\include\windllbase.h \
+       ..\..\..\..\..\include\winimagelx.h
+..\..\..\..\..\include\windllpe2lx.h: \
+       ..\..\..\..\..\include\windllbase.h \
+       ..\..\..\..\..\include\winimagepe2lx.h
+..\..\..\..\..\include\windllpeldr.h: \
+       ..\..\..\..\..\include\windllbase.h \
+       ..\..\..\..\..\include\winimagepeldr.h
+..\..\..\..\..\include\wineuni.h:
+..\..\..\..\..\include\winexebase.h: \
+       ..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\include\winexelx.h: \
+       ..\..\..\..\..\include\winexebase.h \
+       ..\..\..\..\..\include\winimagelx.h \
+       ..\..\..\..\..\include\odinlx.h
+..\..\..\..\..\include\winexepe2lx.h: \
+       ..\..\..\..\..\include\winexebase.h \
+       ..\..\..\..\..\include\winimagepe2lx.h
+..\..\..\..\..\include\winexepeldr.h: \
+       ..\..\..\..\..\include\winexebase.h \
+       ..\..\..\..\..\include\winimagepeldr.h
+..\..\..\..\..\include\winfakepeldr.h: \
+       ..\..\..\..\..\include\winimagepeldr.h
+..\..\..\..\..\include\winicon.h:
+..\..\..\..\..\include\winimagebase.h: \
+       ..\..\..\..\..\include\win\peexe.h
+..\..\..\..\..\include\winimagelx.h: \
+       ..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\include\winimagepe2lx.h: \
+       ..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\include\winimagepeldr.h: \
+       ..\..\..\..\..\include\winimagebase.h
+..\..\..\..\..\include\winkeyboard.h:
+..\..\..\..\..\include\winmenu.h:
+..\..\..\..\..\include\winos2def.h:
+..\..\..\..\..\include\winres.h:
+..\..\..\..\..\include\wprocess.h: \
+       ..\..\..\..\..\include\win\winprocess.h \
+       ..\..\..\..\..\include\winconst.h \
+       ..\..\..\..\..\include\win\thread.h
+..\incsrc\ncc.h:
+..\incsrc\sst.h: \
+       ..\incsrc\ncc.h \
+       ..\..\swlibs\fxmisc\fx64.h
+..\init\initvg\gdebug.h: \
+       k:\ibmcpp\INCLUDE\stdarg.h \
+       ..\..\swlibs\fxmisc\3dfx.h
+..\init\initvg\rcver.h:
+..\init\initvg\sst1init.h: \
+       ..\init\sst1vid.h \
+       ..\..\swlibs\pcilib\fxpci.h \
+       k:\ibmcpp\INCLUDE\stdio.h
+..\glide\fxglide.h: \
+       k:\ibmcpp\INCLUDE\stdlib.h \
+       k:\ibmcpp\INCLUDE\math.h \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\init\initvg\sst1init.h \
+       ..\incsrc\sst.h \
+       ..\init\initvg\gdebug.h \
+       ..\init\init.h \
+       k:\ibmcpp\INCLUDE\assert.h
+..\glide\fxinline.h:
+..\glide\glide.h: \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\glide\glidesys.h \
+       ..\init\sst1vid.h \
+       ..\glide\glideutl.h
+..\glide\glidesys.h:
+..\glide\glideutl.h:
+..\glide\gsstdef.h: \
+       ..\incsrc\sst.h
+..\glide\gump.h:
+..\glide\rcver.h:
+..\init\fxinit.h: \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\init\init.h \
+       ..\..\swlibs\fxmisc\fxdll.h
+..\init\init.h: \
+       ..\..\swlibs\fxmisc\3dfx.h \
+       ..\init\sst1vid.h \
+       ..\init\initvg\sst1init.h
+..\init\sst1vid.h:
+..\..\swlibs\pcilib\fxlinux.h:
+..\..\swlibs\pcilib\fxos2.h:
+..\..\swlibs\pcilib\fxpci.h:
+..\..\swlibs\pcilib\fxphrlap.h:
+..\..\swlibs\pcilib\fxw32.h: \
+       ..\..\..\..\..\include\win\windows.h \
+       ..\..\swlibs\pcilib\pcilib.h
+..\..\swlibs\pcilib\pcilib.h:
+..\..\swlibs\pcilib\sst1_pci.h: \
+       ..\..\swlibs\pcilib\fxpci.h
Index: trunk/src/opengl/glide/sst1/texus/3df.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/3df.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/3df.c	(revision 2885)
@@ -0,0 +1,235 @@
+/*
+ * THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+ * PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+ * TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+ * INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+ * DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+ * THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+ * FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+ *
+ * USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ * RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+ * TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ * AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ * SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+/*************************************** 3df files ****************************/
+/* Read word, msb first */
+static FxBool 
+_txRead16 (FILE *stream, FxU16* data)
+{
+    FxU8 byte[2];
+
+    if (fread (byte, 2, 1, stream) != 1) return FXFALSE;
+    *data = (((FxU16) byte[0]) << 8) | ((FxU16) byte[1]);
+    return FXTRUE;
+}
+
+/* Read long word, msb first */
+static FxBool 
+_txRead32 (FILE *stream, FxU32* data)
+{
+    FxU8 byte[4];
+
+    if (fread (byte, 4, 1, stream) != 1) return FXFALSE;
+
+    *data = (((FxU32) byte[0]) << 24) |
+            (((FxU32) byte[1]) << 16) |
+            (((FxU32) byte[2]) <<  8) |
+             ((FxU32) byte[3]);
+
+    return FXTRUE;
+}
+
+
+/* Read NCC table */
+static FxBool 
+_txRead3DFNCCTable (FILE* stream, FxI32* ncc_table)
+{
+    FxU32 i;
+    FxI16 data;
+
+    /* read Y */
+    for (i = 0; i < 16; i ++) {
+        if (FXFALSE == _txRead16 (stream, (FxU16 *)&data)) return FXFALSE;
+        ncc_table[i] = (FxU8) data;
+    }
+    /* read A */
+    for (i = 0; i < 4; i++) {
+        if (!_txRead16 (stream, (FxU16 *)&data)) return FXFALSE;
+        ncc_table[16 + 3 * i + 0] = (FxI32) data;
+        if (!_txRead16 (stream, (FxU16 *)&data)) return FXFALSE;
+        ncc_table[16 + 3 * i + 1] = (FxI32) data;
+        if (!_txRead16 (stream, (FxU16 *)&data)) return FXFALSE;
+        ncc_table[16 + 3 * i + 2] = (FxI32) data;
+    }
+
+    /* read B */
+    for (i = 0; i < 4; i++) {
+        if (!_txRead16 (stream, (FxU16 *)&data)) return FXFALSE;
+        ncc_table[28 + 3 * i + 0] = (FxI32) data;
+        if (!_txRead16 (stream, (FxU16 *)&data)) return FXFALSE;
+        ncc_table[28 + 3 * i + 1] = (FxI32) data;
+        if (!_txRead16 (stream, (FxU16 *)&data)) return FXFALSE;
+        ncc_table[28 + 3 * i + 2] = (FxI32) data;
+    }
+
+    return FXTRUE;
+}
+
+static FxBool 
+_txRead3DFPalTable (FILE* stream, FxI32* pal)
+{
+    FxU32 i;
+
+    /* read Y */
+    for (i = 0; i < 256; i ++) {
+        if (FXFALSE == _txRead32 (stream, (FxU32 *)&pal[i])) return FXFALSE;
+    }
+    return FXTRUE;
+}
+
+/* Read 3df header */
+FxBool
+_txRead3DFHeader(FILE* stream, FxU32 cookie, TxMip *txMip)
+{
+    int         c, i;
+    char        version[6];
+    char        color_format[10];
+    int         lod_min, lod_max;
+    int         aspect_width, aspect_height;
+    int         w, h;
+
+    /* magic cookie starts with 3df v%6...., of which we've eaten 3d */
+    // printf("3df file header\n");
+    if (fscanf (stream, "f v%6s", version) != 1) return FXFALSE;
+
+    /* 
+     * skip comments
+     */
+    while (((c = getc (stream)) != EOF) && (c == '#')) {
+        while (((c = getc (stream)) != EOF) && (c != '\n'));
+        if (c == EOF) return FXFALSE;
+    }
+    if (c == EOF) return FXFALSE;
+    ungetc (c, stream);
+
+    /* color format, lod range, aspect ratio */
+    if (5 != fscanf (stream, "%10s lod range: %i %i aspect ratio: %i %i",
+        color_format, &lod_min, &lod_max, &aspect_width, &aspect_height))
+                return FXFALSE;
+
+    // printf("%s %d %d (lods) %d %d (aspect)\n", color_format, lod_min, lod_max, aspect_width, aspect_height);
+
+    /* eat final nl */
+    if (((c = getc (stream)) == EOF) && (c != '\n'))
+        return FXFALSE;
+
+    /* make sure null terminated */
+    color_format[9] = 0;
+
+    /* lookup name */
+    for (i = 0; i <= GR_TEXFMT_ARGB_8888; i++)
+        if (strcmp (Format_Name[i], color_format) == 0) break;
+    if (i > GR_TEXFMT_ARGB_8888) return FXFALSE;
+    txMip->format = i;
+
+    /* Validate lod */
+    if ((lod_max & (lod_max-1)) || (lod_min & (lod_min-1))) return FXFALSE;
+    if ((lod_max > 256) || (lod_max < 1)) return FXFALSE;
+    if ((lod_min > 256) || (lod_min < 1)) return FXFALSE;
+    if (lod_min > lod_max) return FXFALSE;
+
+    /* validate aspect ratio */
+    w = h = lod_max;
+    switch ((aspect_width << 4) | (aspect_height)) {
+        case    0x81:   h = h/8; break;
+        case    0x41:   h = h/4; break;
+        case    0x21:   h = h/2; break;
+        case    0x11:   h = h/1; break;
+        case    0x12:   w = w/2; break;
+        case    0x14:   w = w/4; break;
+        case    0x18:   w = w/8; break;
+        default:                return FXFALSE;
+    }
+
+    txMip->width  = w;
+    txMip->height = h;
+    txMip->size   = w * h;
+
+    for (txMip->depth=1; lod_max > lod_min; lod_max >>= 1) {
+        // printf("w = %d, h = %d, lod_max = %d\n", w, h, lod_max);
+        txMip->depth++;
+        if (w > 1) w >>= 1;
+        if (h > 1) h >>= 1;
+        txMip->size += (w * h);
+    }
+    txMip->size *= GR_TEXFMT_SIZE(txMip->format);
+
+    // printf("3df file: %dx%dx%d:%d\n", txMip->width, txMip->height, txMip->depth, txMip->size);
+    return FXTRUE;
+}
+
+FxBool
+_txRead3DFData( FILE *stream, TxMip *txMip)
+{
+    int i, npixels;
+
+    // printf("3df file data\n");
+    /* First read NCC tables */
+    if ((txMip->format == GR_TEXFMT_YIQ_422) ||
+        (txMip->format == GR_TEXFMT_AYIQ_8422)) {
+        if (!_txRead3DFNCCTable (stream, (FxI32 *)txMip->pal)) {
+                txError("Bad Ncc table\n");
+                return FXFALSE;
+        }
+    }
+
+    if ((txMip->format == GR_TEXFMT_P_8) ||
+        (txMip->format == GR_TEXFMT_AP_88)) {
+        if (!_txRead3DFPalTable (stream, (FxI32*)txMip->pal)) {
+                txError("Bad Palette table\n");
+                return FXFALSE;
+        }
+    }
+
+    /* read mipmap image data */
+    if (txMip->format < GR_TEXFMT_16BIT) {
+        npixels = txMip->size;
+
+        if ((FxU32) npixels != fread (txMip->data[0], 1, npixels, stream)) {
+                txError("Bad 8 bit data");
+                return FXFALSE;
+        }
+    }
+    else if (txMip->format < GR_TEXFMT_32BIT) {
+        FxU16* data = (FxU16 *) txMip->data[0];
+        npixels = txMip->size >> 1;
+
+        for (i = 0; i < npixels; i++, data++)
+                if (FXFALSE == _txRead16 (stream, data)) {
+                        txError("Bad 16 bit data");
+                        return FXFALSE;
+                }
+    }
+    else {
+        FxU32* data = (FxU32*) txMip->data[0];
+        npixels = txMip->size >> 2;
+
+        for (i = 0; i < npixels; i ++, data++)
+                if (FXFALSE == _txRead32 (stream, data)) {
+                        txError("Bad 32 bit data");
+                        return FXFALSE;
+                }
+    }
+    return FXTRUE;
+}
Index: trunk/src/opengl/glide/sst1/texus/clamp.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/clamp.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/clamp.c	(revision 2885)
@@ -0,0 +1,105 @@
+
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:36 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+static void _txImgClamp( FxU32 *out, int ox, int oy,
+                         const FxU32 *in, int ix, int iy )
+{
+  int x, y;
+
+  if( txVerbose )
+    {
+      printf( "clamping from %dx%d to %dx%d\n", 
+              ix, iy, ox, oy );
+    }
+
+  for( y = 0; y < oy; y++ )
+    {
+      for( x = 0; x < ox; x++ )
+        {
+          out[y*ox+x] = in[ ( ( y < iy  )? y : ( iy - 1 ) ) * ix + ( ( x < ix ) ? x : ( ix - 1 ) ) ];
+        }
+    }
+}
+
+void txMipClamp( TxMip *dstMip, TxMip *srcMip )
+{
+  int i, sw, sh, dw, dh;
+
+  if( dstMip->format != srcMip->format )
+    {
+      txPanic( "Image formats must be the same in txMipClamp." );
+    }
+
+  if( dstMip->format != GR_TEXFMT_ARGB_8888 )
+    {
+      txPanic( "txMipClamp only works on GR_TEXFMT_ARGB_8888 images." );
+    }
+
+  if( ( dstMip->width == srcMip->width ) && ( dstMip->height == srcMip->height ) &&
+      ( dstMip->data[0] == srcMip->data[0] ) )
+    {
+      if( txVerbose )
+        {
+          printf("No Clamping necessary.\n");
+        }
+      return;
+    }
+
+  if ((srcMip->data[0] == NULL) || (dstMip->data[0] == NULL))
+    txPanic("txImageClamp: Null buffer\n");
+  
+  sw = srcMip->width;
+  sh = srcMip->height;
+  dw = dstMip->width;
+  dh = dstMip->height;
+
+  for( i = 0; i < srcMip->depth; i++ ) 
+    {
+      if( !dstMip->data[i] )
+        txPanic("txImageResize: no miplevel present\n");
+      _txImgClamp( dstMip->data[i], dw, dh,
+                   srcMip->data[i], sw, sh );
+      if( txVerbose )
+        {
+          printf(" %dx%d", sw, sh); fflush(stdout);
+        }
+
+      if (sw > 1) sw >>= 1;
+      if (sh > 1) sh >>= 1;
+      if (dw > 1) dw >>= 1;
+      if (dh > 1) dh >>= 1;
+    }
+  if( txVerbose )
+    {
+      printf(".\n");
+    }
+}
+                 
Index: trunk/src/opengl/glide/sst1/texus/dequant.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/dequant.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/dequant.c	(revision 2885)
@@ -0,0 +1,391 @@
+
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:37 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+/* 
+ * Pn_8 = convert n bits (n <= 6) to 8 bits by replicating the msb's of input
+ * into the lsb's of the output.
+ */
+static  FxU8    P1_8[] = {0x00,0xff};
+static  FxU8    P2_8[] = {0x00,0x55,0xaa,0xff};
+static  FxU8    P3_8[] = {0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff};
+static  FxU8    P4_8[] = {0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,
+                                          0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff};
+static  FxU8    P5_8[] = {0x00,0x08,0x10,0x18,0x21,0x29,0x31,0x39,
+                                          0x42,0x4a,0x52,0x5a,0x63,0x6b,0x73,0x7b,
+                                          0x84,0x8c,0x94,0x9c,0xa5,0xad,0xb5,0xbd,
+                                          0xc6,0xce,0xd6,0xde,0xe7,0xef,0xf7,0xff};
+static  FxU8    P6_8[] = {0x00,0x04,0x08,0x0c,0x10,0x14,0x18,0x1c,
+                                          0x20,0x24,0x28,0x2c,0x30,0x34,0x38,0x3c,
+                                          0x41,0x45,0x49,0x4d,0x51,0x55,0x59,0x5d,
+                                          0x61,0x65,0x69,0x6d,0x71,0x75,0x79,0x7d,
+                                          0x82,0x86,0x8a,0x8e,0x92,0x96,0x9a,0x9e,
+                                          0xa2,0xa6,0xaa,0xae,0xb2,0xb6,0xba,0xbe,
+                                          0xc3,0xc7,0xcb,0xcf,0xd3,0xd7,0xdb,0xdf,
+                                          0xe3,0xe7,0xeb,0xef,0xf3,0xf7,0xfb,0xff};
+static FxU32
+_txPixRgb332to8888 (FxU8 c332)
+{
+    FxU32       a, r, g, b;
+    a = 0xff;
+    r = P3_8[(c332>>5)&7];
+    g = P3_8[(c332>>2)&7];
+    b = P2_8[(c332   )&3];
+    return (a << 24) | (r << 16) | (g << 8) | b;
+}
+
+/* YIQ treated at the image level */
+
+static FxU32
+_txPixA8to8888 (FxU8 a8)
+{
+    FxU32       p = a8;
+
+    return (p << 24) | (0xffffff);
+}
+
+static FxU32
+_txPixI8to8888 (FxU8 i8)
+{
+    FxU32       p = i8;
+
+    return (0xff << 24) | (p << 16) | (p << 8) | p;
+}
+
+static FxU32
+_txPixAi44to8888 (FxU8 c44)
+{
+    FxU32       a, i;
+
+    a = P4_8[(c44 & 0xF0) >> 4];
+    i = P4_8[(c44 & 0x0F)     ];
+
+    return (a << 24) | (i << 16) | (i << 8) | i;
+}
+
+/* P8 treated at the image level */
+
+/* 16 bit pixels */
+static FxU32 
+_txPixArgb8332to8888(FxU16 c8332)
+{
+    FxU32       a, r, g, b;
+    a =      (c8332 >>  8);      
+    r = P3_8[(c8332 >>  5) & 0x7];
+    g = P3_8[(c8332 >>  2) & 0x7];
+    b = P2_8[(c8332      ) & 0x3];
+    return (a << 24) | (r << 16) | (g << 8) | b;
+}
+
+/* AYIQ8422 treated at image level */
+
+static FxU32
+_txPixRgb565to8888 (FxU16 c565)
+{
+    FxU32       a, r, g, b;
+    a = 0xFF;
+    r = P5_8[(c565 >> 11)       ];
+    g = P6_8[(c565 >>  5) & 0x3f];
+    b = P5_8[(c565      ) & 0x1f];
+    return (a << 24) | (r << 16) | (g << 8) | b;
+}
+
+static FxU32
+_txPixArgb1555to8888 (FxU16 c1555)
+{
+    FxU32       a, r, g, b;
+    a = P1_8[(c1555 >> 15)       ];
+    r = P5_8[(c1555 >> 10) & 0x1f];
+    g = P5_8[(c1555 >>  5) & 0x1f];
+    b = P5_8[(c1555      ) & 0x1f];
+    return (a << 24) | (r << 16) | (g << 8) | b;
+}
+
+static FxU32
+_txPixRgba4444to8888 (FxU16 c4444)
+{
+    FxU32       a, r, g, b;
+    a = P4_8[(c4444 >> 12) & 0xf];
+    r = P4_8[(c4444 >>  8) & 0xf];
+    g = P4_8[(c4444 >>  4) & 0xf];
+    b = P4_8[(c4444      ) & 0xf];
+    return (a << 24) | (r << 16) | (g << 8) | b;
+}
+
+static FxU32
+_txPixAi88to8888(FxU16 c88)
+{
+    FxU32       a, r, g, b;
+    a = c88 >> 8;
+    r = g = b = (c88 & 0xff);
+    return (a << 24) | (r << 16) | (g << 8) | b;
+}
+
+/******************************************************************************/
+static void
+_txImgDequantizeRGB332(FxU32 *out, FxU8 *in, int w, int h)
+{
+    int         n = w * h;
+
+    out += n;
+    in  += n;
+    while (n--) *--out = _txPixRgb332to8888(*--in);
+}
+
+static void
+_txImgDequantizeYIQ422(FxU32 *out, FxU8 *in, int w, int h, const long *yabTable)
+{
+    int                         n = w * h;
+    FxU32                       pal[256];
+
+    txYABtoPal256((long *)pal, (long *)yabTable);
+    out += n;
+    in  += n;
+    while (n--) *--out = pal[*--in] | 0xff000000;
+}
+
+static void
+_txImgDequantizeA8(FxU32 *out, FxU8 *in, int w, int h)
+{
+    int         n = w * h;
+
+    out += n;
+    in  += n;
+    while (n--) *--out = _txPixA8to8888(*--in);
+}
+
+static void
+_txImgDequantizeI8(FxU32 *out, FxU8 *in, int w, int h)
+{
+    int         n = w * h;
+
+    out += n;
+    in  += n;
+    while (n--) *--out = _txPixI8to8888(*--in);
+}
+
+static void
+_txImgDequantizeAI44(FxU32 *out, FxU8 *in, int w, int h)
+{
+    int         n = w * h;
+
+    out += n;
+    in  += n;
+    while (n--) *--out = _txPixAi44to8888(*--in);
+}
+
+static void
+_txImgDequantizeP8(FxU32 *out, FxU8 *in, int w, int h, const FxU32 *pal)
+{
+    int         n = w * h;
+
+    out += n;
+    in  += n;
+    while (n--) *--out = pal[*--in] | 0xff000000;
+}
+
+
+static void
+_txImgDequantizeARGB8332(FxU32 *out, FxU16 *in, int w, int h)
+{
+    int         n = w * h;
+
+    out += n;
+    in  += n;
+    while (n--) *--out = _txPixArgb8332to8888 (*--in);
+}
+
+static void
+_txImgDequantizeAYIQ8422(FxU32 *out, FxU16 *in, int w, int h, const long *yab)
+{
+    int         n = w * h;
+    long        pal[256];
+
+    txYABtoPal256(pal, yab);
+    out += n;
+    in  += n;
+    while (n--) {
+        in--; 
+        *--out = (pal[(*in) & 0xff] & 0x00ffffff) | ((*in & 0xFF00) << 16);
+    }
+}
+
+static void
+_txImgDequantizeRGB565(FxU32 *out, FxU16 *in, int w, int h)
+{
+    int         n = w * h;
+
+    out += n;
+    in  += n;
+    while (n--) *--out = _txPixRgb565to8888(*--in);
+}
+
+static void
+_txImgDequantizeARGB1555(FxU32 *out, FxU16 *in, int w, int h)
+{
+    int         n = w * h;
+
+    out += n;
+    in  += n;
+    while (n--) *--out = _txPixArgb1555to8888 (*--in);
+}
+
+static void
+_txImgDequantizeARGB4444(FxU32 *out, FxU16 *in, int w, int h)
+{
+    int         n = w * h;
+
+    out += n;
+    in  += n;
+    while (n--) *--out = _txPixRgba4444to8888 (*--in);
+}
+
+static void
+_txImgDequantizeAI88(FxU32 *out, FxU16 *in, int w, int h)
+{
+    int         n = w * h;
+
+    out += n;
+    in  += n;
+    while (n--) *--out = _txPixAi88to8888(*--in);
+}
+
+
+static void
+_txImgDequantizeAP88(FxU32 *out, FxU16 *in, int w, int h, const FxU32 *pal)
+{
+    int         n = w * h;
+
+    out += n;
+    in  += n;
+
+    while (n--) {
+        in--;
+        *--out = (pal[(*in) & 0xff] & 0x00ffffff) | ((*in & 0xFF00) << 16);
+    }
+}
+
+
+static void
+_txImgDequantizeARGB8888(FxU32 *out, FxU32 *in, int w, int h)
+{
+    int         n = w * h;
+
+    out += n;
+    in  += n;
+
+    while (n--) *--out = *--in; 
+}
+
+static void
+_txImgDequantizeRGB888(FxU32 *out, FxU32 *in_, int w, int h)
+{
+    int         n = w * h;
+    int i;
+    FxU8 *in = ( FxU8 * )in_;
+
+    for( i = 0; i < n; i++ )
+      {
+        out[i] = 
+          ( ( ( FxU32 )0xff ) << 24 ) | 
+          ( ( ( FxU32 )in[i*3] )<< 16 ) |
+          ( ( ( FxU32 )in[i*3+1] )<< 8 ) |
+          ( ( ( FxU32 )in[i*3+2] ) );
+      }
+}
+
+void    
+txMipDequantize(TxMip *txMip, TxMip *pxMip)
+{
+    /* Walk through all mipmap levels, and convert to ARGB8888 format */
+    int         i, w, h;
+
+    if( txVerbose )
+      {
+        printf("Dequant: (from %s) ..", Format_Name[pxMip->format]);
+      }
+    w = pxMip->width;
+    h = pxMip->height;
+    for (i=0; i< txMip->depth; i++) {
+        void    *src, *dst;
+
+        src = pxMip->data[i];
+        dst = txMip->data[i];
+
+        if( txVerbose )
+          {
+            printf(" %dx%d", w, h); fflush(stdout);
+          }
+            
+        switch(pxMip->format) {
+        case GR_TEXFMT_RGB_332:         _txImgDequantizeRGB332(dst, src, w, h);         
+                                                                break;
+        case GR_TEXFMT_YIQ_422:         _txImgDequantizeYIQ422(dst, src, w, h, 
+                                                                        (long *)pxMip->pal); break;
+        case GR_TEXFMT_A_8:                     _txImgDequantizeA8(dst, src, w, h);             
+                                                                break;
+        case GR_TEXFMT_I_8:                     _txImgDequantizeI8(dst, src, w, h);             
+                                                                break;
+        case GR_TEXFMT_AI_44:           _txImgDequantizeAI44(dst, src, w, h);           
+                                                                break;
+        case GR_TEXFMT_P_8:                     _txImgDequantizeP8(dst, src, w, h, 
+                                                                        pxMip->pal); break;
+
+        case GR_TEXFMT_ARGB_8332:       _txImgDequantizeARGB8332(dst, src, w, h);       
+                                                                break;
+        case GR_TEXFMT_AYIQ_8422:       _txImgDequantizeAYIQ8422(dst, src, w, h, 
+                                                                        (long *)pxMip->pal); break;
+        case GR_TEXFMT_RGB_565:         _txImgDequantizeRGB565(dst, src, w, h); 
+                                                                break;
+        case GR_TEXFMT_ARGB_1555:       _txImgDequantizeARGB1555(dst, src, w, h);       
+                                                                break;
+        case GR_TEXFMT_ARGB_4444:       _txImgDequantizeARGB4444(dst, src, w, h);       
+                                                                break;
+        case GR_TEXFMT_AI_88:           _txImgDequantizeAI88(dst, src, w, h);           
+                                                                break;
+        case GR_TEXFMT_AP_88:           _txImgDequantizeAP88(dst, src, w, h, 
+                                                                        pxMip->pal); break;
+        case GR_TEXFMT_ARGB_8888:       _txImgDequantizeARGB8888(dst, src, w, h);       
+                                                                break;
+        case GR_TEXFMT_RGB_888:         _txImgDequantizeRGB888(dst, src, w, h);       
+                                                                break;
+
+        default:                                                                                                        
+                                                                break;
+        }
+
+        if (w > 1) w >>= 1;
+        if (h > 1) h >>= 1;
+    }
+    if( txVerbose )
+      {
+        printf(".\n"); fflush(stdout);
+      }
+}
Index: trunk/src/opengl/glide/sst1/texus/diffuse.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/diffuse.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/diffuse.c	(revision 2885)
@@ -0,0 +1,300 @@
+
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:37 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+// Error diffusion is implemented here.
+
+static int      ErrR[MAX_TEXWIDTH], ErrG[MAX_TEXWIDTH], ErrB[MAX_TEXWIDTH];
+
+#if FAST_DIFFUSION
+int     nsorted;
+FxU32   sortR[256], sortG[256], sortB[256];
+FxU8    bestR[256], bestG[256], bestB[256];
+
+static int 
+_txAscendingR(const void *a, const void *b)
+{
+    return ((*(FxI32 *)a) & 0x00FF0000) - ((*(FxI32 *)b) & 0x00FF0000);
+}
+
+
+static int 
+_txAscendingG(const void *a, const void *b)
+{
+    return ((*(FxI32 *)a) & 0x0000ff00) - ((*(FxI32 *)b) & 0x0000ff00);
+}
+
+
+static int 
+_txAscendingB(const void *a, const void *b)
+{
+    return ((*(FxI32 *)a) & 0x000000ff) - ((*(FxI32 *)b) & 0x000000ff);
+}
+
+static void
+_txMakeRange(const FxU32 *palette, int ncolors)
+{
+    int i, j, mindist, minpos, d;
+    FxU32 *pal;
+
+
+    for (i=0; i<ncolors; i++) {
+        sortR[i] = (palette[i] & 0x00ffffff) | (i<<24);
+        sortG[i] = (palette[i] & 0x00ffffff) | (i<<24);
+        sortB[i] = (palette[i] & 0x00ffffff) | (i<<24);
+    }
+
+    qsort(sortR, ncolors, sizeof(FxU32), _txAscendingR);
+    qsort(sortG, ncolors, sizeof(FxU32), _txAscendingG);
+    qsort(sortB, ncolors, sizeof(FxU32), _txAscendingB);
+    nsorted = ncolors;
+
+#if 0
+    for (i=0; i<ncolors; i++) 
+        printf("[%3d] = R%.08x G%.08x B%.08x\n", 
+            i, sortR[i], sortG[i], sortB[i]);
+#endif
+
+ 
+    for (i=0; i<256; i++) {
+
+        /* Find index of best matching Red component given r=i */
+        pal = sortR;
+        minpos  = mindist = 0x7fffffff;
+        for (j=0; j < ncolors; j++) {
+            d = DISTANCE(i, 0, 0, (pal[j]>>16) & 0xff, 0, 0);
+            if (d < mindist) { mindist = d; minpos  = j; }
+        }
+        bestR[i] = minpos;
+
+
+        /* Find index of best matching Grn component given g=i */
+        pal = sortG;
+        minpos  = mindist = 0x7fffffff;
+        for (j=0; j < ncolors; j++) {
+            d = DISTANCE(0, i, 0, 0, (pal[j]>>8) & 0xff, 0);
+            if (d < mindist) { mindist = d; minpos  = j; }
+        }
+        bestG[i] = minpos;
+
+
+        /* Find index of best matching Blu component given b=i */
+        pal = sortB;
+        minpos  = mindist = 0x7fffffff;
+        for (j=0; j < ncolors; j++) {
+            d = DISTANCE(0, 0, i, 0, 0, (pal[j]) & 0xff);
+            if (d < mindist) { mindist = d; minpos  = j; }
+        }
+        bestB[i] = minpos;
+    }
+}
+
+static int
+_txFastMatch(int r, int g, int b)
+{
+    int minpos, mindist, i, d, persist;
+    FxU32 *pal;
+
+    minpos = mindist = 0x7fffffff;
+
+    /* Walk backwards from bestR, tracking best index */
+    pal = sortR;
+    persist = 0;
+    for (i=bestR[r]; i>=0; i--) {
+        d = DISTANCE(r, g, b, 
+            ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff));
+        if (d < mindist) { mindist = d; minpos = (pal[i] >> 24) & 0xff; }
+        else if (++persist > 3) break;
+    }
+
+    /* Walk forwards from bestR+1, tracking best index */
+    persist = 0;
+    for (i=bestR[r]+1; i < nsorted; i++) {
+        d = DISTANCE(r, g, b, 
+            ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff));
+        if (d < mindist) { mindist = d; minpos = (pal[i] >> 24) & 0xff; }
+        else if (++persist > 3) break;
+    }
+
+
+    /* Walk backwards from bestG, tracking best index */
+    pal = sortG;
+    persist = 0;
+    for (i=bestG[g]; i>=0; i--) {
+        d = DISTANCE(r, g, b, 
+            ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff));
+        if (d < mindist) { mindist = d; minpos = (pal[i]>>24) & 0xff; }
+        else if (++persist > 3) break;
+    }
+
+    /* Walk forwards from bestG+1, tracking best index */
+    persist = 0;
+    for (i=bestG[g]+1; i < nsorted; i++) {
+        d = DISTANCE(r, g, b, 
+            ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff));
+        if (d < mindist) { mindist = d; minpos = (pal[i]>>24) & 0xff; }
+        else if (++persist > 3) break;
+    }
+
+    /* Walk backwards from bestB, tracking best index */
+    pal = sortB;
+    persist = 0;
+    for (i=bestB[b]; i>=0; i--) {
+        d = DISTANCE(r, g, b, 
+            ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff));
+        if (d < mindist) { mindist = d; minpos = (pal[i]>>24) & 0xff; }
+        else if (++persist > 3) break;
+    }
+
+    /* Walk forwards from bestB+1, tracking best index */
+    persist = 0;
+    for (i=bestB[b]+1; i < nsorted; i++) {
+        d = DISTANCE(r, g, b, 
+            ((pal[i] >> 16) & 0xff), ((pal[i] >> 8) & 0xff), ((pal[i]) & 0xff));
+        if (d < mindist) { mindist = d; minpos = (pal[i]>>24) & 0xff; }
+        else if (++persist > 3) break;
+    }
+    return minpos;
+}
+#endif  // FAST_DIFFUSION
+
+
+static void
+_txToDiffuseIndex (FxU8 *opixels, int pixsize, const FxU32 *pal, int ncolors,
+    const FxU32 *ipixels, int width, int height)
+{
+    int         y, x, i;
+    int         qr, qg, qb;
+
+    for (y=0; y<height; y++) {
+
+      if( txVerbose )
+        {
+          if (y == (3*height)/4) { printf("."); fflush(stdout);}
+          if (y == (2*height)/4) { printf("."); fflush(stdout);}
+          if (y == (1*height)/4) { printf("."); fflush(stdout);}
+          if (y == (0*height)/4) { printf("."); fflush(stdout);}
+        }
+
+        qr = qg = qb = 0;
+        for (i=0; i<=width; i++) ErrR[i] = ErrG[i] = ErrB[i] = 0;
+
+        for (x=0; x<width; x++) {
+            int ia, ir, ig, ib, c;
+
+            // The input color, and add diffused errors to these.
+            ia = (*ipixels >> 24) & 0xFF;
+            ir = (*ipixels >> 16) & 0xFF;
+            ig = (*ipixels >>  8) & 0xFF;
+            ib = (*ipixels      ) & 0xFF;
+            ipixels ++;
+
+            ir += qr + ErrR[x];
+            ig += qg + ErrG[x];
+            ib += qb + ErrB[x];
+
+            qr = ir;    // quantized pixel values. 
+            qg = ig;    // qR is error from pixel to left, errR is
+            qb = ib;    // error from pixel to the top & top left.
+
+            if (qr < 0) qr = 0; if (qr > 255) qr = 255; // clamp.
+            if (qg < 0) qg = 0; if (qg > 255) qg = 255;
+            if (qb < 0) qb = 0; if (qb > 255) qb = 255;
+
+            // Find closest color in the tables, and quantize.
+            c = txNearestColor(qr, qg, qb, pal, ncolors);
+#if FAST_DIFFUSION
+            // 3 times faster, but not as good quality.
+            c = _txFastMatch(qr, qg, qb);
+#endif
+
+            qr = (pal[c] & 0x00ff0000) >> 16;
+            qg = (pal[c] & 0x0000ff00) >>  8;
+            qb = (pal[c] & 0x000000ff)      ;
+
+            // Diffuse the errors.
+            qr = ir - qr;
+            qg = ig - qg;
+            qb = ib - qb;
+
+            // 3/8 (=0.375) to the EAST, 3/8 to the SOUTH, 
+            // 1/4 (0.25) to the SOUTH-EAST.
+            ErrR[x]  = ((x == 0) ? 0 : ErrR[x]) + ((int) (qr * 0.375f));
+            ErrG[x]  = ((x == 0) ? 0 : ErrG[x]) + ((int) (qg * 0.375f));
+            ErrB[x]  = ((x == 0) ? 0 : ErrB[x]) + ((int) (qb * 0.375f));
+
+            ErrR[x+1] = (int) (qr * 0.250f);
+            ErrG[x+1] = (int) (qg * 0.250f);
+            ErrB[x+1] = (int) (qb * 0.250f);
+
+            qr = (int) (qr * 0.375f);           // Carried to the right.
+            qg = (int) (qg * 0.375f);
+            qb = (int) (qb * 0.375f);
+
+            if (pixsize == 2) {
+                *(FxU16 *) opixels = (ia << 8) | c;
+                opixels += pixsize;
+            } else {
+                *opixels++ = (FxU8) c;
+            }
+        }
+    }
+}
+
+void
+txDiffuseIndex(TxMip *pxMip, TxMip *txMip, int pixsize, const FxU32 *palette,
+    int ncolors)
+{
+    int i, w, h;
+
+    if( txVerbose )
+      {
+        printf("EDiffusion:..."); fflush(stdout);
+      }
+        
+#if     FAST_DIFFUSION
+    _txMakeRange(palette, ncolors);
+#endif
+
+    /* Translate image to an indexed image using error diffusion */
+    w = txMip->width;
+    h = txMip->height;
+
+    for (i=0; i<txMip->depth; i++) {
+        _txToDiffuseIndex(pxMip->data[i], pixsize, palette, ncolors, 
+            txMip->data[i], w, h);
+            if (w > 1) w >>= 1;
+            if (h > 1) h >>= 1;
+    }
+    if( txVerbose )
+      {
+        printf("done\n");
+      }
+}
Index: trunk/src/opengl/glide/sst1/texus/gldutil.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/gldutil.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/gldutil.c	(revision 2885)
@@ -0,0 +1,384 @@
+
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:37 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include <3dfx.h>
+#include <glide.h>
+#include "texus.h"
+#include "texusint.h"
+
+/*
+ * Allocate memory via Glide for a texture.
+ * Assumes that the passed image is already quantized to 
+ * the format that you want to download.
+ */
+GrMipMapId_t txAllocateTexMemory( GrChipID_t tmu,
+                                  FxU8 odd_even_mask,
+                                  TxMip *texture,
+                                  GrMipMapMode_t mm_mode,
+                                  GrTextureClampMode_t s_clamp_mode,
+                                  GrTextureClampMode_t t_clamp_mode,
+                                  GrTextureFilterMode_t minfilter_mode,
+                                  GrTextureFilterMode_t magfilter_mode,
+                                  float lod_bias,
+                                  FxBool trilinear )
+{
+  int aspect;
+  GrAspectRatio_t gr_aspect;
+  int longest_side;
+  GrLOD_t max_lod, min_lod;
+  int num_mipmap_levels = 0;
+  int i;
+
+  aspect = ( 8 * texture->width ) / texture->height;
+
+#ifdef GLIDE3
+  switch( aspect )
+    {
+    case 64:
+      gr_aspect = GR_ASPECT_LOG2_8x1;
+      longest_side = texture->width;
+      break;
+    case 32:
+      gr_aspect = GR_ASPECT_LOG2_4x1;
+      longest_side = texture->width;
+      break;
+    case 16:
+      gr_aspect = GR_ASPECT_LOG2_2x1;
+      longest_side = texture->width;
+      break;
+    case 8:
+      gr_aspect = GR_ASPECT_LOG2_1x1;
+      longest_side = texture->width;
+      break;
+    case 4:
+      gr_aspect = GR_ASPECT_LOG2_1x2;
+      longest_side = texture->height;
+      break;
+    case 2:
+      gr_aspect = GR_ASPECT_LOG2_1x4;
+      longest_side = texture->height;
+      break;
+    case 1:
+      gr_aspect = GR_ASPECT_LOG2_1x8;
+      longest_side = texture->height;
+      break;
+    }
+#else
+  switch( aspect )
+    {
+    case 64:
+      gr_aspect = GR_ASPECT_8x1;
+      longest_side = texture->width;
+      break;
+    case 32:
+      gr_aspect = GR_ASPECT_4x1;
+      longest_side = texture->width;
+      break;
+    case 16:
+      gr_aspect = GR_ASPECT_2x1;
+      longest_side = texture->width;
+      break;
+    case 8:
+      gr_aspect = GR_ASPECT_1x1;
+      longest_side = texture->width;
+      break;
+    case 4:
+      gr_aspect = GR_ASPECT_1x2;
+      longest_side = texture->height;
+      break;
+    case 2:
+      gr_aspect = GR_ASPECT_1x4;
+      longest_side = texture->height;
+      break;
+    case 1:
+      gr_aspect = GR_ASPECT_1x8;
+      longest_side = texture->height;
+      break;
+    }
+#endif /* GLIDE3 */
+
+  /*
+   * How many mipmap levels are there?
+   */
+  for( i = 0; i < 16; i++ )
+    {
+      if( texture->data[i] )
+        num_mipmap_levels++;
+      else
+        break;
+    }
+
+  /*
+   * Figure out the max lod.
+   */
+#ifdef GLIDE3
+  switch( longest_side )
+    {
+    case 256:
+      max_lod = GR_LOD_LOG2_256;
+      break;
+    case 128:
+      max_lod = GR_LOD_LOG2_128;
+      break;
+    case 64:
+      max_lod = GR_LOD_LOG2_64;
+      break;
+    case 32:
+      max_lod = GR_LOD_LOG2_32;
+      break;
+    case 16:
+      max_lod = GR_LOD_LOG2_16;
+      break;
+    case 8:
+      max_lod = GR_LOD_LOG2_8;
+      break;
+    case 4:
+      max_lod = GR_LOD_LOG2_4;
+      break;
+    case 2:
+      max_lod = GR_LOD_LOG2_2;
+      break;
+    case 1:
+      max_lod = GR_LOD_LOG2_1;
+      break;
+    }
+#else
+  switch( longest_side )
+    {
+    case 256:
+      max_lod = GR_LOD_256;
+      break;
+    case 128:
+      max_lod = GR_LOD_128;
+      break;
+    case 64:
+      max_lod = GR_LOD_64;
+      break;
+    case 32:
+      max_lod = GR_LOD_32;
+      break;
+    case 16:
+      max_lod = GR_LOD_16;
+      break;
+    case 8:
+      max_lod = GR_LOD_8;
+      break;
+    case 4:
+      max_lod = GR_LOD_4;
+      break;
+    case 2:
+      max_lod = GR_LOD_2;
+      break;
+    case 1:
+      max_lod = GR_LOD_1;
+      break;
+    }
+#endif /* GLIDE3 */
+
+  /*
+   * Figure out the minimum LOD.
+   */
+#ifdef GLIDE3
+  min_lod = max_lod - ( num_mipmap_levels - 1 );
+#else
+  min_lod = max_lod + num_mipmap_levels - 1;
+#endif
+
+  return grTexAllocateMemory( tmu, odd_even_mask,
+#if 0
+                              texture->width, texture->height,
+#else
+                              0, 0,
+#endif
+                              texture->format, mm_mode,
+                              min_lod, max_lod,
+                              gr_aspect,
+                              s_clamp_mode, t_clamp_mode,
+                              minfilter_mode, magfilter_mode,
+                              lod_bias,
+                              trilinear );
+}
+
+void txDownloadMipmap( GrMipMapId_t mmid, TxMip *texture )
+{
+  int longest_side;
+  GrLOD_t lod;
+  int i;
+
+  if( texture->width > texture->height )
+    longest_side = texture->width;
+  else
+    longest_side = texture->height;
+
+  /*
+   * Figure out the max lod.
+   */
+#ifdef GLIDE3
+  switch( longest_side )
+    {
+    case 256:
+      lod = GR_LOD_LOG2_256;
+      break;
+    case 128:
+      lod = GR_LOD_LOG2_128;
+      break;
+    case 64:
+      lod = GR_LOD_LOG2_64;
+      break;
+    case 32:
+      lod = GR_LOD_LOG2_32;
+      break;
+    case 16:
+      lod = GR_LOD_LOG2_16;
+      break;
+    case 8:
+      lod = GR_LOD_LOG2_8;
+      break;
+    case 4:
+      lod = GR_LOD_LOG2_4;
+      break;
+    case 2:
+      lod = GR_LOD_LOG2_2;
+      break;
+    case 1:
+      lod = GR_LOD_LOG2_1;
+      break;
+    }
+#else
+  switch( longest_side )
+    {
+    case 256:
+      lod = GR_LOD_256;
+      break;
+    case 128:
+      lod = GR_LOD_128;
+      break;
+    case 64:
+      lod = GR_LOD_64;
+      break;
+    case 32:
+      lod = GR_LOD_32;
+      break;
+    case 16:
+      lod = GR_LOD_16;
+      break;
+    case 8:
+      lod = GR_LOD_8;
+      break;
+    case 4:
+      lod = GR_LOD_4;
+      break;
+    case 2:
+      lod = GR_LOD_2;
+      break;
+    case 1:
+      lod = GR_LOD_1;
+      break;
+    }
+#endif /* GLIDE3 */
+
+  for( i = 0; i < 16; i++ )
+    {
+      void *tmp;
+
+      if( !texture->data[i] )
+        break;
+      tmp = texture->data[i];
+      guTexDownloadMipMapLevel( mmid, lod, (const void **) &tmp );
+      lod++;
+    }
+
+  if( ( texture->format == GR_TEXFMT_YIQ_422 ) ||
+      ( texture->format == GR_TEXFMT_AYIQ_8422 ) )
+    {
+      int i, j;
+      GuNccTable ncc_table;
+
+      for( i = 0; i < 16; i++ )
+        {
+          ncc_table.yRGB[i] = ( FxU8 )texture->pal[i];
+        }
+      
+      for( i = 0; i < 4; i++ )
+        {
+          for( j = 0; j < 3; j++ )
+            {
+              ncc_table.iRGB[i][j] = ( FxI16 )( texture->pal[16 + 3 * i + j] );
+              ncc_table.qRGB[i][j] = ( FxI16 )( texture->pal[28 + 3 * i + j] );
+            }
+        }
+
+      /*
+      ** pack the table Y entries
+      */
+      for ( i = 0; i < 4; i++ )
+        {
+          FxU32 packedvalue;
+
+          packedvalue  = ( ( FxU32 )( ncc_table.yRGB[i*4+0] & 0xff ) );
+          packedvalue |= ( ( FxU32 )( ncc_table.yRGB[i*4+1] & 0xff ) ) << 8;
+          packedvalue |= ( ( FxU32 )( ncc_table.yRGB[i*4+2] & 0xff ) ) << 16;
+          packedvalue |= ( ( FxU32 )( ncc_table.yRGB[i*4+3] & 0xff ) ) << 24;
+
+          ncc_table.packed_data[i] = packedvalue;
+        }
+
+      /*
+      ** pack the table I entries
+      */
+      for ( i = 0; i < 4; i++ )
+        {
+          FxU32 packedvalue;
+
+          packedvalue  = ( ( FxU32 )( ncc_table.iRGB[i][0] & 0x1ff ) ) << 18;
+          packedvalue |= ( ( FxU32 )( ncc_table.iRGB[i][1] & 0x1ff ) ) << 9;
+          packedvalue |= ( ( FxU32 )( ncc_table.iRGB[i][2] & 0x1ff ) ) << 0;
+
+          ncc_table.packed_data[i+4] = packedvalue;
+        }
+
+      /*
+      ** pack the table Q entries
+      */
+      for ( i = 0; i < 4; i++ )
+        {
+          FxU32 packedvalue;
+
+          packedvalue  = ( ( FxU32 )( ncc_table.qRGB[i][0] & 0x1ff ) ) << 18;
+          packedvalue |= ( ( FxU32 )( ncc_table.qRGB[i][1] & 0x1ff ) ) << 9;;
+          packedvalue |= ( ( FxU32 )( ncc_table.qRGB[i][2] & 0x1ff ) ) << 0;
+
+          ncc_table.packed_data[i+8] = packedvalue;
+        }
+
+#if 0
+      HackSetNCCTable( mmid, &ncc_table );
+#endif
+    }
+}
Index: trunk/src/opengl/glide/sst1/texus/makefile
===================================================================
--- trunk/src/opengl/glide/sst1/texus/makefile	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/makefile	(revision 2885)
@@ -0,0 +1,45 @@
+# $Id: makefile,v 1.1 2000-02-25 00:31:37 sandervl Exp $
+#
+# PD-Win32 API
+#
+#       Glide makefile
+#
+
+PDWIN32_INCLUDE = ..\..\..\..\..\include
+PDWIN32_LIB = ..\..\..\..\..\lib
+PDWIN32_BIN = ..\..\..\..\..\bin
+PDWIN32_TOOLS = ..\..\..\..\..\tools\bin
+
+TARGET=TEXUS
+
+!include $(PDWIN32_INCLUDE)/pdwin32.mk
+!include ..\3dfx.mak
+
+CINCLUDE=-I..\incsrc;..\..\swlibs\fxmisc;..\init\initvg;..\init;..\glide;..\..\swlibs\pcilib
+
+CFLAGS = $(CFLAGS) $(CINCLUDE)
+CXXFLAGS = $(CXXFLAGS) $(CINCLUDE)
+
+OBJS =	3DF.OBJ         CLAMP.OBJ       DEQUANT.OBJ     DIFFUSE.OBJ     GLDUTIL.OBJ \
+	MIPMAP.OBJ      NCC.OBJ         NCCNNET.OBJ     PAL256.OBJ      PPM.OBJ \
+	QUANTIZE.OBJ    READ.OBJ        RESAMPLE.OBJ    RGT.OBJ         TEXUSLIB.OBJ \
+	TGA.OBJ         UTIL.OBJ        VIEW.OBJ        WRITE.OBJ
+
+all: $(TARGET).lib
+
+$(TARGET).lib: $(OBJS)
+	$(RM) $(TARGET).lib
+	$(ILIB) $(ILIBFLAGS) $(TARGET).lib $(OBJS) ,,
+
+dep:
+    $(DEPEND) -I$(PDWIN32_INCLUDE);$(PDWIN32_INCLUDE)\win $(CINCLUDE) \
+        *.c *.cpp *.h *.asm *.inc $(PDWIN32_INCLUDE)\*.h \
+        ..\incsrc\*.h ..\..\swlibs\fxmisc*.h ..\init\initvg\*.h ..\glide\*.h ..\init\*.h ..\..\swlibs\pcilib\*.h 
+
+!ifndef NODEP
+!include .depend
+!endif
+
+clean:
+    $(RM) *.obj *.lib
+
Index: trunk/src/opengl/glide/sst1/texus/makefile.os2
===================================================================
--- trunk/src/opengl/glide/sst1/texus/makefile.os2	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/makefile.os2	(revision 2885)
@@ -0,0 +1,15 @@
+FX_EXE = 1
+
+include "\glide\3dfxos2.mak"
+
+OBJS =	3DF.OBJ         CLAMP.OBJ       DEQUANT.OBJ     DIFFUSE.OBJ     GLDUTIL.OBJ \
+	MIPMAP.OBJ      NCC.OBJ         NCCNNET.OBJ     PAL256.OBJ      PPM.OBJ \
+	QUANTIZE.OBJ    READ.OBJ        RESAMPLE.OBJ    RGT.OBJ         TEXUSLIB.OBJ \
+	TGA.OBJ         UTIL.OBJ        VIEW.OBJ        WRITE.OBJ
+
+all: $(OBJS)
+
+clean:
+        del *.obj
+        del *.dll
+        del *.lib
Index: trunk/src/opengl/glide/sst1/texus/mipmap.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/mipmap.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/mipmap.c	(revision 2885)
@@ -0,0 +1,115 @@
+
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:37 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+#define B0(x)   ((x>>24)&0xFF)
+#define B1(x)   ((x>>16)&0xFF)
+#define B2(x)   ((x>>8)&0xFF)
+#define B3(x)   ((x>>0)&0xFF)
+
+static void
+_txImgHalve(long *outdata, int width, int height, long *indata)
+{
+    unsigned int i,j,k;
+    unsigned int w,h, *p,sum,*q;
+
+    if ((outdata == NULL)       ||
+        (width   <= 0   )       ||
+        (height  <= 0   )       ||
+        (width & (width-1)) ||
+        (height & (height-1)) ||
+        ((width == 1) && (height==1))) return;
+
+    w = width>>1;
+    h = height>>1;
+    p = (unsigned int *) outdata;
+    q = (unsigned int *) indata;
+
+    if ((w == 0) || (h == 0)) {
+        // Input and output are a single span each (row or column)
+        for (j=0; j<w; j++) {
+                sum = B0(q[0]) + B0(q[1]); sum = (sum + 1) >> 1; k = sum;
+                sum = B1(q[0]) + B1(q[1]); sum = (sum + 1) >> 1; k = (k << 8) + sum;
+                sum = B2(q[0]) + B2(q[1]); sum = (sum + 1) >> 1; k = (k << 8) + sum;
+                sum = B3(q[0]) + B3(q[1]); sum = (sum + 1) >> 1; k = (k << 8) + sum;
+                *p++ = k;
+                q += 2;
+        }
+        return;
+    }
+
+    for (i=0; i<h; i++) {
+    for (j=0; j<w; j++) {
+        sum = B0(q[0]) + B0(q[1]) + B0(q[width]) + B0(q[width+1]);
+        sum = (sum + 2) >> 2;   // add 2 to round, then divide by 4
+        k = sum;
+        sum = B1(q[0]) + B1(q[1]) + B1(q[width]) + B1(q[width+1]);
+        sum = (sum + 2) >> 2;   // add 2 to round, then divide by 4
+        k = (k<<8) + sum;
+        sum = B2(q[0]) + B2(q[1]) + B2(q[width]) + B2(q[width+1]);
+        sum = (sum + 2) >> 2;   // add 2 to round, then divide by 4
+        k = (k<<8) + sum;
+        sum = B3(q[0]) + B3(q[1]) + B3(q[width]) + B3(q[width+1]);
+        sum = (sum + 2) >> 2;   // add 2 to round, then divide by 4
+        k = (k<<8) + sum;
+        *p++ = k;
+        q += 2;
+    }
+    q += width;
+    }
+}
+
+void
+txMipMipmap(TxMip *txMip)
+{
+    int         i, w, h;
+
+    w = txMip->width;
+    h = txMip->height;
+
+    if( txVerbose )
+      {
+        printf("Mipmapping: .."); fflush(stdout);
+        printf(" %dx%d", w, h);
+      }
+    for (i=1; i< txMip->depth; i++) {
+        _txImgHalve (txMip->data[i], w, h, txMip->data[i-1]);
+        if (w > 1) w >>= 1;
+        if (h > 1) h >>= 1;
+        if( txVerbose )
+          {
+            printf(" %dx%d", w, h); fflush(stdout);
+          }
+    }
+    if( txVerbose )
+      {
+        printf(".\n");
+      }
+}
Index: trunk/src/opengl/glide/sst1/texus/ncc.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/ncc.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/ncc.c	(revision 2885)
@@ -0,0 +1,334 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:37 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+static int 
+dithmat[4][4] = {       0,  8,  2, 10, 
+                           12,  4, 14,  6, 
+                            3, 11,  1,  9, 
+                           15,  7, 13,  5 };
+
+static struct   {
+    int yhist[256], ihist[256], qhist[256];
+    int ymin, ymax, imin, imax, qmin, qmax;
+    int npixels;
+    int y[16], a[3*4], b[3*4];          // please leave these contiguous
+} ncc;
+
+static int
+_txPixQuantize_YIQ422 (unsigned long argb, int x, int y, int w)
+{
+    int         r, g, b; 
+    int         iy, ii, iq;
+
+    r = (argb >> 16) & 0xFF;
+    g = (argb >>  8) & 0xFF;
+    b = (argb      ) & 0xFF;
+
+    iy = (int) (( 0.30F * r + 0.59F * g + 0.11F * b) + 0.5f);
+    ii = (int) (((0.60F * r - 0.28F * g - 0.32F * b) / 1.20F) + 127.5f + 0.5f);
+    iq = (int) (((0.21F * r - 0.52F * g + 0.31F * b) / 1.04F) + 127.5f + 0.5f);
+
+    // At this point, 0<=y,i,q<=255
+    // Convert to 4 bits of y, 2 of i and q.
+
+    if (iy <= ncc.ymin) iy = 0;
+    else if (iy >= ncc.ymax) iy = 15;
+    else iy = (int) ((iy - ncc.ymin) * 15.0f/(ncc.ymax - ncc.ymin) + 0.5f);
+
+    if (ii <= ncc.imin) ii = 0;
+    else if (ii >= ncc.imax) ii = 3;
+    else ii = (int) ((ii - ncc.imin) *  3.0f/(ncc.imax - ncc.imin) + 0.5f);
+
+    if (iq <= ncc.qmin) iq = 0;
+    else if (iq >= ncc.qmax) iq = 3;
+    else iq = (int) ((iq - ncc.qmin) *  3.0f/(ncc.qmax - ncc.qmin) + 0.5f);
+
+    if ((iy < 0) || (iy > 15) || (ii < 0) || (ii > 3) || (iq < 0) || (iq > 3)) {
+        printf("%d %d %d\n", iy, ii, iq);
+        txPanic("Bad YIQ\n");
+    }
+    return ( (iy << 4) | (ii << 2) | iq);
+}
+
+
+static int
+_txPixQuantize_YIQ422_D4x4 (unsigned long argb, int x, int y, int w)
+{
+    int         r, g, b;
+    int         iy, ii, iq;
+
+
+    r = (argb >> 16) & 0xFF;
+    g = (argb >>  8) & 0xFF;
+    b = (argb      ) & 0xFF;
+
+    iy = (int) (( 0.30F * r + 0.59F * g + 0.11F * b) + 0.5f);
+    ii = (int) (((0.60F * r - 0.28F * g - 0.32F * b) / 1.20F) + 127.5f + 0.5f);
+    iq = (int) (((0.21F * r - 0.52F * g + 0.31F * b) / 1.04F) + 127.5f + 0.5f);
+
+    // At this point, 0<=y,i,q<=255
+    // Convert to 4 bits of y, 2 of i and q.
+
+    if (iy <= ncc.ymin) iy = 0;
+    else if (iy >= ncc.ymax) iy = 0xf0;
+    else iy = (int) ((iy - ncc.ymin) * 0xF0/(ncc.ymax - ncc.ymin));
+
+    if (ii <= ncc.imin) ii = 0;
+    else if (ii >= ncc.imax) ii = 0x30;
+    else ii = (int) ((ii - ncc.imin) * 0x30/(ncc.imax - ncc.imin));
+
+    if (iq <= ncc.qmin) iq = 0;
+    else if (iq >= ncc.qmax) iq = 0x30;
+    else iq = (int) ((iq - ncc.qmin) * 0x30/(ncc.qmax - ncc.qmin));
+
+    iy += dithmat[y&3][x&3];
+    ii += dithmat[y&3][x&3];
+    iq += dithmat[y&3][x&3];
+
+    iy >>= 4;
+    ii >>= 4;
+    iq >>= 4;
+
+    if ((iy < 0) || (iy > 15) || (ii < 0) || (ii > 3) || (iq < 0) || (iq > 3)) {
+        printf("%d %d %d\n", iy, ii, iq);
+        txPanic("Bad YIQ\n");
+    }
+    return ( (iy << 4) | (ii << 2) | iq);
+}
+
+static void
+_txImgNcc(char *odata, unsigned long *idata, int w, int h, int format, 
+    int dither)
+{
+    int (*quantizer)(unsigned long argb, int x, int y, int w);
+    int         x, y, pixsize;
+
+    quantizer = (dither) ? _txPixQuantize_YIQ422_D4x4 : _txPixQuantize_YIQ422;
+
+    pixsize = (format == GR_TEXFMT_YIQ_422) ? 1 : 2;
+
+    for (y=0; y<h; y++) {
+        for (x=0; x<w; x++) {
+                if (format == GR_TEXFMT_AYIQ_8422) {
+                        *(FxU16 *)odata = (FxU16) ((*quantizer)(*idata,x,y,w) |
+                                                   ((*idata >> 16) & 0xFF00));
+                } else {
+                        *odata = (*quantizer)(*idata, x, y, w);
+                }
+                odata += pixsize;
+                idata ++;
+        }
+    }
+}
+
+/*
+   The basics are as follows:
+
+   RGB values can be converted to YIQ using the equation:
+  
+   Y = 0.30F * R + 0.59F * G + 0.11F * B;
+   I = 0.60F * R - 0.28F * G - 0.32F * B;
+   Q = 0.21F * R - 0.52F * G + 0.31F * B;
+
+   Assuming that each of the RGB components are in the range 0..255, 
+   Y ranges from (0 .. 255)
+   I ranges from (-0.60 * 255 .. 0.60 * 255) i.e, (-153 to 153)
+   Q ranges from (-0.52 * 255 .. 0.52 * 255) i.e, (-132 to 133)
+
+*/
+
+
+static void     
+_txMipNccStatTable(TxMip *txMip)
+{
+    int i, w, h;
+
+    for (i=0; i<256; i++) 
+        ncc.yhist[i] = ncc.ihist[i] = ncc.qhist[i] = 0;
+    ncc.npixels = 0;
+
+    /* First find out the relative frequencies of Y, I, Q */
+    w = txMip->width;
+    h = txMip->height;
+
+    for (i=0; i< txMip->depth; i++) {
+        FxU32*  src;
+        int             npixels;
+
+        src = txMip->data[i];
+        npixels = w * h;
+        ncc.npixels += npixels;
+
+        while (npixels--) {
+                float   fy, fi, fq, r, g, b;
+                FxU32   argb;
+
+                argb = *src++;
+                r = (float)((argb >> 16) & 0xFF);
+            g = (float)((argb >>  8) & 0xFF);
+            b = (float)((argb      ) & 0xFF);
+
+            fy = 0.30F * r + 0.59F * g + 0.11F * b;
+            fi = 0.60F * r - 0.28F * g - 0.32F * b;
+            fq = 0.21F * r - 0.52F * g + 0.31F * b;
+
+            // Y is now in the range [0,1] * 255, but I and Q need work
+            // I is in the range [-.60, +.60] * 255, convert to [0,1]*255
+            // Q is in the range [-.52, +.52] * 255, convert to [0,1]*255
+
+            fi = fi * 0.50f / 0.60f + 127.5f;
+            fq = fq * 0.50f / 0.52f + 127.5f;
+
+                ncc.yhist[ (int)(fy + 0.5f)]++;
+                ncc.ihist[ (int)(fi + 0.5f)]++;
+                ncc.qhist[ (int)(fq + 0.5f)]++;
+        }
+        if (w > 1) w >>= 1;
+        if (h > 1) h >>= 1;
+    }
+
+    /* Now discard the top 10%, bottom 10% of each channel */
+    {
+        int     ysum, isum, qsum, threshold;
+
+        ncc.ymin = ncc.imin = ncc.qmin = 0;
+        ncc.ymax = ncc.imax = ncc.qmax = 255;
+        threshold = (int) (0.01f * ncc.npixels);
+
+        ysum = isum = qsum = 0;
+        for (i=0; i<256; i++) {
+                ysum += ncc.yhist[i];
+                isum += ncc.ihist[i];
+                qsum += ncc.qhist[i];
+                if (ysum < threshold) ncc.ymin = i;
+                if (isum < threshold) ncc.imin = i;
+                if (qsum < threshold) ncc.qmin = i;
+        }
+
+        ysum = isum = qsum = 0;
+        for (i=255; i>=0; i--) {
+                ysum += ncc.yhist[i];
+                isum += ncc.ihist[i];
+                qsum += ncc.qhist[i];
+                if (ysum < threshold) ncc.ymax = i;
+                if (isum < threshold) ncc.imax = i;
+                if (qsum < threshold) ncc.qmax = i;
+        }
+
+        if (ncc.ymin > ncc.ymax) ncc.ymin = ncc.ymax;
+        if (ncc.imin > ncc.imax) ncc.imin = ncc.imax;
+        if (ncc.qmin > ncc.qmax) ncc.qmin = ncc.qmax;
+    }
+}
+
+
+void    
+txMipNcc(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compression)
+{
+    int         i, w, h, pixsize;
+
+    switch (compression & TX_COMPRESSION_MASK) {
+    case        TX_COMPRESSION_HEURISTIC:                               
+                _txMipNccStatTable(txMip);
+                for (i=0; i< 16; i++) pxMip->pal[ 0 + i] = ncc.y[i];
+                for (i=0; i< 12; i++) pxMip->pal[16 + i] = ncc.a[i];
+                for (i=0; i< 12; i++) pxMip->pal[28 + i] = ncc.b[i];
+                txMipNccNNet(pxMip, txMip, format, dither, compression);
+                return;
+
+    case        TX_COMPRESSION_STATISTICAL:
+                if( txVerbose )
+                  printf("Statistical tables\n");
+                _txMipNccStatTable(txMip);
+                break;
+
+#if 0
+    // This disabled, because it sucks.
+    case        TX_COMPRESSION_YIQ:
+                if( txVerbose )
+                  printf("YIQ tables\n");
+                ncc.ymin = ncc.imin = ncc.qmin = 0;
+                ncc.ymax = ncc.imax = ncc.qmax = 255;
+                break;
+#endif
+    }
+    pixsize = (format == GR_TEXFMT_YIQ_422) ? 1 : 2;
+
+    /* Generate the YAB tables */
+    for (i=0; i<16; i++) {
+        ncc.y[i] = (int) (ncc.ymin + (ncc.ymax - ncc.ymin)*i/15.0f + 0.5f);
+    }
+
+    for (i=0; i<4; i++) {
+        float   a, b;
+
+        a = ncc.imin + (ncc.imax - ncc.imin)*i/3.0f;
+        a = (a / 255.0f) * 1.20f - 0.60f;                               // a is (-0.60, +0.60)
+        a *= 255.0f;
+
+        b = ncc.qmin + (ncc.qmax - ncc.qmin)*i/3.0f;
+        b = (b / 255.0f) * 1.04f - 0.52f;                               // b is (-0.52, +0.52)
+        b *= 255.0f;
+
+        ncc.a[3*i + 0] = (int) ( 0.95f * a + 0.5f);
+        ncc.a[3*i + 1] = (int) (-0.28f * a + 0.5f);
+        ncc.a[3*i + 2] = (int) (-1.11f * a + 0.5f);
+
+        ncc.b[3*i + 0] = (int) ( 0.62f * b + 0.5f);
+        ncc.b[3*i + 1] = (int) (-0.64f * b + 0.5f);
+        ncc.b[3*i + 2] = (int) ( 1.73f * b + 0.5f);
+    }
+
+
+    if ((dither & TX_DITHER_MASK) == TX_DITHER_ERR) {
+        txYABtoPal256((long *)pxMip->pal, (long *) &ncc.y[0]);
+        txDiffuseIndex(pxMip, txMip, pixsize, pxMip->pal, 256);
+    }
+    else {
+
+        /* For each mipmap, translate input RGB values to YIQ, and quantize */
+        /* Optionally, dither using 4x4 dither matrix */
+        /* Return the quantized YIQ values */
+
+        w = txMip->width;
+        h = txMip->height;
+
+        for (i=0; i<txMip->depth; i++) {
+                _txImgNcc(pxMip->data[i], txMip->data[i], w, h,format,dither);
+                if (w > 1) w >>= 1;
+                if (h > 1) h >>= 1;
+        }
+    }
+
+    // Copy decompression table.
+    for (i=0; i<16; i++) pxMip->pal[   i] = ncc.y[i];
+    for (i=0; i<12; i++) pxMip->pal[16+i] = ncc.a[i];
+    for (i=0; i<12; i++) pxMip->pal[28+i] = ncc.b[i];
+}
Index: trunk/src/opengl/glide/sst1/texus/nccnnet.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/nccnnet.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/nccnnet.c	(revision 2885)
@@ -0,0 +1,465 @@
+
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:38 $
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+/*
+ * This file implements the neural net quantizer, which takes an image in
+ * ARGB8888 format and produces an optimal YAB table, and an 8 bit image
+ * in YAB format that best represents the original image. A very detailed
+ * explanation of the algorithm is available in 
+ * /tdfx/engr/devel/sst1/docs/yab.doc. The summary follows.
+ *
+ * Neural net algorithms first determine a "representative sample" of the 
+ * input image. This representative sample is repeatedly run through the net
+ * during the network learning stage, and the neural net "learns" which colors
+ * are important and which ones are not. It's quite possible to feed every
+ * pixel in the original image repeatedly into the neural net
+ * to make it learn; however, this can be extremely time consuming. 
+ *
+ * So, we prefer to make a representative sample of colors for the input image.
+ * The original yab.doc suggests we try to derive sample colors by reducing the
+ * ARGB8888 colors to RGB555. I've found that simply color quantizing to 256
+ * colors (just like for the 8-bit palettized case) works quite well, and
+ * so we first quantize to 8 bit palette, and use the palette as the sample
+ * colors to feed the neural network. This also makes using 256-palette 
+ * textures very easy.
+ *
+ * After the "representative colors" are determined, we train the neural net,
+ * and obtain the optimal YAB table.  Each sample color in the palette, 
+ * which was originally in ARGB8888 format is now replaced with IRGB8888, 
+ * where the RGB is the same as before, but the alpha channel is replaced 
+ * with an 8 bit number I which is the YAB index corresponding to this 
+ * representative color. 
+ *
+ * So now it's possible to translate the original image into an 8 bit image
+ * by first looking up the original pixel in the representative colors table,
+ * extracting the alpha channel, and using it as the index into the YAB table
+ * delivered by the algorithm.
+ *
+ * In the process of converting the original image to the YAB format, we could
+ * optionally dither the image. Ordered dithering doesn't quite work, so we
+ * use error-diffusion dithering. 
+ *
+ * I've found that there are three speed bottlenecks to overcome. The first
+ * time consuming operation is the computation of representative image colors.
+ * 256 color quantization is used for this part. The second bottleneck is the 
+ * training of the neural net algorithm itself, and I've optimized this as 
+ * much as possible. The third bottleneck is the translation of the original
+ * image into the 8 bit YAB indexed image; this still needs work, especially
+ * when error diffusion dithering is enabled.
+ *
+ * So, now, onto business.
+ */
+
+/******************************************************************************
+ * 
+ * The hardcore neural net stuff begins here.
+ *
+ */
+
+#define MAX_ITERATIONS  4000
+#define MAX_DRYSPELLS   2000
+#define MAX_NEURONS             256
+
+typedef struct  _weight {
+    long         r,  g,  b;                             // fixed point, SUBPIXEL precision bits
+    int         ir, ig, ib;                             // pure integers, maybe -256 to 255.
+} Weight;
+
+typedef struct  _vector {
+    Weight      *py, *pa, *pb;
+    long         r,  g,  b;                             // pure integers, 0 to 255.
+} Neuron;
+
+static  Weight                  Y[16], A[4], B[4];
+static  Neuron                  N[MAX_NEURONS];
+static  long                    errR, errG, errB, errMax;
+static  long                    totR, totG, totB;
+
+
+#define SUBPIXEL                22
+#define ABS(x)                  (((x) < 0) ? (-(x)) : (x))
+#define INT(x)                  ((x) >> SUBPIXEL)
+#define  CLAMP_255(x)   if (x < 0) x = 0; else if (x > 255) x = 255
+#define  CLAMP_PLUS(x)  if (x < 0) x = 0; else if (x > ((256 << SUBPIXEL)-1)) \
+                                                x = ((256 << SUBPIXEL) -1)
+#define  CLAMP_BOTH(x)  if (x < (-256 << SUBPIXEL)) x = (-256 << SUBPIXEL); \
+                                                else if (x > ((256 << SUBPIXEL) - 1)) \
+                                                x = ((256 << SUBPIXEL) -1)
+
+static int
+_nn_modifyNeurons(long ir, long ig, long ib)
+{
+    int         i; 
+    int         d0, d1;                         // closest & next closest distance to input
+    int         p0, p1;                         // index into the 256 color table.
+    long        d, dr, dg, db;
+    Weight      *py, *pa, *pb;
+    Neuron      *n;
+
+    d0 = d1 = 0x7fffffff;
+    p0 = p1 = 0;
+
+    /* Find 2 neurons with smallest distances to r, g, b */
+    for (i=0, n=N; i<256; i++, n++) {
+        py = n->py;
+        pa = n->pa;
+        pb = n->pb;
+
+        n->r = py->ir + pa->ir + pb->ir; CLAMP_255(n->r);
+        n->g = py->ir + pa->ig + pb->ig; CLAMP_255(n->g);
+        n->b = py->ir + pa->ib + pb->ib; CLAMP_255(n->b);
+
+        d = DISTANCE(n->r, n->g, n->b, ir, ig, ib);
+        if (d < d0) { 
+                d1 = d0; d0 = d;
+                p1 = p0; p0 = i;
+
+        } else if (d < d1) {
+                d1 = d;
+                p1 = i;
+        } 
+    }
+
+    /* track errors */
+    dr = ABS(N[p0].r - ir);
+    dg = ABS(N[p0].g - ig);
+    db = ABS(N[p0].b - ib);
+
+    totR += dr;
+    totG += dg;
+    totB += db;
+
+    if (errMax < d0) {
+        errMax = d0;
+        errR   = dr;
+        errG   = dg;
+        errB   = db;
+    }
+
+
+    // Modify weights for d0 and d1 at positions p0 and p1.
+
+    // The 16 comes from 8.16 format, 4 comes from alpha, the learing rate, set
+    // at 1/16 for now.
+
+    // py->r += (ar * 0.25f + ag * 0.5f + ab * 0.25f) * alpha;
+    // pa->r += ar * 0.25f * alpha;
+    // pb->r += ar * 0.25f * alpha;
+
+
+    // For the closest neuron, apply maximal learning rate.
+    dr = (ir - N[p0].r) << (SUBPIXEL - 1);
+    dg = (ig - N[p0].g) << (SUBPIXEL - 1);
+    db = (ib - N[p0].b) << (SUBPIXEL - 1);
+    py = N[p0].py;
+    pa = N[p0].pa;
+    pb = N[p0].pb;
+    py->r += (dr >> 2) + (dg >> 1) + (db >> 2); CLAMP_PLUS(py->r);
+    pa->r += (dr >> 2) ; CLAMP_BOTH(pa->r); 
+    pa->g += (dg >> 2) ; CLAMP_BOTH(pa->g);
+    pa->b += (db >> 2) ; CLAMP_BOTH(pa->b);
+    pb->r += (dr >> 2) ; CLAMP_BOTH(pb->r);
+    pb->g += (dg >> 2) ; CLAMP_BOTH(pb->g);
+    pb->b += (db >> 2) ; CLAMP_BOTH(pb->b);
+
+    py->ir = INT(py->r);
+    pa->ir = INT(pa->r); pa->ig = INT(pa->g); pa->ib = INT(pa->b);
+    pb->ir = INT(pb->r); pb->ig = INT(pb->g); pb->ib = INT(pb->b);
+
+    // For the next closest neuron, apply 1/4 the learning rate.
+    dr = (ir - N[p1].r) << (SUBPIXEL - 2);
+    dg = (ig - N[p1].g) << (SUBPIXEL - 2);
+    db = (ib - N[p1].b) << (SUBPIXEL - 2);
+    py = N[p1].py;
+    pa = N[p1].pa;
+    pb = N[p1].pb;
+    py->r += (dr >> 2) + (dg >> 1) + (db >> 2); CLAMP_PLUS(py->r);
+    pa->r += (dr >> 2) ; CLAMP_BOTH(pa->r);
+    pa->g += (dg >> 2) ; CLAMP_BOTH(pa->g);
+    pa->b += (db >> 2) ; CLAMP_BOTH(pa->b);
+    pb->r += (dr >> 2) ; CLAMP_BOTH(pb->r);
+    pb->g += (dg >> 2) ; CLAMP_BOTH(pb->g);
+    pb->b += (db >> 2) ; CLAMP_BOTH(pb->b);
+
+    py->ir = INT(py->r);
+    pa->ir = INT(pa->r); pa->ig = INT(pa->g); pa->ib = INT(pa->b);
+    pb->ir = INT(pb->r); pb->ig = INT(pb->g); pb->ib = INT(pb->b);
+
+    return p0;          // best fit neuron is returned.
+}
+
+static  void
+_nn_initTables()
+{
+    int         i;
+
+    // Intensity ramp
+    for (i=0; i<16; i++) {
+        Y[i].r = ((long) ((255.0f * i)/15.0f))  << SUBPIXEL;
+        Y[i].ir = INT(Y[i].r);
+    }
+
+    for (i=0; i< 4; i++) {
+
+        A[i].r = A[i].g = A[i].b = 0;
+        A[i].ir = INT(A[i].r);
+        A[i].ig = INT(A[i].g);
+        A[i].ib = INT(A[i].b);
+
+        B[i].r = B[i].g = B[i].b = 0;
+        B[i].ir = INT(B[i].r);
+        B[i].ig = INT(B[i].g);
+        B[i].ib = INT(B[i].b);
+    }
+
+    for (i=0; i<MAX_NEURONS; i++) {
+        int     iy, ia, ib;
+
+        iy = (i >> 4) & 0x0f;
+        ia = (i >> 2) & 0x03;
+        ib = (i >> 0) & 0x03;
+
+        N[i].py = &Y[iy];
+        N[i].pa = &A[ia];
+        N[i].pb = &B[ib];
+
+        N[i].r = INT(Y[iy].r)+INT(A[ia].r)+INT(B[ib].r);CLAMP_255(N[i].r);
+        N[i].g = INT(Y[iy].r)+INT(A[ia].g)+INT(B[ib].g);CLAMP_255(N[i].g);
+        N[i].b = INT(Y[iy].r)+INT(A[ia].b)+INT(B[ib].b);CLAMP_255(N[i].b);
+    }
+}
+
+static  int order[256];
+static int 
+_nn_randomOrder(const void *a, const void *b)
+{
+    a = b;              // no compiler warnings
+    return (rand() % 3) - 1;
+}
+
+static void
+txMapPal256toYAB(FxU32 *YAB, FxU8 *map, int nsamples, FxU32 *samples)
+{
+    int         i;
+    long        bstR, bstG, bstB, bstMax;
+    int         iterations;                     // track how many inputs have been fed to NN
+    int         drySpells;                      // how many inputs since last best case.
+    long        yab2pal[256];
+
+    _nn_initTables();
+    /* 
+     * Select a number which is relatively prime to nsamples.
+     */
+    for (i=0; i<nsamples; i++) order[i] = i;
+    qsort(order, nsamples, sizeof(int), _nn_randomOrder);
+
+    iterations = drySpells = 0;
+    bstMax = 0x7fffffff;
+
+    while ((iterations < MAX_ITERATIONS) && (drySpells < MAX_DRYSPELLS)) {
+
+        // An epoch:
+        // A whole cycle of inputs is presented to the network in an epoch.
+
+        errR   = errG = errB = errMax = 0;
+        totR   = totG = totB = 0;
+
+        for (i = 0; i< nsamples; i++) {
+                FxU32   *pRGB;
+
+                // We present the samples randomly to the network. 
+                // _nn_modify_neurons() makes the neurons learn
+                // errR, errG, errB, errMax are computed in _nn_modifyNeurons(), as
+                // are totR, totG, totB (accumulative errors).
+
+                pRGB = (FxU32 *) (&samples[order[i]]);
+                (void) _nn_modifyNeurons(((*pRGB >> 16) & 0xFF),
+                    ((*pRGB >> 8) & 0xFF), ((*pRGB) & 0xFF));
+        }
+
+        iterations += nsamples;
+
+        if (errMax < bstMax) {
+                /* 
+                 * A lower total error than before, take a Snapshot
+                 *
+                 * YAB[] has 16 entries for Y, 12 entries each for A & B.
+                 */
+                for (i=0; i<16; i++) {
+                        YAB[i] = Y[i].ir;
+                        if ((Y[i].ir < 0) || (Y[i].ir > 255)) {
+                                txPanic("Bad Y!\n");
+                        }
+                }
+
+                for (i=0; i<4; i++) {
+                        YAB[16 + 3*i + 0] = A[i].ir;
+                        YAB[16 + 3*i + 1] = A[i].ig;
+                        YAB[16 + 3*i + 2] = A[i].ib;
+
+                        if ((A[i].ir < -256) || (A[i].ir > 255) ||
+                            (A[i].ig < -256) || (A[i].ig > 255) ||
+                            (A[i].ib < -256) || (A[i].ib > 255)) txPanic("Bad A!\n");
+                }
+                for (i=0; i<4; i++) {
+                        YAB[28 + 3*i + 0] = B[i].ir;
+                        YAB[28 + 3*i + 1] = B[i].ig;
+                        YAB[28 + 3*i + 2] = B[i].ib;
+
+                        if ((B[i].ir < -256) || (B[i].ir > 255) ||
+                            (B[i].ig < -256) || (B[i].ig > 255) ||
+                            (B[i].ib < -256) || (B[i].ib > 255)) txPanic("Bad B!\n");
+                }
+
+                bstMax = errMax;
+                bstR   = errR;
+                bstG   = errG;
+                bstB   = errB;
+#if 0
+                printf("%8d%, dry=%8d, eMax=%8x eMax=%3d%3d%3d eAvg=%3d%3d%3d\n", 
+                   iterations, drySpells, errMax, 
+                   errG, errR, errB, 
+                   totG/nsamples, totR/nsamples, totB/nsamples
+                );
+#endif
+                drySpells = 0;
+        }
+        else    {
+                drySpells += nsamples;
+        }
+
+        if (errMax == 0) { 
+                // printf("******Exact Solution in %d iterations\n", iterations); 
+                // _nn_Dump(); 
+                break;
+        }
+    }
+
+    /* 
+     * At this point YAB has the YAB table, samples has input palette,
+     * Replace MSB of samples with index to be used with YAB table.
+     */
+
+    txYABtoPal256((long*)yab2pal, (long*)YAB);
+
+    for (i=0; i<nsamples; i++) {
+        int             ir, ig, ib;
+
+        // The input color, and add diffused errors to these.
+        ir = (samples[i] >> 16) & 0xFF;
+        ig = (samples[i] >>  8) & 0xFF;
+        ib = (samples[i]      ) & 0xFF;
+
+        // Find closest color in the yab2pal tables
+        map[i] = (FxU8) txNearestColor(ir, ig, ib, (const FxU32 *)yab2pal, 256);
+    }
+}
+
+void
+txMipNccNNet(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 comp)
+{
+    int         i, w, h;
+    int         ncolors;
+    int         pixsize = (pxMip->format == GR_TEXFMT_YIQ_422) ? 1 : 2;
+    long        yabTable[16+12+12];
+    FxU8        map[256];
+
+
+    /* 
+     * Get a 256 color palette, to be used as samples 
+     * Incidentally, convert src 32 bit image to dst 8 bit indexed image,
+     * with indices referring to the 256 color palette.
+     * Also incidentally, pack the alpha channel if necessary.
+     */
+    if( txVerbose )
+      {
+        printf("NCC Neural nets..."); fflush(stdout);
+      }
+    pxMip->format = (format == GR_TEXFMT_YIQ_422) ? GR_TEXFMT_P_8 : 
+        GR_TEXFMT_AP_88;
+    ncolors = txMipPal256(pxMip, txMip, pxMip->format, 0, 0);
+    if( txVerbose )
+      {
+        printf("%d samples...", ncolors); fflush(stdout);
+      }
+    txMapPal256toYAB((FxU32 *)yabTable, (FxU8 *)map, ncolors, (FxU32 *)pxMip->pal);
+    if( txVerbose )
+      {
+        printf("eMax=(%3d%3d%3d)...eAvg=(%3d%3d%3d)\n", 
+               errG, errR, errB, 
+               totG/ncolors, totR/ncolors, totB/ncolors
+               );
+      }
+
+
+    if ((dither & TX_DITHER_MASK) != TX_DITHER_NONE) {
+        /*
+         * At this point, we can lose the 256 color palette, and replace it with
+         * the 256 color palette generated from the YAB table. This will be 
+         * useful for error diffusion dithering.
+         */
+        txYABtoPal256((long *)pxMip->pal, (long *)yabTable);
+        txDiffuseIndex(pxMip, txMip, pixsize, pxMip->pal, 256);
+    } 
+    else {
+
+        /* Translate image to YAB format */
+        w = txMip->width;
+        h = txMip->height;
+        for (i=0; i< txMip->depth; i++) {
+                int             npixels;
+                FxU8    *src8;
+                FxU16   *src16;
+
+                npixels = w * h;
+
+                if (pixsize == 2) {
+                        src16 = (FxU16 *) pxMip->data[i];
+                        while (npixels--) {
+                                *src16 = (*src16 & 0xFF00) | (map[*src16 & 0x00FF]);
+                                src16++;
+                        }
+                } else {
+                        src8 = (FxU8 *) pxMip->data[i];
+                        while (npixels--) {
+                                *src8 = map[*src8];
+                                src8++;
+                        }
+                }
+                if (w > 1) w >>= 1;
+                if (h > 1) h >>= 1;
+        }
+    }
+
+    /* Copy the YAB table to pal. */
+    pxMip->format = format;
+    for (i=0; i< (16+12+12); i++)
+        pxMip->pal[i] = yabTable[i];
+}
Index: trunk/src/opengl/glide/sst1/texus/pal256.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/pal256.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/pal256.c	(revision 2885)
@@ -0,0 +1,641 @@
+/*
+ * This software is copyrighted as noted below.  It may be freely copied,
+ * modified, and redistributed, provided that the copyright notice is 
+ * preserved on all copies.
+ * 
+ * There is no warranty or other guarantee of fitness for this software,
+ * it is provided solely "as is".  Bug reports or fixes may be sent
+ * to the author, who may or may not act on them as he desires.
+ *
+ * You may not include this software in a program or other software product
+ * without supplying the source, or without informing the end-user that the 
+ * source is available for no extra charge.
+ *
+ * If you modify this software, you should include a notice giving the
+ * name of the person performing the modification, the date of modification,
+ * and the reason for such modification.
+ */
+
+
+/*
+ * Well, I hacked it anyway.... Murali.
+ *
+ * colorquant.c
+ *
+ * Perform variance-based color quantization on a "full color" image.
+ * Author:      Craig Kolb
+ *              Department of Mathematics
+ *              Yale University
+ *              kolb@yale.edu
+ * Date:        Tue Aug 22 1989
+ * Copyright (C) 1989 Craig E. Kolb
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+#include <math.h>
+
+#include "texusint.h"
+
+
+#define USE_INVERSE_PAL
+#define INVERSE_PAL_R_BITS 5
+#define INVERSE_PAL_G_BITS 5
+#define INVERSE_PAL_B_BITS 5
+#define INVERSE_PAL_TOTAL_BITS ( INVERSE_PAL_R_BITS +  \
+                                 INVERSE_PAL_G_BITS +  \
+                                 INVERSE_PAL_B_BITS )
+
+#ifdef USE_INVERSE_PAL
+unsigned char inverse_pal[1<<INVERSE_PAL_TOTAL_BITS];
+#endif
+
+typedef unsigned long   ulong;
+typedef unsigned char   uchar;
+typedef unsigned short  ushort;
+
+#ifdef  HUGE
+#undef  HUGE
+#endif
+
+#define HUGE    1.0e38
+
+#define NBITS   5
+
+#define MAXCOLORS       256
+#define FULLINTENSITY   255
+#define MAX(x,y)        ((x) > (y) ? (x) : (y))
+
+/*
+ * Readability constants.
+ */
+#define REDI            0       
+#define GREENI          1
+#define BLUEI           2       
+#define TRUE            1
+#define FALSE           0
+#define bzero(ptr, sz)  memset(ptr, 0, sz)
+
+typedef struct {
+    float               weightedvar;            /* weighted variance */
+    ulong               mean[3];                        /* centroid */
+    ulong               weight;                         /* # of pixels in box */
+    ulong               freq[3][MAXCOLORS];     /* Projected frequencies */
+    int                 low[3], high[3];        /* Box extent */
+} Box;
+
+#define COLORMAXI ( 1 << NBITS )
+#if 0
+static ulong    *Histogram;             /* image histogram      */
+#else
+static ulong    Histogram[COLORMAXI*COLORMAXI*COLORMAXI * sizeof(long)];
+#endif
+static ulong    SumPixels;              /* total # of pixels    */
+static ulong    ColormaxI;              /* # of colors, 2^Bits */
+static Box              _Boxes[MAXCOLORS];
+static Box              *Boxes;                 /* Array of color boxes. */
+
+static void     SetRGBmap(int boxnum, Box *box, uchar *rgbmap);
+static void     ComputeRGBMap(Box *boxes, int colors, uchar *rgbmap);
+static void     UpdateFrequencies(Box *box1, Box *box2);
+static int      FindCutpoint(Box *box, int color, Box *newbox1, Box *newbox2);
+static int      CutBox(Box *box, Box *newbox);
+static void     BoxStats(Box *box);
+static int      GreatestVariance(Box *boxes, int n);
+static int      CutBoxes(Box *boxes, int colors);
+static void     QuantHistogram(ulong *pixels, int npixels, Box *box);
+
+/*
+ * Perform variance-based color quantization on a 24-bit image.
+ */
+int     
+txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compression)
+{
+    int         w, h;
+    int         i;                              /* Counter */
+    int         OutColors;              /* # of entries computed */
+    int         Colormax;               /* quantized full-intensity */ 
+    float       Cfactor;                /* Conversion factor */
+#if 0
+    uchar       *rgbmap;                /* how to map colors to palette indices */
+#else
+    static uchar rgbmap[(1<<NBITS)*(1<<NBITS)*(1<<NBITS)]; /* how to map colors to palette indices */
+#endif
+    int         pixsize;
+
+
+    ColormaxI = 1 << NBITS;     /* 2 ^ NBITS */
+    Colormax = ColormaxI - 1;
+    Cfactor = (float)FULLINTENSITY / Colormax;
+
+    Boxes = _Boxes;     
+#if 0
+    Histogram = (ulong *) txMalloc(ColormaxI*ColormaxI*ColormaxI * sizeof(long));
+    rgbmap = txMalloc((1<<NBITS)*(1<<NBITS)*(1<<NBITS));
+#endif
+
+    /*
+     * Zero-out the projected frequency arrays of the largest box.
+     */
+    bzero(Boxes->freq[0], ColormaxI * sizeof(ulong));
+    bzero(Boxes->freq[1], ColormaxI * sizeof(ulong));
+    bzero(Boxes->freq[2], ColormaxI * sizeof(ulong));
+    bzero(Histogram, ColormaxI * ColormaxI * ColormaxI * sizeof(long));
+
+    /* Feed all bitmaps & generate histogram */
+    SumPixels = 0;
+    w = txMip->width;
+    h = txMip->height;
+    for (i=0; i< txMip->depth; i++) {
+        SumPixels += w * h;
+        QuantHistogram((ulong *)txMip->data[i], w * h, &Boxes[0]);
+        if (w > 1) w >>= 1;
+        if (h > 1) h >>= 1;
+    }
+
+    OutColors = CutBoxes(Boxes, MAXCOLORS);
+    
+    /*
+     * We now know the set of representative colors.  We now
+     * must fill in the colormap and convert the representatives
+     * from their 'prequantized' range to 0-FULLINTENSITY.
+     */
+    for (i = 0; i < OutColors; i++) {
+        ulong   r, g, b;
+        r = (ulong)(Boxes[i].mean[REDI] * Cfactor + 0.5);
+        g = (ulong)(Boxes[i].mean[GREENI] * Cfactor + 0.5);
+        b = (ulong)(Boxes[i].mean[BLUEI] * Cfactor + 0.5);
+
+        /*
+        r &= 0xff;
+        g &= 0xff;
+        b &= 0xff;
+        */
+        if (r > 255) r = 255;
+        if (g > 255) g = 255;
+        if (b > 255) b = 255;
+
+        pxMip->pal[i] = (r<<16) | (g << 8) | b;
+    }
+    ComputeRGBMap(Boxes, OutColors, rgbmap); 
+
+    /*
+     * Now translate the colors to palette indices.
+     */
+    pixsize = (format == GR_TEXFMT_P_8) ? 1 : 2;
+
+    if ((dither&TX_DITHER_MASK) != TX_DITHER_NONE) {
+        /* support only error diffusion, no 4x4 dithering */
+        txDiffuseIndex(pxMip, txMip, pixsize, pxMip->pal, OutColors);
+    } else {
+
+        w = txMip->width;
+        h = txMip->height;
+
+        for (i=0; i< txMip->depth; i++) {
+                ulong   *src;
+                uchar   *dst;
+                int             n;
+
+                src = (ulong *) txMip->data[i];
+                dst = (uchar *) pxMip->data[i];
+                n   = w * h;
+                while (n--) {
+                        int     r, g, b, argb, index;
+
+                        argb = *src++;
+                        r = (argb & 0x00FF0000) >> (16 + 8 - NBITS);
+                        g = (argb & 0x0000FF00) >> ( 8 + 8 - NBITS);
+                        b = (argb & 0x000000FF) >> ( 0 + 8 - NBITS);
+
+                        index = (r << (NBITS+NBITS)) | (g << NBITS) | b;
+                        if ((index < 0) || (index >= 32768)) {
+                                printf("Bad index: %d (%d %d %d)\n", index, r, g, b);
+                        }
+                        if (pixsize == 1) {
+                                *dst++ = rgbmap[index];
+                        } else {
+                                *(FxU16 *)dst = (rgbmap[index]) | 
+                                                ((argb >> 16) & 0xFF00);
+                                dst+= 2;
+                        }
+                }
+                if (w > 1) w >>= 1;
+                if (h > 1) h >>= 1;
+        }
+    }
+
+#if 0
+    txFree((char *)Histogram);
+    txFree((char *)rgbmap);
+#endif
+    return OutColors;
+}
+
+/*
+ * Compute the histogram of the image as well as the projected frequency
+ * arrays for the first world-encompassing box.
+ */
+static void
+QuantHistogram(ulong *pixels, int npixels, Box *box)
+{
+    ulong *rf, *gf, *bf;
+    uchar rr, gg, bb;
+    int         i;
+
+    rf = box->freq[0];
+    gf = box->freq[1];
+    bf = box->freq[2];
+
+    /*
+     * We compute both the histogram and the proj. frequencies of
+     * the first box at the same time to save a pass through the
+     * entire image. 
+     */
+    
+    for (i = 0; i < npixels; i++) {
+        rr = (uchar) (((*pixels >> 16) & 0xff) >> (8-NBITS));
+        gg = (uchar) (((*pixels >>  8) & 0xff) >> (8-NBITS));
+        bb = (uchar) (((*pixels      ) & 0xff) >> (8-NBITS));
+        pixels++;
+        rf[rr]++;
+        gf[gg]++;
+        bf[bb]++;
+        Histogram[(((rr<<NBITS)|gg)<<NBITS)|bb]++;
+    }
+        
+}
+
+/*
+ * Interatively cut the boxes.
+ */
+static int
+CutBoxes(Box *boxes, int colors) 
+{
+    int curbox;
+
+    boxes[0].low[REDI] = boxes[0].low[GREENI] = boxes[0].low[BLUEI] = 0;
+    boxes[0].high[REDI] = boxes[0].high[GREENI] =
+                      boxes[0].high[BLUEI] = ColormaxI;
+    boxes[0].weight = SumPixels;
+
+    BoxStats(&boxes[0]);
+
+    for (curbox = 1; curbox < colors; curbox++) {
+        if (CutBox(&boxes[GreatestVariance(boxes, curbox)],
+                   &boxes[curbox]) == FALSE)
+                        break;
+    }
+
+    return curbox;
+}
+
+/*
+ * Return the number of the box in 'boxes' with the greatest variance.
+ * Restrict the search to those boxes with indices between 0 and n-1.
+ */
+static int
+GreatestVariance(Box *boxes, int n)
+{
+    int i, whichbox = 0;
+    float max;
+
+    max = -1.0f;
+    for (i = 0; i < n; i++) {
+        if (boxes[i].weightedvar > max) {
+                max = (float) boxes[i].weightedvar;
+                whichbox = i;
+        }
+    }
+    return whichbox;
+}
+
+/*
+ * Compute mean and weighted variance of the given box.
+ */
+static void
+BoxStats(Box *box)
+{
+    int i, color;
+    ulong *freq;
+    float mean, var;
+
+    if(box->weight == 0) {
+        box->weightedvar = (float) 0.0;
+        return;
+    }
+
+    box->weightedvar = (float) 0.0;
+    for (color = 0; color < 3; color++) {
+        var = mean = (float) 0.0;
+        i = box->low[color];
+        freq = &box->freq[color][i];
+        for (; i < box->high[color]; i++, freq++) {
+                mean += (float) i * *freq;
+                var += (float) i*i* *freq;
+        }
+        box->mean[color] = (unsigned long) (mean / (float)box->weight);
+        box->weightedvar += var - box->mean[color]*box->mean[color]*
+                                (float)box->weight;
+    }
+    box->weightedvar /= SumPixels;
+}
+
+/*
+ * Cut the given box.  Returns TRUE if the box could be cut, FALSE otherwise.
+ */
+static int
+CutBox(Box *box, Box *newbox)
+{
+    int i;
+    float totalvar[3];
+    Box newboxes[3][2];
+
+    if (box->weightedvar == 0. || box->weight == 0)
+        /*
+         * Can't cut this box.
+         */
+        return FALSE;
+
+    /*
+     * Find 'optimal' cutpoint along each of the red, green and blue
+     * axes.  Sum the variances of the two boxes which would result
+     * by making each cut and store the resultant boxes for 
+     * (possible) later use.
+     */
+    for (i = 0; i < 3; i++) {
+        if (FindCutpoint(box, i, &newboxes[i][0], &newboxes[i][1]))
+                totalvar[i] = newboxes[i][0].weightedvar +
+                        newboxes[i][1].weightedvar;
+        else
+                totalvar[i] = (float) HUGE;
+    }
+
+    /*
+     * Find which of the three cuts minimized the total variance
+     * and make that the 'real' cut.
+     */
+    if (totalvar[REDI] <= totalvar[GREENI] &&
+        totalvar[REDI] <= totalvar[BLUEI]) {
+        *box = newboxes[REDI][0];
+        *newbox = newboxes[REDI][1];
+    } else if (totalvar[GREENI] <= totalvar[REDI] &&
+         totalvar[GREENI] <= totalvar[BLUEI]) {
+        *box = newboxes[GREENI][0];
+        *newbox = newboxes[GREENI][1];
+    } else {
+        *box = newboxes[BLUEI][0];
+        *newbox = newboxes[BLUEI][1];
+
+    }
+
+    return TRUE;
+}
+
+/*
+ * Compute the 'optimal' cutpoint for the given box along the axis
+ * indcated by 'color'.  Store the boxes which result from the cut
+ * in newbox1 and newbox2.
+ */
+static int
+FindCutpoint(Box *box, int color, Box *newbox1, Box *newbox2)
+{
+    float u, v, max;
+    int i, maxindex, minindex, cutpoint;
+    ulong optweight, curweight;
+
+    if (box->low[color] + 1 == box->high[color])
+        return FALSE;   /* Cannot be cut. */
+    minindex = (int)((box->low[color] + box->mean[color]) * 0.5);
+    maxindex = (int)((box->mean[color] + box->high[color]) * 0.5);
+
+    cutpoint = minindex;
+    optweight = box->weight;
+
+    curweight = 0;
+    for (i = box->low[color] ; i < minindex ; i++)
+        curweight += box->freq[color][i];
+    u = 0.0f;
+    max = -1.0f;
+    for (i = minindex; i <= maxindex ; i++) {
+        curweight += box->freq[color][i];
+        if (curweight == box->weight)
+                break;
+        u += (float)(i * box->freq[color][i]) /
+                                (float)box->weight;
+        v = ((float)curweight / (float)(box->weight-curweight)) *
+                        (box->mean[color]-u)*(box->mean[color]-u);
+        if (v > max) {
+                max = v;
+                cutpoint = i;
+                optweight = curweight;
+        }
+    }
+    cutpoint++;
+    *newbox1 = *newbox2 = *box;
+    newbox1->weight = optweight;
+    newbox2->weight -= optweight;
+    newbox1->high[color] = cutpoint;
+    newbox2->low[color] = cutpoint;
+    UpdateFrequencies(newbox1, newbox2);
+    BoxStats(newbox1);
+    BoxStats(newbox2);
+
+    return TRUE;        /* Found cutpoint. */
+}
+
+/*
+ * Update projected frequency arrays for two boxes which used to be
+ * a single box.
+ */
+
+static void
+UpdateFrequencies(Box *box1, Box *box2)
+{
+    ulong myfreq, *h;
+    int b, g, r;
+    int roff;
+
+    bzero(box1->freq[0], ColormaxI * sizeof(ulong));
+    bzero(box1->freq[1], ColormaxI * sizeof(ulong));
+    bzero(box1->freq[2], ColormaxI * sizeof(ulong)); 
+
+    for (r = box1->low[0]; r < box1->high[0]; r++) {
+        roff = r << NBITS;
+        for (g = box1->low[1];g < box1->high[1]; g++) {
+                b = box1->low[2];
+                h = Histogram + (((roff | g) << NBITS) | b);
+                for (; b < box1->high[2]; b++) {
+                        if ((myfreq = *h++) == 0)
+                                continue;
+                        box1->freq[0][r] += myfreq;
+                        box1->freq[1][g] += myfreq;
+                        box1->freq[2][b] += myfreq;
+                        box2->freq[0][r] -= myfreq;
+                        box2->freq[1][g] -= myfreq;
+                        box2->freq[2][b] -= myfreq;
+                }
+        }
+    }
+}
+
+/*
+ * Compute RGB to colormap index map.
+ */
+
+static void
+ComputeRGBMap(Box *boxes, int colors, uchar *rgbmap)
+{
+    int i;
+
+    /*
+     * The centroid of each box serves as the representative
+     * for each color in the box.
+     */
+    for (i = 0; i < colors; i++)
+        SetRGBmap(i, &boxes[i], rgbmap);
+}
+
+/*
+ * Make the centroid of "boxnum" serve as the representative for
+ * each color in the box.
+ */
+static void
+SetRGBmap(int boxnum, Box *box, uchar *rgbmap)
+{
+    int r, g, b;
+    
+    for (r = box->low[REDI]; r < box->high[REDI]; r++) {
+        for (g = box->low[GREENI]; g < box->high[GREENI]; g++) {
+                for (b = box->low[BLUEI]; b < box->high[BLUEI]; b++) {
+                        int     index;
+                        
+                        index = (((r<<NBITS)|g)<<NBITS)|b;
+                        rgbmap[index]=(char)boxnum;
+                }
+        }
+    }
+}
+
+/* ---------------------------------------------------------------------- */
+
+unsigned char _txPixTrueToFixedPal( void *pix, const FxU32 *pal )
+{
+  int i;
+  long min_dist;
+  int min_index;
+  long r, g, b;
+  
+  min_dist = 256 * 256 + 256 * 256 + 256 * 256;
+  min_index = -1;
+  /* 0 1 2 */
+  r = ( long )( ( unsigned char * )pix )[2];
+  g = ( long )( ( unsigned char * )pix )[1];
+  b = ( long )( ( unsigned char * )pix )[0];
+
+  for( i = 0; i < 256; i++ )
+    {
+      long palr, palg, palb, dist;
+      long dr, dg, db;
+
+      palr = ( long )( ( pal[i] & 0x00ff0000 ) >> 16 );
+      palg = ( long )( ( pal[i] & 0x0000ff00 ) >> 8 );
+      palb = ( long )( pal[i] & 0x000000ff );
+      dr = palr - r;
+      dg = palg - g;
+      db = palb - b;
+      dist = dr * dr + dg * dg + db * db;
+      if( dist < min_dist )
+        {
+          min_dist = dist;
+          min_index = i;
+        }
+    }
+
+  if( min_index < 0 )
+    txPanic( "_txPixTrueToFixedPal: this shouldn't happen\n" );
+
+  //  printf( "%d\n", ( max_index ) );
+  return ( unsigned char )min_index;
+}
+
+void _txImgTrueToFixedPal( unsigned char *dst, unsigned char *src, const FxU32 *pal,
+                           int w, int h, FxU32 flags )
+{
+  long i;
+
+  for( i = 0; i < w * h; i++ )
+    {
+      if( flags == TX_FIXED_PAL_QUANT_TABLE )
+        {
+          unsigned long index;
+          unsigned long r_index, g_index, b_index;
+          
+          r_index = ( ( ( unsigned long )src[i*4+2] ) >> ( 8 - INVERSE_PAL_R_BITS ) );
+          g_index = ( ( ( unsigned long )src[i*4+1] ) >> ( 8 - INVERSE_PAL_G_BITS ) );
+          b_index = ( ( ( unsigned long )src[i*4+0] ) >> ( 8 - INVERSE_PAL_B_BITS ) );
+          index = 
+            ( r_index << ( INVERSE_PAL_G_BITS + INVERSE_PAL_B_BITS ) ) |
+            ( g_index << INVERSE_PAL_B_BITS ) |
+            b_index;
+          dst[i] = inverse_pal[index];
+        }
+      else
+        {
+          dst[i] = _txPixTrueToFixedPal( &src[i*4], pal );
+        }
+    }
+}
+
+void _CreateInversePal( const FxU32 *pal )
+{
+  long r, g, b;
+  long index = 0;
+  unsigned char true_color[4];
+
+  true_color[3] = 0;
+  for( r = 0; r < ( 1 << INVERSE_PAL_R_BITS ); r++ )
+    for( g = 0; g < ( 1 << INVERSE_PAL_G_BITS ); g++ )
+      for( b = 0; b < ( 1 << INVERSE_PAL_B_BITS ); b++ )
+        {
+          true_color[2] = ( unsigned char )( r << ( 8 - INVERSE_PAL_R_BITS ) );
+          true_color[1] = ( unsigned char )( g << ( 8 - INVERSE_PAL_G_BITS ) );
+          true_color[0] = ( unsigned char )( b << ( 8 - INVERSE_PAL_B_BITS ) );
+          inverse_pal[index] = _txPixTrueToFixedPal( ( void * )true_color, pal );
+          index++;
+        }
+}
+
+/*
+ * Convert an image from true color to a predefined palette.
+ */
+void txMipTrueToFixedPal( TxMip *outputMip, TxMip *trueColorMip, const FxU32 *pal,
+                          FxU32 flags )
+{
+  int             i, w, h;
+  static          FxU32 last_pal[256];
+  static          FxBool been_here = FXFALSE;
+  
+  w = outputMip->width;
+  h = outputMip->height;
+
+  if( flags == TX_FIXED_PAL_QUANT_TABLE )
+    {
+      if( !been_here || ( memcmp( last_pal, pal, sizeof( FxU32 ) * 256 ) != 0 ) )
+        {
+          memcpy( last_pal, pal, sizeof( FxU32 ) * 256 );
+          _CreateInversePal( pal );
+          been_here = FXTRUE;
+        }
+    }
+
+  for( i = 0; i < trueColorMip->depth; i++ ) 
+    {
+      _txImgTrueToFixedPal( outputMip->data[i], trueColorMip->data[i], pal,
+                            w, h, flags );
+      if (w > 1) w >>= 1;
+      if (h > 1) h >>= 1;
+    }
+}
Index: trunk/src/opengl/glide/sst1/texus/ppm.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/ppm.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/ppm.c	(revision 2885)
@@ -0,0 +1,118 @@
+
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:38 $
+**
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+
+FxBool 
+_txReadPPMHeader( FILE *stream, FxU32 cookie, TxMip *info)
+{ 
+    char buffer[256];
+    FxU32 state = 1;
+    FxBool done = FXFALSE;
+    
+    if ( stream == NULL ) {
+	txPanic("PPM file: Bad file handle.");
+	return FXFALSE;
+    }
+    
+    while( !done && fgets( buffer, 256, stream ) ) {
+	char *token;
+	
+	if ( buffer[0] == '#' ) continue;
+	for (token = strtok( buffer, " \t\n\r" ); token != NULL;
+			token = strtok( NULL, " \t\n\r" )) {
+	    switch( state ) {
+	    case 1:	// Width
+			info->width = atoi( token );
+			state++;
+			break;
+
+	    case 2:	// height
+			info->height = atoi( token );
+			state++;
+			break;
+
+	    case 3:	// Color Depth
+			info->format = atoi( token );
+			if ( info->format != 255 ) {
+			    txPanic("Unsupported PPM format: max != 255\n");
+		    	    return FXFALSE;
+			}
+			state++;
+			done = FXTRUE;
+			break;
+
+	    default:
+			txPanic("PPM file: parse error\n");
+			return FXFALSE;
+			break;
+	    }
+	}
+    }
+    
+    if ( state < 4 ) {
+    	txPanic("PPM file: Read error before end of header.");
+	return FXFALSE;
+    }
+    info->depth = 1;
+    info->format = GR_TEXFMT_ARGB_8888;
+    info->size = info->width * info->height * 4;
+    return FXTRUE;
+}
+
+FxBool 
+_txReadPPMData( FILE *stream, TxMip *info) 
+{ 
+    FxU32 numPixels;
+    FxU32 *data32 = info->data[0];
+    
+    numPixels = info->width * info->height;
+
+    if ( stream == NULL ) {
+	txPanic("PPM file: Bad file handle.");
+	return FXFALSE;
+    }
+    
+    // Read in image data
+    while (numPixels--) {
+	int r, g, b;
+
+	r = getc( stream );
+	g = getc( stream );
+	b = getc( stream );
+	if ( b == EOF ) {
+	    txPanic("PPM file: Unexpected End of File.");
+	    return FXFALSE;
+	}
+	*data32++ = (0xFF << 24) | (r << 16) | (g << 8) | b;
+    }
+    return FXTRUE;
+}
Index: trunk/src/opengl/glide/sst1/texus/quantize.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/quantize.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/quantize.c	(revision 2885)
@@ -0,0 +1,686 @@
+
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:38 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+static int 
+dithmat[4][4] = {       0,  8,  2, 10, 
+                           12,  4, 14,  6, 
+                            3, 11,  1,  9, 
+                           15,  7, 13,  5 };
+
+// for error diffusion.
+static int      errR[MAX_TEXWIDTH], errG[MAX_TEXWIDTH], errB[MAX_TEXWIDTH];     
+
+static int
+_txPixQuantize_RGB332( unsigned long argb, int x, int y, int w)
+{
+    return (
+                        (((argb>>16) & 0xE0) |
+                         ((argb>>11) & 0x1C) |
+                         ((argb>> 6) & 0x03) )          );
+}
+
+static int
+_txPixQuantize_RGB332_D4x4( unsigned long argb, int x, int y, int w)
+{
+    int d = dithmat[y&3][x&3];
+    int n, t;
+
+    n = (int) (((argb >> 16) & 0xFF) * 0x70/255.0f + 0.5f) + d; 
+    t = (n>>4)<<5;
+    n = (int) (((argb >>  8) & 0xFF) * 0x70/255.0f + 0.5f) + d; 
+    t |= (n>>4)<<2;
+    n = (int) (((argb      ) & 0xFF) * 0x30/255.0f + 0.5f) + d; 
+    t |= (n>>4)<<0;
+    return t & 0xFF;
+}
+
+static int
+_txPixQuantize_RGB332_DErr( unsigned long argb, int x, int y, int w)
+{
+    static unsigned char a3[] = {0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff};
+    static unsigned char a2[] = {0x00,0x55,0xaa,0xff};
+    static int          qr, qg, qb;             // quantized incoming values.
+    int                         ir, ig, ib;             // incoming values.
+    int                         t;
+
+    ir = (argb >> 16) & 0xFF;   // incoming pixel values.
+    ig = (argb >>  8) & 0xFF;
+    ib = (argb      ) & 0xFF;
+
+    if (x == 0) qr = qg = qb = 0;
+
+    ir += errR[x] + qr;
+    ig += errG[x] + qg;
+    ib += errB[x] + qb;
+
+    qr = ir;            // quantized pixel values. 
+    qg = ig;            // qR is error from pixel to left, errR is
+    qb = ib;            // error from pixel to the top & top left.
+
+    if (qr < 0) qr = 0; if (qr > 255) qr = 255;         // clamp.
+    if (qg < 0) qg = 0; if (qg > 255) qg = 255;
+    if (qb < 0) qb = 0; if (qb > 255) qb = 255;
+
+    // To RGB332.
+    qr = (int) (qr * 0x7ff/255.0f);     qr >>= 8;
+    qg = (int) (qg * 0x7ff/255.0f);     qg >>= 8;
+    qb = (int) (qb * 0x3ff/255.0f);     qb >>= 8;
+
+    t  = (qr << 5) | (qg << 2) | qb;    // this is the value to be returned.
+
+    // Now dequantize the input, and compute & distribute the errors.
+    qr = a3[qr];        qr = ir - qr;
+    qg = a3[qg];        qg = ig - qg;
+    qb = a2[qb];        qb = ib - qb;
+
+    // 3/8 (=0.375) to the EAST, 3/8 to the SOUTH, 1/4 (0.25) to the SOUTH-EAST.
+    errR[x]  = ((x == 0) ? 0 : errR[x]) + ((int) (qr * 0.375f));
+    errG[x]  = ((x == 0) ? 0 : errG[x]) + ((int) (qg * 0.375f));
+    errB[x]  = ((x == 0) ? 0 : errB[x]) + ((int) (qb * 0.375f));
+
+    errR[x+1] = (int) (qr * 0.250f);
+    errG[x+1] = (int) (qg * 0.250f);
+    errB[x+1] = (int) (qb * 0.250f);
+
+    qr = (int) (qr * 0.375f);           // Carried to the pixel on the right.
+    qg = (int) (qg * 0.375f);
+    qb = (int) (qb * 0.375f);
+
+    return t & 0xFF;
+}
+
+/* YIQ422 done elsewhere */
+
+static int
+_txPixQuantize_A8( unsigned long argb, int x, int y, int w)
+{
+    return (argb >> 24);
+}
+
+static int
+_txPixQuantize_I8( unsigned long argb, int x, int y, int w)
+{
+    return (
+    ((int) (((argb >>16) & 0xFF) * .30F +
+                ((argb >> 8) & 0xFF) * .59F +
+                ((argb     ) & 0xFF) * .11F + 0.5f )) & 0xFF);
+}
+
+static int
+_txPixQuantize_AI44( unsigned long argb, int x, int y, int w)
+{
+    return(
+        (int)   ((      ((argb>>16) & 0xFF) * .30F +
+                                ((argb>> 8) & 0xFF) * .59F +
+                                ((argb    ) & 0xFF) * .11F + 0.5f ) * 0.0625f) |
+        (int)           ((argb>>24) & 0xF0));
+}
+
+static int
+_txPixQuantize_AI44_D4x4( unsigned long argb, int x, int y, int w)
+{
+    int d = dithmat[y&3][x&3];
+    int n, t;
+
+    /* Don't dither alpha channel */
+    n = (int)   (       ((argb>>16) & 0xFF) * .30F +
+                                ((argb>> 8) & 0xFF) * .59F +
+                                ((argb    ) & 0xFF) * .11F + 0.5f);
+
+
+    n = (int) (n * 0xF0/255.0f + 0.5f) + d;     
+    t = (n>>4);
+    t |= (int)  ((argb>>24) & 0xF0);
+    return t & 0xFF;
+}
+
+static int
+_txPixQuantize_AI44_DErr( unsigned long argb, int x, int y, int w)
+{
+    int ii, t;
+    static      int     qi;
+
+    /* Don't dither alpha channel */
+    ii = (int)  (       ((argb>>16) & 0xFF) * .30F +
+                                ((argb>> 8) & 0xFF) * .59F +
+                                ((argb    ) & 0xFF) * .11F + 0.5f);
+
+
+    if (x == 0) qi = 0;
+    ii += errR[x] + qi;
+    qi = ii;
+    if (qi < 0) qi = 0; if (qi > 255) qi = 255;         // clamp.
+    qi = (int) (qi * 0xfff/255.0f);     qi >>= 8;
+
+    t = qi;
+    t |= (int)  ((argb>>24) & 0xF0);
+
+
+    // Now dequantize the input, and compute & distribute the errors.
+    qi = (qi << 4) | qi;
+    qi = ii - qi;
+
+    // 3/8 (=0.375) to the EAST, 3/8 to the SOUTH, 1/4 (0.25) to the SOUTH-EAST.
+    errR[x]  = ((x == 0) ? 0 : errR[x]) + ((int) (qi * 0.375f));
+    errR[x+1] = (int) (qi * 0.250f);
+    qi = (int) (qi * 0.375f);           // Carried to the pixel on the right.
+
+    return t & 0xFF;
+}
+
+
+static int
+_txPixQuantize_ARGB8332 ( unsigned long argb, int x, int y, int w)
+{
+    return (
+                         ((argb>>16) & 0xE0) |
+                         ((argb>>11) & 0x1C) |
+                         ((argb>> 6) & 0x03) |
+                         ((argb>>16) & 0xFF00)          );
+}
+
+
+static int
+_txPixQuantize_ARGB8332_D4x4( unsigned long argb, int x, int y, int w)
+{
+    int d = dithmat[y&3][x&3];
+    int n, t;
+
+    n = (int) (((argb >> 16) & 0xFF) * 0x70/255.0f + 0.5f) + d; 
+    t = (n>>4)<<5;
+    n = (int) (((argb >>  8) & 0xFF) * 0x70/255.0f + 0.5f) + d; 
+    t |= (n>>4)<<2;
+    n = (int) (((argb      ) & 0xFF) * 0x30/255.0f + 0.5f) + d; 
+    t |= (n>>4)<<0;
+    t |= ((argb >> 16) & 0xFF00);
+    return t & 0xFFFF;
+}
+
+static int
+_txPixQuantize_ARGB8332_DErr( unsigned long argb, int x, int y, int w)
+{
+    int t;
+
+    t = _txPixQuantize_RGB332_DErr(argb, x, y, w);
+    t |= ((argb >> 16) & 0xFF00);
+    return t & 0xFFFF;
+}
+
+/* AYIQ8422 done elsewhere */
+
+static int
+_txPixQuantize_RGB565( unsigned long argb, int x, int y, int w)
+{
+    return (
+                    ((argb >> 8) & 0xF800) |
+                        ((argb >> 5) & 0x07E0) |
+                        ((argb >> 3) & 0x001F)          );
+}
+
+static int
+_txPixQuantize_RGB565_D4x4 ( unsigned long argb, int x, int y, int w)
+{
+    int d = dithmat[y&3][x&3];
+    int n, t;
+
+    n = (int) (((argb >> 16) & 0xFF) * 0x1F0/255.0f + 0.5f) + d;        
+    t = (n>>4)<<11;
+    n = (int) (((argb >>  8) & 0xFF) * 0x3F0/255.0f + 0.5f) + d;        
+    t |= (n>>4)<<5;
+    n = (int) (((argb      ) & 0xFF) * 0x1F0/255.0f + 0.5f) + d;        
+    t |= (n>>4)<<0;
+    return t & 0xFFFF;
+}
+
+
+static int
+_txPixQuantize_RGB565_DErr ( unsigned long argb, int x, int y, int w)
+{
+    static int          qr, qg, qb;             // quantized incoming values.
+    int                         ir, ig, ib;             // incoming values.
+    int                         t;
+
+    ir = (argb >> 16) & 0xFF;   // incoming pixel values.
+    ig = (argb >>  8) & 0xFF;
+    ib = (argb      ) & 0xFF;
+
+    if (x == 0) qr = qg = qb = 0;
+
+    ir += errR[x] + qr;
+    ig += errG[x] + qg;
+    ib += errB[x] + qb;
+
+    qr = ir;            // quantized pixel values. 
+    qg = ig;            // qR is error from pixel to left, errR is
+    qb = ib;            // error from pixel to the top & top left.
+
+    if (qr < 0) qr = 0; if (qr > 255) qr = 255;         // clamp.
+    if (qg < 0) qg = 0; if (qg > 255) qg = 255;
+    if (qb < 0) qb = 0; if (qb > 255) qb = 255;
+
+    // To RGB565.
+    qr = (int) (qr * 0x1FFF/255.0f);    qr >>= 8;
+    qg = (int) (qg * 0x3FFF/255.0f);    qg >>= 8;
+    qb = (int) (qb * 0x1FFF/255.0f);    qb >>= 8;
+
+    t  = (qr << 11) | (qg << 5) | qb;   // this is the value to be returned.
+
+    // Now dequantize the input, and compute & distribute the errors.
+    qr = (qr << 3) | (qr >> 2);
+    qg = (qg << 2) | (qg >> 4);
+    qb = (qb << 3) | (qb >> 2);
+    qr = ir - qr;
+    qg = ig - qg;
+    qb = ib - qb;
+
+    // 3/8 (=0.375) to the EAST, 3/8 to the SOUTH, 1/4 (0.25) to the SOUTH-EAST.
+    errR[x]  = ((x == 0) ? 0 : errR[x]) + ((int) (qr * 0.375f));
+    errG[x]  = ((x == 0) ? 0 : errG[x]) + ((int) (qg * 0.375f));
+    errB[x]  = ((x == 0) ? 0 : errB[x]) + ((int) (qb * 0.375f));
+
+    errR[x+1] = (int) (qr * 0.250f);
+    errG[x+1] = (int) (qg * 0.250f);
+    errB[x+1] = (int) (qb * 0.250f);
+
+    qr = (int) (qr * 0.375f);           // Carried to the pixel on the right.
+    qg = (int) (qg * 0.375f);
+    qb = (int) (qb * 0.375f);
+
+    return t & 0xFFFF;
+}
+
+static int
+_txPixQuantize_ARGB1555( unsigned long argb, int x, int y, int w)
+{
+    return (
+                    ((argb >> 9) & 0x7C00) |
+                        ((argb >> 6) & 0x03E0) |
+                        ((argb >> 3) & 0x001F) |        
+                        ((argb >> 24) ? 0x8000 : 0)     );
+}
+
+static int
+_txPixQuantize_ARGB1555_D4x4 ( unsigned long argb, int x, int y, int w)
+{
+    int d = dithmat[y&3][x&3];
+    int n, t;
+
+    n = (int) (((argb >> 16) & 0xFF) * 0x1F0/255.0f + 0.5f) + d;        
+    t = (n>>4)<<10;
+    n = (int) (((argb >>  8) & 0xFF) * 0x1F0/255.0f + 0.5f) + d;        
+    t |= (n>>4)<<5;
+    n = (int) (((argb      ) & 0xFF) * 0x1F0/255.0f + 0.5f) + d;        
+    t |= (n>>4)<<0;
+    t |= ((argb >> 24) ? 0x8000 : 0);
+    return t & 0xFFFF;
+}
+
+static int
+_txPixQuantize_ARGB1555_DErr ( unsigned long argb, int x, int y, int w)
+{
+    static int          qr, qg, qb;             // quantized incoming values.
+    int                         ir, ig, ib;             // incoming values.
+    int                         t;
+
+    ir = (argb >> 16) & 0xFF;   // incoming pixel values.
+    ig = (argb >>  8) & 0xFF;
+    ib = (argb      ) & 0xFF;
+
+    if (x == 0) qr = qg = qb = 0;
+
+    ir += errR[x] + qr;
+    ig += errG[x] + qg;
+    ib += errB[x] + qb;
+
+    qr = ir;            // quantized pixel values. 
+    qg = ig;            // qR is error from pixel to left, errR is
+    qb = ib;            // error from pixel to the top & top left.
+
+    if (qr < 0) qr = 0; if (qr > 255) qr = 255;         // clamp.
+    if (qg < 0) qg = 0; if (qg > 255) qg = 255;
+    if (qb < 0) qb = 0; if (qb > 255) qb = 255;
+
+    // To RGB565.
+    qr = (int) (qr * 0x1FFF/255.0f);    qr >>= 8;
+    qg = (int) (qg * 0x1FFF/255.0f);    qg >>= 8;
+    qb = (int) (qb * 0x1FFF/255.0f);    qb >>= 8;
+
+    t  = (qr << 10) | (qg << 5) | qb;   // this is the value to be returned.
+    t |= ((argb >> 24) ? 0x8000 : 0);
+
+    // Now dequantize the input, and compute & distribute the errors.
+    qr = (qr << 3) | (qr >> 2);
+    qg = (qg << 3) | (qg >> 2);
+    qb = (qb << 3) | (qb >> 2);
+    qr = ir - qr;
+    qg = ig - qg;
+    qb = ib - qb;
+
+    // 3/8 (=0.375) to the EAST, 3/8 to the SOUTH, 1/4 (0.25) to the SOUTH-EAST.
+    errR[x]  = ((x == 0) ? 0 : errR[x]) + ((int) (qr * 0.375f));
+    errG[x]  = ((x == 0) ? 0 : errG[x]) + ((int) (qg * 0.375f));
+    errB[x]  = ((x == 0) ? 0 : errB[x]) + ((int) (qb * 0.375f));
+
+    errR[x+1] = (int) (qr * 0.250f);
+    errG[x+1] = (int) (qg * 0.250f);
+    errB[x+1] = (int) (qb * 0.250f);
+
+    qr = (int) (qr * 0.375f);           // Carried to the pixel on the right.
+    qg = (int) (qg * 0.375f);
+    qb = (int) (qb * 0.375f);
+
+    return t & 0xFFFF;
+}
+
+static int
+_txPixQuantize_ARGB4444 (unsigned long argb, int x, int y, int w)
+{
+    return (
+                    ((argb >> 12) & 0x0F00) |
+                        ((argb >>  8) & 0x00F0) |
+                        ((argb >>  4) & 0x000F) |       
+                        ((argb >> 16) & 0xF000) );
+}
+
+static int
+_txPixQuantize_ARGB4444_D4x4 (unsigned long argb, int x, int y, int w)
+{
+    int d = dithmat[y&3][x&3];
+    int n, t;
+
+    n = (int) (((argb >> 16) & 0xFF) * 0xF0/255.0f + 0.5f) + d; 
+    t = (n>>4)<<8;
+    n = (int) (((argb >>  8) & 0xFF) * 0xF0/255.0f + 0.5f) + d; 
+    t |= (n>>4)<<4;
+    n = (int) (((argb      ) & 0xFF) * 0xF0/255.0f + 0.5f) + d; 
+    t |= (n>>4)<<0;
+    t |= (argb >> 16) & 0xF000;
+    return t & 0xFFFF;
+}
+
+static int
+_txPixQuantize_ARGB4444_DErr (unsigned long argb, int x, int y, int w)
+{
+    static int          qr, qg, qb;             // quantized incoming values.
+    int                         ir, ig, ib;             // incoming values.
+    int                         t;
+
+    ir = (argb >> 16) & 0xFF;   // incoming pixel values.
+    ig = (argb >>  8) & 0xFF;
+    ib = (argb      ) & 0xFF;
+
+    if (x == 0) qr = qg = qb = 0;
+
+    ir += errR[x] + qr;
+    ig += errG[x] + qg;
+    ib += errB[x] + qb;
+
+    qr = ir;            // quantized pixel values. 
+    qg = ig;            // qR is error from pixel to left, errR is
+    qb = ib;            // error from pixel to the top & top left.
+
+    if (qr < 0) qr = 0; if (qr > 255) qr = 255;         // clamp.
+    if (qg < 0) qg = 0; if (qg > 255) qg = 255;
+    if (qb < 0) qb = 0; if (qb > 255) qb = 255;
+
+    // To RGB565.
+    qr = (int) (qr * 0xFFF/255.0f);     qr >>= 8;
+    qg = (int) (qg * 0xFFF/255.0f);     qg >>= 8;
+    qb = (int) (qb * 0xFFF/255.0f);     qb >>= 8;
+
+    t  = (qr <<  8) | (qg << 4) | qb;   // this is the value to be returned.
+    t |= (argb >> 16) & 0xF000;
+
+    // Now dequantize the input, and compute & distribute the errors.
+    qr = (qr << 4) | (qr >> 0);
+    qg = (qg << 4) | (qg >> 0);
+    qb = (qb << 4) | (qb >> 0);
+    qr = ir - qr;
+    qg = ig - qg;
+    qb = ib - qb;
+
+    // 3/8 (=0.375) to the EAST, 3/8 to the SOUTH, 1/4 (0.25) to the SOUTH-EAST.
+    errR[x]  = ((x == 0) ? 0 : errR[x]) + ((int) (qr * 0.375f));
+    errG[x]  = ((x == 0) ? 0 : errG[x]) + ((int) (qg * 0.375f));
+    errB[x]  = ((x == 0) ? 0 : errB[x]) + ((int) (qb * 0.375f));
+
+    errR[x+1] = (int) (qr * 0.250f);
+    errG[x+1] = (int) (qg * 0.250f);
+    errB[x+1] = (int) (qb * 0.250f);
+
+    qr = (int) (qr * 0.375f);           // Carried to the pixel on the right.
+    qg = (int) (qg * 0.375f);
+    qb = (int) (qb * 0.375f);
+
+    return t & 0xFFFF;
+}
+
+static int
+_txPixQuantize_AI88( unsigned long argb, int x, int y, int w)
+{
+    return (
+    (((int) (((argb >>16) & 0xFF) * .30F +
+                ((argb >> 8) & 0xFF) * .59F +
+                ((argb     ) & 0xFF) * .11F + 0.5f )) & 0xFF) |
+
+                ((argb >>16) & 0xFF00)                  );
+}
+
+
+static void
+_txImgQuantize(char *dst, char *src, int w, int h, FxU32 format, FxU32 dither)
+{
+    int (*quantizer)(unsigned long argb, int x, int y, int w);
+    int         x, y;
+
+    dither &= TX_DITHER_MASK;
+
+    if (dither == TX_DITHER_ERR) { // Error diffusion, floyd-steinberg
+        int             i;
+
+        // Clear error diffusion accumulators.
+        for (i=0; i<w; i++) errR[i] = errG[i] = errB[i] = 0;
+
+        switch(format) {
+        case GR_TEXFMT_RGB_332:         quantizer = _txPixQuantize_RGB332_DErr; 
+                                                                break;
+        case GR_TEXFMT_A_8:                     quantizer = _txPixQuantize_A8;                  
+                                                                break;
+        case GR_TEXFMT_I_8:                     quantizer = _txPixQuantize_I8;
+                                                                break;
+        case GR_TEXFMT_AI_44:           quantizer = _txPixQuantize_AI44_DErr;
+                                                                break;
+        case GR_TEXFMT_ARGB_8332:       quantizer = _txPixQuantize_ARGB8332_DErr;
+                                                                break;
+        case GR_TEXFMT_RGB_565:         quantizer = _txPixQuantize_RGB565_DErr; 
+                                                                break;
+        case GR_TEXFMT_ARGB_1555:       quantizer =     _txPixQuantize_ARGB1555_DErr;
+                                                                break;
+        case GR_TEXFMT_ARGB_4444:       quantizer = _txPixQuantize_ARGB4444_DErr;
+                                                                break;
+        case GR_TEXFMT_AI_88:           quantizer = _txPixQuantize_AI88;
+                                                                break;
+
+        default: txPanic("Bad case in txQuantize()\n");                         break;
+        }
+    }else if (dither == TX_DITHER_4x4) { // 4x4 ordered dithering.
+
+        switch(format) {
+        case GR_TEXFMT_RGB_332:         quantizer = _txPixQuantize_RGB332_D4x4; 
+                                                                break;
+        case GR_TEXFMT_A_8:                     quantizer = _txPixQuantize_A8;                  
+                                                                break;
+        case GR_TEXFMT_I_8:                     quantizer = _txPixQuantize_I8;                          
+                                                                break;
+        case GR_TEXFMT_AI_44:           quantizer = _txPixQuantize_AI44_D4x4;           
+                                                                break;
+
+        case GR_TEXFMT_ARGB_8332:       quantizer = _txPixQuantize_ARGB8332_D4x4;       
+                                                                break;
+        case GR_TEXFMT_RGB_565:         quantizer = _txPixQuantize_RGB565_D4x4; 
+                                                                break;
+        case GR_TEXFMT_ARGB_1555:       quantizer =     _txPixQuantize_ARGB1555_D4x4;   
+                                                                break;
+        case GR_TEXFMT_ARGB_4444:       quantizer = _txPixQuantize_ARGB4444_D4x4;       
+                                                                break;
+        case GR_TEXFMT_AI_88:           quantizer = _txPixQuantize_AI88;                        
+                                                                break;
+
+        default: txPanic("Bad case in txQuantize()\n");                         
+                                                                break;
+        }
+    } else {            // No dithering.
+
+        switch(format) {
+        case GR_TEXFMT_RGB_332:         quantizer = _txPixQuantize_RGB332;              
+                                                                break;
+        case GR_TEXFMT_A_8:                     quantizer = _txPixQuantize_A8;          
+                                                                break;
+        case GR_TEXFMT_I_8:                     quantizer = _txPixQuantize_I8;                  
+                                                                break;
+        case GR_TEXFMT_AI_44:           quantizer = _txPixQuantize_AI44;                
+                                                                break;
+    
+        case GR_TEXFMT_ARGB_8332:       quantizer = _txPixQuantize_ARGB8332;    
+                                                                break;
+        case GR_TEXFMT_RGB_565:         quantizer = _txPixQuantize_RGB565;              
+                                                                break;
+        case GR_TEXFMT_ARGB_1555:       quantizer =     _txPixQuantize_ARGB1555;        
+                                                                break;
+        case GR_TEXFMT_ARGB_4444:       quantizer = _txPixQuantize_ARGB4444;    
+                                                                break;
+        case GR_TEXFMT_AI_88:           quantizer = _txPixQuantize_AI88;                
+                                                                break;
+
+        default: txPanic("Bad case in txQuantize()\n");                 
+                                                                break;
+        }
+    }
+
+    if (format < GR_TEXFMT_16BIT) {
+        // 8 bit dst
+        for (y=0; y<h; y++) {
+                for (x=0; x<w; x++) {
+                        *dst++ = (*quantizer)(*(unsigned long *)src, x, y, w);
+                        src += 4;
+                }
+        }
+    } else {
+        // 16 bit dst.
+        unsigned short *dst16 = (unsigned short *) dst;
+
+        for (y=0; y<h; y++) {
+                for (x=0; x<w; x++) {
+                        *dst16++ = (*quantizer)(*(unsigned long *)src, x, y, w);
+                        src += 4;
+                }
+        }
+    }
+}
+
+/*
+ * Reduce an ARGB8888 image to 16bits or 8bits/pixel, possibly dithering
+ * the resulting image using either ordered 4x4 or error-diffusion dithering.
+ *
+ * For the special cases of YIQ image, you also get the choice of 2 different
+ * quality levels in each of the compression cases.
+ */
+void    
+txMipQuantize(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compression)
+{
+    int         i, w, h;
+
+    if( txVerbose )
+      {
+        printf("Quantizing: (to %s)", Format_Name[format]);
+      }
+    pxMip->format = format;
+    pxMip->width  = txMip->width;
+    pxMip->height = txMip->height;
+
+    switch(format) {
+    // Special cases.
+    case GR_TEXFMT_YIQ_422:
+    case GR_TEXFMT_AYIQ_8422:
+                if( txVerbose )
+                  printf(".\n");
+                txMipNcc(pxMip, txMip, format, dither, compression);
+                return;
+
+    case GR_TEXFMT_ARGB_8888: 
+                // Copy source to destination, and be done.
+                if( txVerbose )
+                  printf(".\n");
+                memcpy(pxMip->data[0], txMip->data[0], txMip->size);
+                return;
+
+    case GR_TEXFMT_P_8:
+    case GR_TEXFMT_AP_88:
+                if( txVerbose )
+                  printf(".\n");
+                txMipPal256(pxMip, txMip, format, dither, compression);
+                return;
+
+    // Normal cases
+    case GR_TEXFMT_A_8: 
+    case GR_TEXFMT_I_8: 
+    case GR_TEXFMT_AI_44: 
+    case GR_TEXFMT_RGB_332:
+    case GR_TEXFMT_RGB_565: 
+    case GR_TEXFMT_ARGB_8332: 
+    case GR_TEXFMT_ARGB_1555: 
+    case GR_TEXFMT_ARGB_4444:
+    case GR_TEXFMT_AI_88:
+                break;
+
+    // Bad cases
+    default:
+                txPanic("Bad data format in Quantize\n");
+                return;
+
+    }
+
+    // We deal with rest of them here one mipmap level at a time.
+
+    w = txMip->width;
+    h = txMip->height;
+
+    for (i=0; i< pxMip->depth; i++) {
+        if( txVerbose )
+          printf(" %dx%d", w, h);
+
+        _txImgQuantize(pxMip->data[i], txMip->data[i], w, h, format, dither);
+        w >>= 1; if (w == 0) w = 1;
+        h >>= 1; if (h == 0) h = 1;
+    }
+    if( txVerbose )
+      printf(".\n");
+}
Index: trunk/src/opengl/glide/sst1/texus/read.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/read.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/read.c	(revision 2885)
@@ -0,0 +1,214 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:38 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+#define TX_3DF  0x100
+#define TX_PPM  0x101
+#define TX_BMP  0x102
+#define TX_IFF  0x103
+#define TX_PCX  0x104
+#define TX_SBI  0x105
+#define TX_RGT  0x106
+#define TX_UNK  0x200   // TGA is unknown from cookie signature.
+
+int 
+_txReadHeader( FILE *stream, TxMip *info )
+{
+    FxU32       cookie;
+    int         c;
+        int             fformat;                // format of the image file.
+        int             status;
+
+    if ( stream == NULL ) {
+                txError("Bad file handle.");
+                return 0;
+    }
+
+    if ((c=getc( stream )) == EOF ) {
+                txError("Unexpected end of file");
+                return 0;
+    }
+        cookie = (c << 8);
+
+    if ((c=getc( stream )) == EOF ) {
+                txError("Unexpected end of file");
+                return 0;
+    }
+        cookie |= c;
+
+    switch( cookie )
+    {
+        case ('P' << 8) | '9':  fformat = TX_SBI; break;
+        case ('P' << 8) | '6':  fformat = TX_PPM; break;
+        case ('3' << 8) | 'd':  fformat = TX_3DF; break;
+        case ('3' << 8) | 'D':  fformat = TX_3DF; break;
+        case 0x01DA:            // byte swapped RGT file.
+        case 0xDA01:            fformat = TX_RGT; break;
+        default:                fformat = TX_UNK; break;
+    }
+
+    switch (fformat) {
+    case TX_SBI: status = _txReadSBIHeader( stream, cookie, info ); break;
+    case TX_RGT: status = _txReadRGTHeader( stream, cookie, info ); break;
+    case TX_PPM: status = _txReadPPMHeader( stream, cookie, info ); break;
+    case TX_3DF: status = _txRead3DFHeader( stream, cookie, info ); break;
+    case TX_UNK: status = _txReadTGAHeader( stream, cookie, info ); break;
+    }
+
+        /* Not reached. */
+        return (status) ? fformat : 0;
+}
+
+static FxBool 
+_txReadData( FILE *stream, int fformat, TxMip *info )
+{
+        switch (fformat) {
+    case TX_SBI:        return _txReadSBIData( stream, info );
+    case TX_RGT:        return _txReadRGTData( stream, info );
+    case TX_PPM:        return _txReadPPMData( stream, info );
+    case TX_3DF:        return _txRead3DFData( stream, info );
+        case TX_UNK:    return _txReadTGAData( stream, info );
+    }
+
+        /* Not reached. */
+        return FXFALSE;
+}
+
+
+FxBool
+txMipRead(TxMip *txMip, const char *filename, int prefFormat)
+{
+  FILE *file;
+  FxBool retval;
+
+  file = fopen(filename, "rb");
+  if( file == NULL ) 
+    {
+      fprintf( stderr,"Error: can't open input file %s\n", filename );
+      exit(2);
+    }
+  
+  retval = txMipReadFromFP( txMip, filename, file, prefFormat );
+  fclose(file);
+  return retval;
+}
+
+FxBool
+txMipReadFromFP(TxMip *txMip, const char *debug_filename, FILE *file, int prefFormat)
+{
+        int                     i, format;
+        TxMip           txTrue;
+        int                     w, h;
+
+        if ((prefFormat != GR_TEXFMT_ARGB_8888) &&
+            (prefFormat != GR_TEXFMT_ANY)) 
+          {
+            txPanic("txMipRead: bad preferred format.");
+            return FXFALSE;
+          }
+
+        if ( (format = _txReadHeader( file, txMip )) == 0 ) {
+                fprintf(stderr,"Error: reading info for %s, %s\n",
+                        debug_filename, "");
+                exit(2);
+        }
+        if( txVerbose )
+          {
+            fprintf(stderr,"Loading image file ");
+
+            fprintf (stderr,"%s (%dw x %dh x %d Bpp x %d mips) .. ", debug_filename, 
+                     txMip->width,txMip->height, GR_TEXFMT_SIZE(txMip->format), txMip->depth);
+          }
+
+        /*
+         * Allocate memory requested in data[0]; 
+         */
+
+        w = txMip->width;
+        h = txMip->height;
+        txMip->data[0] = txMalloc(txMip->size);
+        for (i=1; i< TX_MAX_LEVEL; i++) {
+                if (i >= txMip->depth) {
+                        txMip->data[i] = NULL;
+                        continue;
+                }
+                txMip->data[i] = (FxU8*)txMip->data[i-1] + 
+                        w * h * GR_TEXFMT_SIZE(txMip->format);
+                if (w > 1) w >>= 1;
+                if (h > 1) h >>= 1;
+        }
+
+        if( txVerbose ) {
+	          fprintf( stderr, "mip-> format: %d width: %d height: %d depth: %d size: %d\n",
+		txMip->format, txMip->width, txMip->height, txMip->depth,
+		txMip->size );
+	         fflush( stderr );
+        }
+
+        if ( _txReadData( file, format, txMip ) == FXFALSE ) {
+                fprintf(stderr, "\nError: reading data for %s\n",debug_filename);
+                exit(4);
+        }
+
+        if( txVerbose )
+          fprintf(stderr," done.\n");
+        if (prefFormat == GR_TEXFMT_ANY) return FXTRUE;
+
+        /*
+         * Now convert to ARGB8888 if requested.
+         */
+        txTrue.format = GR_TEXFMT_ARGB_8888;
+        txTrue.width  = txMip->width;
+        txTrue.height = txMip->height;
+        txTrue.depth  = txMip->depth;
+        if (txMipAlloc(&txTrue) == FXFALSE) return FXFALSE;
+
+        /*
+         * Dequantize from src to dest.
+         */
+        if( txVerbose )
+          {
+            fprintf(stderr, "Dequantizing Input from %s to argb8888.\n", 
+                   Format_Name[txMip->format]);
+          }
+        txMipDequantize(&txTrue, txMip);
+
+        /*
+         * Free the original mipmap, and copy new mipmap into it.
+         */
+        txFree(txMip->data[0]);
+        *txMip = txTrue;
+
+        return FXTRUE;
+}
+
+
+FxBool _txReadSBIHeader( FILE *stream, FxU32 cookie, TxMip *info){ return FXFALSE;}
+FxBool _txReadSBIData( FILE *stream, TxMip *info){ return FXFALSE;}
+
Index: trunk/src/opengl/glide/sst1/texus/resample.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/resample.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/resample.c	(revision 2885)
@@ -0,0 +1,267 @@
+
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:39 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+/*
+ * For resampling in the x direction:
+ * Assume ix input pixels become ox output pixels.
+ * Imagine that ix input pixels are each divided into ox fragments, for a total
+ * of ix * ox fragments.
+ * Imagine also that ox output pixels are each divided into ix fragments, for a
+ * total of ox * ix fragments, same as before.
+ * Initialize an accumulator to 0. Add the first input pixel, multiplied by ox
+ * the number of fragments per input pixel. Keep track of the number of 
+ * fragments in the accumulator; when this is >= ix, (the number of fragments
+ * it takes to make an output pixel), multiply the accumulator by 
+ */
+
+static void
+_txResampleX(FxU32 *out, const FxU32 *in, int ox, int ix)
+{
+    FxU32 accr, accg, accb, acca, r, g, b, a;
+    int   i, accf, o, nf;
+
+    // printf("\n");
+    accf = accr = accg = accb = acca = o = 0;
+
+    for (i=0; i<ix; i++) {
+        a = (in[i] & 0xff000000) >> 24;
+        r = (in[i] & 0x00ff0000) >> 16;
+        g = (in[i] & 0x0000ff00) >>  8;
+        b = (in[i] & 0x000000ff)      ;
+
+    // Each input pixel brings ox fragments
+    nf = ox;
+
+    while ((accf + nf) >= ix) {
+        int          ef;
+        int    oa, or, og, ob;
+
+        // Yes, we have (possibly more than) enough to generate an output 
+        // pixel. Of the nf new fragments, use up enough to generate an 
+        // output pixel.
+
+        ef = ix - accf;         // the excessive # of fragments.
+
+            // printf("New: accf = %3d, nf = %3d, ef = %3d, ix = %3d, ox = %3d\n", 
+    //  accf, nf, ef, ix, ox);
+
+        acca += a * ef;
+            accr += r * ef;
+            accg += g * ef;
+            accb += b * ef;
+
+        oa = acca / ix;
+        or = accr / ix;
+        og = accg / ix;
+        ob = accb / ix;
+
+        if( (oa < 0) || (oa > 255) ||
+            (or < 0) || (or > 255) ||
+        (og < 0) || (og > 255) ||
+        (ob < 0) || (ob > 255) ) {
+
+        printf(" %d %d %d %d\n" , oa, or, og, ob);
+        txPanic("ARGB: out of range\n");
+        }
+
+        *out++ = (oa << 24) | (or << 16) | (og << 8) | ob;
+        // printf("Output pixel %4d: %.02x %.02x %.02x %.02x\n", 
+           //  o, oa, or, og, ob);
+        o++;
+        acca = accr = accg = accb = accf  = 0;
+        nf -= ef;
+    }
+
+    // If there's any fragments left over, accumulate them.
+    if (nf) {
+            acca += a * nf;
+            accr += r * nf;
+            accg += g * nf;
+            accb += b * nf;
+        accf += nf;
+            // printf("i= %4d, accf = %4d, aa=%.06x, ar=%.06x, ag=%.06x, ab=%.06x\n",
+        //      i, accf, acca, accr, accg, accb);
+    }
+    }
+    if (accf != 0) {
+        txPanic("Row resampling: accf != 0!\n");
+    }
+}
+
+static  FxU32 AccA[MAX_TEXWIDTH];
+static  FxU32 AccR[MAX_TEXWIDTH];
+static  FxU32 AccG[MAX_TEXWIDTH];
+static  FxU32 AccB[MAX_TEXWIDTH];
+static  FxU32 argb[MAX_TEXWIDTH];
+
+static void
+_txImgResample(FxU32 *out, int ox, int oy, 
+               const FxU32 *in, int ix, int iy)
+{
+    int r, g, b, a;
+    int   i, j, accf, o, nf;
+
+    for (i=0; i<ox; i++) AccA[i] = AccR[i] = AccG[i] = AccB[i] = 0;
+
+    accf = 0;
+    o = 0;
+    for (i=0; i<iy; i++) {
+
+        // Resample a row of input into temporary array.
+    // printf("Resampling input row %4d\n", i);
+    _txResampleX( argb, in, ox, ix);
+    in += ix;
+
+    // This row brings in oy fragments per scanline.
+    nf = oy;
+
+    while ((accf + nf) >= iy) {
+        int          ef;
+
+        // Yes, we have (possibly more than) enough to generate an output 
+        // pixel. Of the nf new fragments, use up enough to generate an 
+        // output pixel.
+
+        ef = iy - accf;         // the excessive # of fragments.
+
+        // Accumulate  input * ef + acc, and generate a line of output.
+        for (j=0; j<ox; j++) {
+
+                a = (argb[j] & 0xff000000) >> 24;
+                r = (argb[j] & 0x00ff0000) >> 16;
+                g = (argb[j] & 0x0000ff00) >>  8;
+                b = (argb[j] & 0x000000ff)      ;
+
+        AccA[j] += a * ef;
+        AccR[j] += r * ef;
+        AccG[j] += g * ef;
+        AccB[j] += b * ef;
+
+        a = AccA[j] / iy;
+        r = AccR[j] / iy;
+        g = AccG[j] / iy;
+        b = AccB[j] / iy;
+
+        if( (a < 0) || (a > 255) ||
+            (r < 0) || (r > 255) ||
+            (g < 0) || (g > 255) ||
+            (b < 0) || (b > 255) ) {
+                printf(" %d %d %d %d\n" , a, r, g, b);
+                txPanic("ARGB: out of range\n");
+            }
+        out[j] = (a << 24) | (r << 16) | (g << 8) | b;
+        AccA[j] = 0;
+        AccR[j] = 0;
+        AccG[j] = 0;
+        AccB[j] = 0;
+
+        }
+        out += ox;
+        accf = 0;
+        nf  -= ef;
+        // printf("[%4d] Generating output row %4d\n", i, o);
+        o++;
+    }
+
+    // If there's any fragments left over, accumulate them.
+    if (nf) {
+        for (j=0; j<ox; j++) {
+                a = (argb[j] & 0xff000000) >> 24;
+                r = (argb[j] & 0x00ff0000) >> 16;
+                g = (argb[j] & 0x0000ff00) >>  8;
+                b = (argb[j] & 0x000000ff)      ;
+
+        AccA[j] += a * nf;
+        AccR[j] += r * nf;
+        AccG[j] += g * nf;
+        AccB[j] += b * nf;
+        }
+        accf += nf;
+            // printf("i= %4d, accf = %4d\n", i, accf);
+    }
+    }
+    if (accf != 0) {
+        txPanic("Img resampling: accf != 0!\n");
+    }
+    // Ideally, accf must be 0 now.
+    // printf("Finally: accf = %d\n", accf);
+}
+
+void
+txMipResample(TxMip *destMip, TxMip *srcMip)
+{
+        int             i, sw, sh, dw, dh;
+
+
+        if ((destMip->width > MAX_TEXWIDTH) || (destMip->height > MAX_TEXWIDTH)) {
+                txPanic("Bad width/height in txImageResize()\n");
+        }
+        if ((srcMip->format != GR_TEXFMT_ARGB_8888) ||
+            (destMip->format != GR_TEXFMT_ARGB_8888)) {
+                txPanic("Bad image format in txMipResample.");
+        }
+
+        if ((srcMip->width == destMip->width) && (srcMip->height == destMip->height) &&
+            (srcMip->data[0] == destMip->data[0])) {
+                if( txVerbose )
+                  printf("No Resampling necessary.\n");
+                return;
+        }
+
+        if ((srcMip->data[0] == NULL) || (destMip->data[0] == NULL))
+                txPanic("txImageResize: Null buffer\n");
+
+        if( txVerbose )
+          printf("Resampling to %dx%d: ", destMip->width, destMip->height);
+
+        
+        sw = srcMip->width;
+        sh = srcMip->height;
+        dw = destMip->width;
+        dh = destMip->height;
+
+        for (i=0; i< srcMip->depth; i++) {
+                if(!destMip->data[i])
+                        txPanic("txImageResize: no miplevel present\n");
+                _txImgResample (destMip->data[i], dw, dh,
+                                srcMip->data[i], sw, sh);
+                if( txVerbose )
+                  {
+                    printf(" %dx%d", sw, sh); fflush(stdout);
+                  }
+                if (sw > 1) sw >>= 1;
+                if (sh > 1) sh >>= 1;
+                if (dw > 1) dw >>= 1;
+                if (dh > 1) dh >>= 1;
+        }
+        if( txVerbose )
+          printf(".\n");
+}
Index: trunk/src/opengl/glide/sst1/texus/rgt.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/rgt.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/rgt.c	(revision 2885)
@@ -0,0 +1,179 @@
+
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:39 $
+**
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+const FxU16 IMAGIC         = 0x01DA;
+const FxU16 ITYPE_RLE      = 0x01;
+const FxU16 ITYPE_NCC      = 0x02;
+const FxU16 ITYPE_BGR      = 0x04;
+const FxU16 ITYPE_RGT      = 0x08;
+    
+typedef struct _rgtHeader{
+    FxU16 magic;
+    FxU8 typeLo;
+    FxU8 typeHi;
+    FxU8 dimLo;
+    FxU8 dimHi;
+    FxU8 sizeXLo;
+    FxU8 sizeXHi;
+    FxU8 sizeYLo;
+    FxU8 sizeYHi;
+    FxU8 sizeZLo;
+    FxU8 sizeZHigh;
+} RgtHeader;
+
+
+
+static void swapShorts(unsigned short *array, long length)
+{
+    unsigned short s;
+    while (length--) {
+        s = *array;
+        *array++ = (s << 8) | (s>>8);
+    }
+}
+
+static void swapLongs(unsigned int *array, long length)
+{
+    unsigned int s;
+    while (length--) {
+        s = *array;
+        *array++ = (s << 24) | ((s >> 8)&0xFF00) | 
+                        ((s&0xFF00) << 8) | (s>>24);
+    }
+}
+
+// just swap RGB into BGR (leave MSB undefined)
+static void swapRGB(unsigned int *array, long length)
+{
+    unsigned int s;
+    while (length--) {
+        s = *array;
+        *array++ = (s << 16) | (s & 0xFF00) | (s>>16);
+    }
+}
+
+
+FxBool 
+_txReadRGTHeader( FILE *stream, FxU32 cookie, TxMip *info)
+{
+    RgtHeader   *rgtHeader = (RgtHeader *) info->pal;
+
+    rgtHeader->magic = (FxU16) cookie;
+    if ( stream == NULL ) {
+        txPanic("RGT file: Bad file handle.");
+        return FXFALSE;
+    }
+    
+    if ( fread( &(rgtHeader->typeLo), 1, sizeof(RgtHeader)-2, stream ) != 10 ) {
+        txPanic("RGT file: Unexpected end of file.");
+        return FXFALSE;
+    }
+    if (rgtHeader->magic == IMAGIC) {
+        // Needs byte swapping; don't swap magic cookie.
+        swapShorts((FxU16 *) &(rgtHeader->typeLo), 5);
+    }
+
+
+    info->format = GR_TEXFMT_ARGB_8888; 
+    info->width = rgtHeader->sizeXHi << 8 | rgtHeader->sizeXLo;
+    info->height = rgtHeader->sizeYHi << 8 | rgtHeader->sizeYLo;
+    info->depth = 1;
+    info->size = info->width * info->height * 4;
+    if( txVerbose )
+      {
+        printf("Magic: %.04x w = %d, h = %d, z = %d, typehi = %d, typelo = %d, swap=%d\n", rgtHeader->magic, 
+               info->width, info->height, rgtHeader->sizeZLo, rgtHeader->typeHi, rgtHeader->typeLo, rgtHeader->magic == IMAGIC);
+      }
+    return FXTRUE;
+}
+
+// RGT is RGBA in memory (low byte to high byte), or ABGR in a register
+
+FxBool 
+_txReadRGTData( FILE *stream, TxMip *info)
+{
+    RgtHeader   *rgtHeader = (RgtHeader *) info->pal;
+    FxU16 type = (rgtHeader->typeHi);
+    FxU16 swap = (rgtHeader->magic == IMAGIC); 
+    int   x, y;
+    
+    if ( stream == NULL ) {
+        txPanic("RGT file: Bad file handle.");
+        return FXFALSE;
+    }
+    if (type & ITYPE_NCC) {
+        txPanic("RGT file: RGT NCC files not supported.");
+        return FXFALSE;
+    }
+    if (type & ITYPE_RLE) {
+        txPanic("RGT file: RGT RLE files not supported.");
+        return FXFALSE;
+    }
+    
+    // load rgt, rgt's are bottom up
+    for ( y = 0; y < info->height; y++ ) {
+        FxU32 *data32;
+        int     r, g, b, a;
+
+        data32 = (FxU32 *) info->data[0];
+        data32 += info->width * (info->height -1 - y);
+
+        // Read scanline worth of data.
+        for (x=0; x < info->width; x++) {
+            /* Read b, g, r, a  from disk.*/
+            r = getc( stream );
+            g = getc( stream );
+            b = getc( stream );
+            a = getc( stream );
+
+            if ( a == EOF ) {
+                txPanic("RGT file: Unexpected End of File.");
+                return FXFALSE;
+            }
+            data32[x] = (a << 24) | (r << 16) | (g << 8) | b;
+        }
+
+#if 1
+        if (swap) {
+            swapRGB((unsigned int *)data32, (long)info->width);
+        }
+#endif
+
+#if 0
+        if (type & ITYPE_BGR) {
+            /* Swap just blue & red channels */
+            swapRGB(data32, info->width);
+        }
+#endif
+    }
+    return FXTRUE;
+}
Index: trunk/src/opengl/glide/sst1/texus/texus.h
===================================================================
--- trunk/src/opengl/glide/sst1/texus/texus.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/texus.h	(revision 2885)
@@ -0,0 +1,281 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:39 $
+*/
+
+#ifndef __TEXUS_H__
+#define __TEXUS_H__
+
+#ifdef __cplusplus 
+extern "C" { 
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifndef __3DFX_H__
+/*
+** basic data types
+*/
+typedef unsigned char   FxU8;
+typedef unsigned short  FxU16;
+typedef short           FxI16;
+typedef unsigned long   FxU32;
+typedef long            FxI32;
+typedef int             FxBool;
+
+/*
+** fundamental types
+*/
+
+#define FXTRUE    1
+#define FXFALSE   0
+#endif  /* __3DFX_H__ */
+
+
+#ifndef __GLIDE_H__
+/* These are defined so we can use them without glide */
+typedef FxU32 GrTextureFormat_t;
+#define GR_TEXFMT_8BIT                  0x0
+#define GR_TEXFMT_RGB_332                               GR_TEXFMT_8BIT
+#define GR_TEXFMT_YIQ_422               0x1
+#define GR_TEXFMT_ALPHA_8               0x2 /* (0..0xFF) alpha     */
+#define GR_TEXFMT_INTENSITY_8           0x3 /* (0..0xFF) intensity */
+#define GR_TEXFMT_ALPHA_INTENSITY_44    0x4
+#define GR_TEXFMT_P_8                   0x5
+#define GR_TEXFMT_RSVD1                 0x6
+#define GR_TEXFMT_RSVD2                 0x7
+#define GR_TEXFMT_16BIT                 0x8
+#define GR_TEXFMT_ARGB_8332                     GR_TEXFMT_16BIT
+#define GR_TEXFMT_AYIQ_8422             0x9
+#define GR_TEXFMT_RGB_565               0xa
+#define GR_TEXFMT_ARGB_1555             0xb
+#define GR_TEXFMT_ARGB_4444             0xc
+#define GR_TEXFMT_ALPHA_INTENSITY_88    0xd
+#define GR_TEXFMT_AP_88                 0xe
+#define GR_TEXFMT_RSVD4                 0xf
+
+typedef FxI32 GrLOD_t;
+#ifdef GLIDE3
+#define GR_LOD_256              0x8
+#define GR_LOD_128              0x7
+#define GR_LOD_64               0x6
+#define GR_LOD_32               0x5
+#define GR_LOD_16               0x4
+#define GR_LOD_8                0x3
+#define GR_LOD_4                0x2
+#define GR_LOD_2                0x1
+#define GR_LOD_1                0x0
+#else
+#define GR_LOD_256              0x0
+#define GR_LOD_128              0x1
+#define GR_LOD_64               0x2
+#define GR_LOD_32               0x3
+#define GR_LOD_16               0x4
+#define GR_LOD_8                0x5
+#define GR_LOD_4                0x6
+#define GR_LOD_2                0x7
+#define GR_LOD_1                0x8
+#endif 
+
+typedef FxI32 GrAspectRatio_t;
+#ifdef GLIDE3
+#define GR_ASPECT_8x1   3       /* 8W x 1H */
+#define GR_ASPECT_4x1   2       /* 4W x 1H */
+#define GR_ASPECT_2x1   1       /* 2W x 1H */
+#define GR_ASPECT_1x1   0       /* 1W x 1H */
+#define GR_ASPECT_1x2  -1       /* 1W x 2H */
+#define GR_ASPECT_1x4  -2       /* 1W x 4H */
+#define GR_ASPECT_1x8  -3       /* 1W x 8H */
+#else
+#define GR_ASPECT_8x1 0x0       /* 8W x 1H */
+#define GR_ASPECT_4x1 0x1       /* 4W x 1H */
+#define GR_ASPECT_2x1 0x2       /* 2W x 1H */
+#define GR_ASPECT_1x1 0x3       /* 1W x 1H */
+#define GR_ASPECT_1x2 0x4       /* 1W x 2H */
+#define GR_ASPECT_1x4 0x5       /* 1W x 4H */
+#define GR_ASPECT_1x8 0x6       /* 1W x 8H */
+#endif /* GLIDE3 */
+
+/*
+** 3DF texture file structs
+*/
+typedef struct
+{
+  FxU32               width, height;
+  int                 small_lod, large_lod;
+  GrAspectRatio_t     aspect_ratio;
+  GrTextureFormat_t   format;
+} Gu3dfHeader;
+
+typedef struct
+{
+  FxU8  yRGB[16];
+  FxI16 iRGB[4][3];
+  FxI16 qRGB[4][3];
+  FxU32 packed_data[12];
+} GuNccTable;
+
+typedef struct {
+    FxU32 data[256];
+} GuTexPalette;
+
+typedef union {
+    GuNccTable   nccTable;
+    GuTexPalette palette;
+} GuTexTable;
+
+typedef struct
+{
+  Gu3dfHeader  header;
+  GuTexTable   table;
+  void        *data;
+  FxU32        mem_required;    /* memory required for mip map in bytes. */
+} Gu3dfInfo;
+
+#endif          // __GLIDE_H__
+
+#define GR_TEXFMT_32BIT                                 0x10
+#define GR_TEXFMT_ARGB_8888                             GR_TEXFMT_32BIT
+#define GR_TEXFMT_RGB_888                               0x11
+#define GR_TEXFMT_ANY                                   0x7fffffff
+
+// Save typing fingers
+#define GR_TEXFMT_A_8                                   GR_TEXFMT_ALPHA_8
+#define GR_TEXFMT_I_8                                   GR_TEXFMT_INTENSITY_8
+#define GR_TEXFMT_AI_44                                 GR_TEXFMT_ALPHA_INTENSITY_44
+#define GR_TEXFMT_AI_88                                 GR_TEXFMT_ALPHA_INTENSITY_88
+
+#define TX_DITHER_NONE                                  0x00000000
+#define TX_DITHER_4x4                                   0x00000001
+#define TX_DITHER_ERR                                   0x00000002
+#define TX_DITHER_MASK                                  0x0000000f
+
+#define TX_COMPRESSION_STATISTICAL                      0x00000000
+#define TX_COMPRESSION_HEURISTIC                        0x00000010
+#define TX_COMPRESSION_MASK                             0x000000f0
+
+#define TX_CLAMP_DISABLE                                0x00000000
+#define TX_CLAMP_ENABLE                                 0x00000100
+#define TX_CLAMP_MASK                                   0x00000f00
+
+#define TX_AUTORESIZE_DISABLE                           0x00000000
+#define TX_AUTORESIZE_GROW                              0x00001000
+#define TX_AUTORESIZE_SHRINK                            0x00002000
+#define TX_AUTORESIZE_MASK                              0x0000f000
+
+#define TX_TARGET_PALNCC_BESTFIT                        0x00000000
+#define TX_TARGET_PALNCC_SOURCE                         0x00010000
+#define TX_TARGET_PALNCC_MASK                           0x000f0000
+
+/*
+ * (GaryMcT)
+ * TX_FIXED_PAL_QUANT_DIST -    use color distance to map a true color
+ *                              image back into a user specified  palette.
+ *                              Use this when you have a lot of different
+ *                              palettes.       
+ * TX_FIXED_PAL_QUANT_TABLE-    use an inverse palette to map colors 
+ *                              into a user specfied palette.
+ *                              Use this method when you have a few
+ *                              palettes.  Will run faster if you
+ *                              process textures with the same 
+ *                              palette sequentially since the palette
+ *                              is compiled internally to a lookup table.
+ */
+#define TX_FIXED_PAL_QUANT_DIST                         0x00000000
+#define TX_FIXED_PAL_QUANT_TABLE                        0x00100000
+#define TX_FIXED_PAL_QUANT_MASK                         0x00f00000
+
+#define TX_WRITE_3DF                                    0x00000000
+#define TX_WRITE_TGA                                    0x00000001
+#define TX_WRITE_MASK                                   0x0000000f
+
+/*
+ * Publicly accessible functions.
+ */
+
+/*
+ * txInit3dfInfo:
+ * Set up the target parameters for a texture conversion.
+ *      info                    - Glide texture structure to set up.
+ *      destFormat              - format that we will be converting to.
+ *      destWidth, destHeight   - geometry of the target texture image.
+ *                                Are modified if TX_AUTORESIZE is enabled.
+ *      mipLevels               - number of mipmap levels in the target texture.
+ *                                Either specifies the number of mipmap levels
+ *                                to create, or -1 for all possible mipmap levels.
+ *      flags -
+ *         auto-resample mode   - TX_AUTORESIZE_*
+ */
+size_t txInit3dfInfo( Gu3dfInfo *info, GrTextureFormat_t destFormat,
+                      int *destWidth, int *destHeight,
+                      int mipLevels, FxU32 flags );
+
+size_t txInit3dfInfoFromFile( FILE *file, 
+                              Gu3dfInfo *info, GrTextureFormat_t destFormat,
+                              int *destWidth, int *destHeight,
+                              int mipLevels, FxU32 flags );
+
+/*
+ * txConvert: convert from an in memory texture to a Glide Gu3dfInfo.
+ *      info - target texture info. . is set up with txInit3dfInfo.
+ *      srcFormat - format of in-memory source texture.
+ *      srcWidth, srcHeight - geometry of in memory source texture.
+ *                            This is not limited in size or 
+ *                            aspect ratio.
+ *      flags - 
+ *         dither mode                  - TX_DITHER_*
+ *         compression                  - TX_COMPRESS_*
+ *         clamp mode                   - TX_CLAMP_*
+ *         palette conversion mode      - TX_FIXED_PAL_QUANT_*
+ */
+FxBool txConvert( Gu3dfInfo *info, GrTextureFormat_t srcFormat,
+                  int srcWidth, int srcHeight,
+                  const void *srcImage, FxU32 flags,
+                  const void *palNcc );
+
+FxBool txConvertFromFile( FILE *file, Gu3dfInfo *info, 
+                          FxU32 flags, const void *palNcc );
+
+FxBool txWrite( Gu3dfInfo *info, FILE *fp, FxU32 flags );
+
+/*
+ * Error handling.
+ */
+typedef void (*TxErrorCallbackFnc_t)( const char *string, FxBool fatal );
+
+void txErrorSetCallback( TxErrorCallbackFnc_t fnc );
+
+/*
+ * TEXUS MEMORY ALLOCATION ROUTINES.
+ * These are not to be called directly. . .they are only here
+ * so that you can redefine them to your own memory management
+ * routines.
+ */
+void    *txMalloc( size_t size );
+void    txFree( void *ptr );
+void    *txRealloc( void *ptr, size_t size );
+
+#ifdef __cplusplus 
+}
+#endif
+
+#endif  /* __TEXUS_H__ */
Index: trunk/src/opengl/glide/sst1/texus/texusint.h
===================================================================
--- trunk/src/opengl/glide/sst1/texus/texusint.h	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/texusint.h	(revision 2885)
@@ -0,0 +1,121 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:39 $
+*/
+
+#ifndef __TEXUSINT_H__
+#define __TEXUSINT_H__
+ 
+#include "texus.h"
+
+#define GR_TEXFMT_SIZE(x)                               ((x < GR_TEXFMT_16BIT) ? 1:     \
+                                                                                 ((x < GR_TEXFMT_32BIT) ? 2: 4))
+
+#define TX_OFORMAT_3DF                                  10
+#define TX_OFORMAT_TGA                                  11
+#define TX_OFORMAT_PPM                                  12
+
+#define TX_MAX_LEVEL       16
+typedef struct  _TxMip {
+        int             format;                         // GR_TEXFMT_...
+        int             width;                          // pixels
+        int             height;                         // pixels
+        int             depth;                          // mipmap levels
+        int             size;                           // bytes
+        void    *data[TX_MAX_LEVEL];
+        FxU32   pal[256];
+} TxMip;
+
+FxBool  txMipRead(TxMip *txMip, const char *filename, int preferredFormat);
+FxBool  txMipReadFromFP(TxMip *txMip, const char *debug_filename, FILE *file, int preferredFormat);
+void    txMipWrite(TxMip *txMip, char *file, char *ext, int split);
+void    txMipResample(TxMip *destMip, TxMip *srcMip);
+void    txMipClamp( TxMip *dstMip, TxMip *srcMip );
+void    txMipMipmap(TxMip *txMip);
+
+void    txMipQuantize(TxMip *pxMip, TxMip *txMip, int fmt, FxU32 d, FxU32 comp);
+void    txMipNcc(TxMip *pxMip, TxMip *txMip, int fmt, FxU32 dither, FxU32 comp);
+void    txMipNccNNet(TxMip *pxMip, TxMip *txMip, int fmt, FxU32 dither, FxU32 comp);
+int     txMipPal256(TxMip *pxMip, TxMip *txMip, int fmt, FxU32 dither, FxU32 comp);
+
+void    txMipDequantize(TxMip *txMip, TxMip *pxMip);
+void    txMipView(TxMip *txMip, char *filename, int wait, int bgcolor);
+void    txViewClose();
+
+int             txLog2(int n);
+int     txFloorPow2(int n);
+int             txCeilPow2(int n);
+int     txGCD(int a, int b);
+int             txAspectRatio(int w, int h);
+void    txPanic(char *);
+void    txError(char *);
+void    txYABtoPal256(long *palette, const long* yabTable);
+void    txRectCopy(FxU8 *dst, int dstStride, const FxU8 *src, int srcStride,
+                        int width, int height);
+FxBool  txMipAlloc(TxMip *txMip);
+FxBool  txMipSetMipPointers(TxMip *txMip);
+int             txMemRequired(TxMip *txMip);
+void    txBasename(const char *name, char *base);
+void    txPathAndBasename(const char *name, char* pathbase);
+void    txExtension(const char *name, char *ext);
+
+void txMipFree( TxMip *mip );
+void txMipTrueToFixedPal( TxMip *outputMip, TxMip *trueColorMip, const FxU32 *pal,
+                          FxU32 flags );
+
+
+
+extern  int txVerbose;
+extern  int *explode3;
+#define DISTANCE(ar, ag, ab, br, bg, bb) \
+                ((explode3[(ar)-(br)] << 1) + (explode3[(ag)-(bg)]<<2) + explode3[(ab)-(bb)])
+
+void    txDiffuseIndex(TxMip *pxMip, TxMip *txMip, int pixsize, 
+                const FxU32 *palette, int       ncolors);
+int             txNearestColor(long ir, long ig, long ib, const FxU32 *pal, int npal);
+
+FxBool _txReadTGAHeader( FILE *stream, FxU32 cookie, TxMip *info);
+FxBool _txReadTGAData( FILE *stream, TxMip *info);
+
+FxBool _txReadRGTHeader( FILE *stream, FxU32 cookie, TxMip *info);
+FxBool _txReadRGTData( FILE *stream, TxMip *info);
+
+FxBool _txReadSBIHeader( FILE *stream, FxU32 cookie, TxMip *info);
+FxBool _txReadSBIData( FILE *stream, TxMip *info);
+
+FxBool _txReadPPMHeader( FILE *stream, FxU32 cookie, TxMip *info);
+FxBool _txReadPPMData( FILE *stream, TxMip *info);
+
+FxBool _txRead3DFHeader( FILE *stream, FxU32 cookie, TxMip *info);
+FxBool _txRead3DFData( FILE *stream, TxMip *info);
+
+int _txReadHeader( FILE *stream, TxMip *info );
+
+void txPalToNcc( GuNccTable *ncc_table, const FxU32 *pal );
+void txNccToPal( FxU32 *pal, const GuNccTable *ncc_table );
+
+#define MAX_TEXWIDTH    1024
+
+extern TxErrorCallbackFnc_t _txErrorCallback;
+
+extern  char *Format_Name[];
+
+#endif  /* __TEXUSINT_H__ */
Index: trunk/src/opengl/glide/sst1/texus/texuslib.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/texuslib.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/texuslib.c	(revision 2885)
@@ -0,0 +1,723 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Id: texuslib.c,v 1.1 2000-02-25 00:31:39 sandervl Exp $
+*/
+#include <string.h>
+#include <glide.h>
+#include <malloc.h>
+#include "texus.h"
+#include "texusint.h"
+
+void _txDefaultErrorCallback( const char *string, FxBool fatal );
+
+TxErrorCallbackFnc_t _txErrorCallback = _txDefaultErrorCallback;
+
+void _txDefaultErrorCallback( const char *string, FxBool fatal )
+{
+  fprintf(stderr, "Texus: %s", string );
+  if( fatal )
+    exit( -1 );
+}
+
+#ifdef GLIDE3
+    static FxU32 _gr_aspect_index_table[] =
+    {
+       0,
+       1,
+       2,
+       3
+    };
+#else
+    static FxU32 _gr_aspect_index_table[] =
+    {
+       3,
+       2,
+       1,
+       0,
+       1,
+       2,
+       3,
+    };
+#endif
+
+/* size in texels  */
+static FxU32 _grMipMapHostSize[4][16] = 
+{
+    {   /* 1:1 aspect ratio */
+        65536, /* 0 : 256x256  */
+        16384, /* 1 : 128x128  */
+         4096, /* 2 :  64x64   */
+         1024, /* 3 :  32x32   */
+          256, /* 4 :  16x16   */
+           64, /* 5 :   8x8    */
+           16, /* 6 :   4x4    */
+            4, /* 7 :   2x2    */
+            1, /* 8 :   1x1    */
+    }, 
+    {   /* 2:1 aspect ratio */
+        32768, /* 0 : 256x128  */
+         8192, /* 1 : 128x64   */
+         2048, /* 2 :  64x32   */
+          512, /* 3 :  32x16   */
+          128, /* 4 :  16x8    */
+           32, /* 5 :   8x4    */
+            8, /* 6 :   4x2    */
+            2, /* 7 :   2x1    */
+            1, /* 8 :   1x1    */
+    }, 
+    {   /* 4:1 aspect ratio */
+        16384, /* 0 : 256x64   */
+         4096, /* 1 : 128x32   */
+         1024, /* 2 :  64x16   */
+          256, /* 3 :  32x8    */
+           64, /* 4 :  16x4    */
+           16, /* 5 :   8x2    */
+            4, /* 6 :   4x1    */
+            2, /* 7 :   2x1    */
+            1, /* 8 :   1x1    */
+    },
+    {   /* 8:1 aspect ratio */
+         8192, /* 0 : 256x32   */
+         2048, /* 1 : 128x16   */
+          512, /* 2 :  64x8    */
+          128, /* 3 :  32x4    */
+           32, /* 4 :  16x2    */
+            8, /* 5 :   8x1    */
+            4, /* 6 :   4x1    */
+            2, /* 7 :   2x1    */
+            1, /* 8 :   1x1    */
+    }
+};
+
+FxU32
+txTexCalcMemRequired( GrLOD_t small_lod, GrLOD_t large_lod,
+                      GrAspectRatio_t aspect, GrTextureFormat_t format ) {
+    size_t memRequired;
+    FxI32 lod;
+    memRequired = 0;
+
+#ifdef GLIDE3
+    for( lod = small_lod; lod <= large_lod; lod++ ) {
+#else
+    for( lod = large_lod; lod <= small_lod; lod++ ) {
+#endif
+        memRequired +=
+#ifdef GLIDE3
+           /* Quick port to Glide3. Not the most general way. We would need
+           ** something like GR_ASPECT_MAX, GR_ASPECT_MIN, GR_LOD_MAX and GR_LOD_MIN...
+           ** because this current implementation will break when we have more
+           ** than 8 levels of mipmapping for example.
+           */
+           _grMipMapHostSize[_gr_aspect_index_table[((aspect>=0)?aspect:-aspect)]] [8-lod] << (format>=GR_TEXFMT_16BIT);
+#else
+           _grMipMapHostSize[_gr_aspect_index_table[aspect]] [lod] << (format>=GR_TEXFMT_16BIT);
+#endif 
+    }
+    return memRequired ;
+}
+
+static GrLOD_t _txLengthToLOD( int len )
+{
+#ifdef GLIDE3
+  switch( len )
+    {
+    case 256:
+      return GR_LOD_LOG2_256;
+    case 128:
+      return GR_LOD_LOG2_128;
+    case 64:
+      return GR_LOD_LOG2_64;
+    case 32:
+      return GR_LOD_LOG2_32;
+    case 16:
+      return GR_LOD_LOG2_16;
+    case 8:
+      return GR_LOD_LOG2_8;
+    case 4:
+      return GR_LOD_LOG2_4;
+    case 2:
+      return GR_LOD_LOG2_2;
+    case 1:
+      return GR_LOD_LOG2_1;
+    }
+  /*
+   * This is only here to make the compiler shut up.
+   */
+  return GR_LOD_LOG2_1;
+#else
+  switch( len )
+    {
+    case 256:
+      return GR_LOD_256;
+    case 128:
+      return GR_LOD_128;
+    case 64:
+      return GR_LOD_64;
+    case 32:
+      return GR_LOD_32;
+    case 16:
+      return GR_LOD_16;
+    case 8:
+      return GR_LOD_8;
+    case 4:
+      return GR_LOD_4;
+    case 2:
+      return GR_LOD_2;
+    case 1:
+      return GR_LOD_1;
+    }
+  /*
+   * This is only here to make the compiler shut up.
+   */
+  return GR_LOD_1;
+#endif
+
+}
+
+static GrAspectRatio_t _txDimensionsToAspectRatio( int width, int height )
+{
+  int aspect;
+
+  aspect = ( 8 * width ) / height;
+
+#ifdef GLIDE3
+  switch( aspect )
+    {
+    case 64:
+      return GR_ASPECT_LOG2_8x1;
+    case 32:
+      return GR_ASPECT_LOG2_4x1;
+    case 16:
+      return GR_ASPECT_LOG2_2x1;
+    case 8:
+      return GR_ASPECT_LOG2_1x1;
+    case 4:
+      return GR_ASPECT_LOG2_1x2;
+    case 2:
+      return GR_ASPECT_LOG2_1x4;
+    case 1:
+      return GR_ASPECT_LOG2_1x8;
+    }
+
+  /*
+   * Make the compiler shut up.
+   */
+  return GR_ASPECT_LOG2_1x8;
+#else
+  switch( aspect )
+    {
+    case 64:
+      return GR_ASPECT_8x1;
+    case 32:
+      return GR_ASPECT_4x1;
+    case 16:
+      return GR_ASPECT_2x1;
+    case 8:
+      return GR_ASPECT_1x1;
+    case 4:
+      return GR_ASPECT_1x2;
+    case 2:
+      return GR_ASPECT_1x4;
+    case 1:
+      return GR_ASPECT_1x8;
+    }
+
+  /*
+   * Make the compiler shut up.
+   */
+  return GR_ASPECT_1x8;
+#endif
+}
+
+/*
+ * Return the smallest LOD given an aspect ratio
+ * assuming that the LODs "stop" as soon as a side
+ * length becomes 1.
+ */
+static GrLOD_t _txSmallestLOD( GrAspectRatio_t aspect )
+{
+#ifdef GLIDE3
+  switch( aspect )
+    {
+    case GR_ASPECT_LOG2_8x1:
+    case GR_ASPECT_LOG2_1x8:
+      return GR_LOD_LOG2_8;
+    case GR_ASPECT_LOG2_4x1:
+    case GR_ASPECT_LOG2_1x4:
+      return GR_LOD_LOG2_4;
+    case GR_ASPECT_LOG2_2x1:
+    case GR_ASPECT_LOG2_1x2:
+      return GR_LOD_LOG2_2;
+    case GR_ASPECT_LOG2_1x1:
+      return GR_LOD_LOG2_1;
+    }
+  /*
+   * Make the compiler shut up.
+   */
+  return GR_LOD_LOG2_1;
+#else
+  switch( aspect )
+    {
+    case GR_ASPECT_8x1:
+    case GR_ASPECT_1x8:
+      return GR_LOD_8;
+    case GR_ASPECT_4x1:
+    case GR_ASPECT_1x4:
+      return GR_LOD_4;
+    case GR_ASPECT_2x1:
+    case GR_ASPECT_1x2:
+      return GR_LOD_2;
+    case GR_ASPECT_1x1:
+      return GR_LOD_1;
+    }
+  /*
+   * Make the compiler shut up.
+   */
+  return GR_LOD_1;
+
+#endif /* GLIDE3 */
+}
+
+void txNccToPal( FxU32 *pal, const GuNccTable *ncc_table ) 
+{
+  int i, j;
+
+  for( i = 0; i < 16; i++ )
+    {
+      pal[i] = ncc_table->yRGB[i];
+    }
+      
+  for( i = 0; i < 4; i++ )
+    {
+      for( j = 0; j < 3; j++ )
+        {
+            pal[16 + 3 * i + j] = ncc_table->iRGB[i][j];
+            pal[28 + 3 * i + j] = ncc_table->qRGB[i][j];
+        }
+    }
+}
+
+void txPalToNcc( GuNccTable *ncc_table, const FxU32 *pal ) {
+  int i, j;
+
+  for( i = 0; i < 16; i++ )
+    {
+      ncc_table->yRGB[i] = ( FxU8 )pal[i];
+    }
+      
+  for( i = 0; i < 4; i++ )
+    {
+      for( j = 0; j < 3; j++ )
+        {
+          ncc_table->iRGB[i][j] = ( FxI16 )( pal[16 + 3 * i + j] );
+          ncc_table->qRGB[i][j] = ( FxI16 )( pal[28 + 3 * i + j] );
+        }
+    }
+  
+  /*
+  ** pack the table Y entries
+  */
+  for ( i = 0; i < 4; i++ )
+    {
+      FxU32 packedvalue;
+      
+      packedvalue  = ( ( FxU32 )( ncc_table->yRGB[i*4+0] & 0xff ) );
+      packedvalue |= ( ( FxU32 )( ncc_table->yRGB[i*4+1] & 0xff ) ) << 8;
+      packedvalue |= ( ( FxU32 )( ncc_table->yRGB[i*4+2] & 0xff ) ) << 16;
+      packedvalue |= ( ( FxU32 )( ncc_table->yRGB[i*4+3] & 0xff ) ) << 24;
+
+      ncc_table->packed_data[i] = packedvalue;
+    }
+  
+  /*
+  ** pack the table I entries
+  */
+  for ( i = 0; i < 4; i++ )
+    {
+      FxU32 packedvalue;
+      
+      packedvalue  = ( ( FxU32 )( ncc_table->iRGB[i][0] & 0x1ff ) ) << 18;
+      packedvalue |= ( ( FxU32 )( ncc_table->iRGB[i][1] & 0x1ff ) ) << 9;
+
+      packedvalue |= ( ( FxU32 )( ncc_table->iRGB[i][2] & 0x1ff ) ) << 0;
+      
+      ncc_table->packed_data[i+4] = packedvalue;
+    }
+  
+  /*
+  ** pack the table Q entries
+  */
+  for ( i = 0; i < 4; i++ )
+    {
+      FxU32 packedvalue;
+      
+      packedvalue  = ( ( FxU32 )( ncc_table->qRGB[i][0] & 0x1ff ) ) << 18;
+      packedvalue |= ( ( FxU32 )( ncc_table->qRGB[i][1] & 0x1ff ) ) << 9;;
+      packedvalue |= ( ( FxU32 )( ncc_table->qRGB[i][2] & 0x1ff ) ) << 0;
+      
+      ncc_table->packed_data[i+8] = packedvalue;
+    }
+}
+
+size_t txInit3dfInfoFromFile( FILE *file, 
+                              Gu3dfInfo *info, GrTextureFormat_t destFormat,
+                              int *destWidth, int *destHeight,
+                              int mipLevels, FxU32 flags )
+{
+  long file_start_position;
+  size_t size_retval;
+  int input_format;
+  TxMip txMip;
+
+#if 0
+  printf( "enter: txInit3dfInfoFromFile\n" );
+  fflush( stdout );
+#endif
+
+  /*
+   * Save the current position of the input file so that we can
+   * later recent it.
+   */
+  file_start_position = ftell( file );
+
+  /*
+   * Read the header of the input file to find out some information
+   * about it.
+   */
+  if( ( input_format = _txReadHeader( file, &txMip ) ) == 0 )
+    {
+      return 0;
+    }
+
+  *destWidth = txMip.width;
+  *destHeight = txMip.height;
+
+  size_retval = txInit3dfInfo( info, destFormat, destWidth, destHeight,
+                               mipLevels, flags );
+
+
+  /*
+   * Set the file offset back to where it was when we entered this 
+   * function.
+   */
+  fseek( file, file_start_position, SEEK_SET );
+  
+  /*
+   * Return the memory required for this texture.
+   */
+#if 0
+  printf( "txInit3dfInfoFromFile returning %ld\n", ( long )size_retval );
+  fflush( stdout );
+#endif
+  return size_retval;
+}
+
+size_t txInit3dfInfo( Gu3dfInfo *info, GrTextureFormat_t destFormat,
+                      int *destWidth, int *destHeight,
+                      int mipLevels, FxU32 flags )
+{
+  /*
+   * If auto-resize is enabled,
+   */
+  if( ( flags & TX_AUTORESIZE_MASK ) != TX_AUTORESIZE_DISABLE )
+    {
+      /*
+       * Make sure that the texture dimensions are power of two.
+       */
+      if( ( flags & TX_AUTORESIZE_MASK ) == TX_AUTORESIZE_SHRINK )
+        {
+          *destWidth  = txFloorPow2( *destWidth );
+          *destHeight = txFloorPow2( *destHeight );
+        }
+      else
+        {
+          *destWidth  = txCeilPow2( *destWidth );
+          *destHeight = txCeilPow2( *destHeight );
+        }
+      
+      /*
+       * Make sure the dimensions are in range.
+       */
+      while( *destWidth > 256 )
+        *destWidth >>= 1;
+      while( *destHeight > 256 )
+        *destHeight >>= 1;
+
+      /*
+       * Make sure the aspect ratio is valid.
+       */
+      while( ( *destWidth / *destHeight ) > 8 )
+        {
+          *destWidth >>= 1;
+        }
+
+      while( ( *destHeight/ *destWidth ) > 8 )
+        {
+          *destHeight >>= 1;
+        }
+    }
+
+  /*
+   * Calculate the aspect ratio of the texture . . this assumse that
+   * the desired texture size is valid!
+   */
+  info->header.aspect_ratio = _txDimensionsToAspectRatio( *destWidth, *destHeight );
+
+  /*
+   * Calculate the min and max LODs for the texture.
+   */
+  info->header.large_lod = _txLengthToLOD( ( *destHeight > *destWidth ) ? *destHeight : *destWidth );
+  info->header.small_lod = _txSmallestLOD( info->header.aspect_ratio );
+
+  /*
+   * Make sure that we have the correct number of mipmap levels given
+   * the parameter "mipLevels".
+   * If mipLevels is -1, then we want all levels.
+   */
+  if( mipLevels != -1 )
+    {
+      int tmpNumLevels;
+#ifdef GLIDE3
+      tmpNumLevels = info->header.large_lod - info->header.small_lod + 1;
+#else
+      tmpNumLevels = info->header.small_lod - info->header.large_lod + 1;
+#endif
+      if( tmpNumLevels > mipLevels )
+        {
+#ifdef GLIDE3
+          info->header.small_lod += tmpNumLevels - mipLevels;
+#else
+          info->header.small_lod -= tmpNumLevels - mipLevels;
+#endif
+        }
+    }
+
+  /*
+   * Store the geometry of the texture.
+   */
+  info->header.width    = *destWidth;
+  info->header.height   = *destHeight;
+
+  /*
+   * Store the format of the texture.
+   */
+  info->header.format   = destFormat;
+  
+  info->mem_required = txTexCalcMemRequired( info->header.small_lod,
+                                             info->header.large_lod,
+                                             info->header.aspect_ratio,
+                                             info->header.format );
+
+  /*
+   * Return the amount of texture memory required for this texture.
+   * The user is responsible for allocating the space for the texture.
+   */
+  return info->mem_required;
+}
+
+
+FxBool txConvertFromFile( FILE *file, Gu3dfInfo *info, 
+                          FxU32 flags, const void *palNcc )
+{
+  long file_start_position;
+  FxBool retval;
+  TxMip txMip;
+  
+  /*
+   * Save the current position of the input file so that we can
+   * later recent it.
+   */
+  file_start_position = ftell( file );
+
+  txMipReadFromFP( &txMip, "(FILE*)", file, GR_TEXFMT_ANY );
+
+  retval = txConvert( info, txMip.format, txMip.width, txMip.height,
+                      txMip.data[0], flags, palNcc );
+  txFree( txMip.data[0] );
+
+  return retval;
+}
+
+FxBool txConvert( Gu3dfInfo *info, GrTextureFormat_t srcFormat,
+                  int srcWidth, int srcHeight,
+                  const void *srcImage, FxU32 flags,
+                  const void *palNcc )
+{
+  TxMip srcMip;
+  TxMip trueColorMip;
+  TxMip outputMip;
+  TxMip tmpMip;
+
+  /*
+   * Make a txMip out of the passed data.
+   */
+  memset( &srcMip, 0, sizeof( srcMip ) );
+  srcMip.format         = srcFormat;
+  srcMip.width          = srcWidth;
+  srcMip.height         = srcHeight;
+  srcMip.depth          = 1;
+
+  if( palNcc )
+    {
+      switch( srcFormat )
+        {
+        case GR_TEXFMT_YIQ_422:
+        case GR_TEXFMT_AYIQ_8422:
+         txNccToPal( srcMip.pal, palNcc);
+          break;
+        case GR_TEXFMT_P_8:
+          memcpy( srcMip.pal, palNcc, sizeof( FxU32 ) * 256 );
+          break;
+        }
+    }
+  srcMip.data[0]        = ( void * )srcImage;
+
+  /*
+   * Set up a txMip to put a true color version of the texture in.
+   */
+  memset( &trueColorMip, 0, sizeof( trueColorMip ) );
+  trueColorMip.format         = GR_TEXFMT_ARGB_8888;
+  trueColorMip.width          = srcWidth;
+  trueColorMip.height         = srcHeight;
+  /*
+   * Set the depth to the mipmapped depth to allocate the image.
+   */
+#ifdef GLIDE3
+  trueColorMip.depth          = info->header.large_lod - info->header.small_lod + 1;
+#else
+  trueColorMip.depth          = info->header.small_lod - info->header.large_lod + 1;
+#endif
+  if( !txMipAlloc( &trueColorMip ) )
+    return FXFALSE;
+
+  /*
+   * Set to one level only since we only want to dequant the first 
+   * level.
+   */
+  trueColorMip.depth          = 1;
+
+  /*
+   * Convert from the input format to truecolor.
+   */
+  txMipDequantize( &trueColorMip, &srcMip );
+
+  /*
+   * We realy have more than one level, so. . . 
+   */
+#ifdef GLIDE3
+  trueColorMip.depth          = info->header.large_lod - info->header.small_lod + 1;
+#else
+  trueColorMip.depth          = info->header.small_lod - info->header.large_lod + 1;
+#endif
+
+  /*
+   * WARNING!  I do not free srcMip.data[0] since it is passed in by the users.
+   */
+
+  /*
+   * Resample the true color version of the input image to 
+   * the passed in size. . . . this should be a valid
+   * size for the hardware to handle.
+   */
+  tmpMip = trueColorMip;
+  tmpMip.width = info->header.width;
+  tmpMip.height = info->header.height;
+  txMipAlloc( &tmpMip );
+
+  if( ( flags & TX_CLAMP_MASK ) == TX_CLAMP_DISABLE )
+    {
+      txMipResample( &tmpMip, &trueColorMip );
+    }
+  else
+    {
+      txMipClamp( &tmpMip, &trueColorMip );
+#if 0
+      txMipView( &tmpMip, "blah", FXTRUE, 0 );
+#endif
+    }
+    
+  
+#if 0
+  if( _heapchk() != _HEAPOK )
+    txPanic( "_heapchk failed" );
+#endif
+  txFree( trueColorMip.data[0] );
+
+  trueColorMip = tmpMip;
+
+  /*
+   * Generate mipmap levels.
+   */
+#ifdef GLIDE3
+  trueColorMip.depth          = info->header.large_lod - info->header.small_lod + 1;
+#else
+  trueColorMip.depth          = info->header.small_lod - info->header.large_lod + 1;
+#endif
+  txMipMipmap( &trueColorMip );
+
+#if 0
+  txMipView( &trueColorMip, "blah", FXTRUE, 0 );
+#endif
+
+  /*
+   * Convert from true color to the output color format.
+   */
+  memset( &outputMip, 0, sizeof( outputMip ) );
+  outputMip.format         = info->header.format;
+  outputMip.width          = info->header.width;
+  outputMip.height         = info->header.height;
+  outputMip.depth          = trueColorMip.depth;
+  outputMip.data[0]        = info->data;
+#if 0
+  txMipAlloc( &outputMip );
+#else
+  txMipSetMipPointers( &outputMip );
+#endif
+  
+  if( ( flags & TX_TARGET_PALNCC_MASK ) == TX_TARGET_PALNCC_SOURCE )
+    {
+      txMipTrueToFixedPal( &outputMip, &trueColorMip, palNcc, 
+                           flags & TX_FIXED_PAL_QUANT_MASK );
+    }
+  else
+    {
+      txMipQuantize( &outputMip, &trueColorMip, outputMip.format, 
+                     flags & TX_DITHER_MASK, flags & TX_COMPRESSION_MASK );
+    }
+
+  info->data = outputMip.data[0];
+
+  if( ( info->header.format == GR_TEXFMT_YIQ_422 ) ||
+      ( info->header.format == GR_TEXFMT_AYIQ_8422 ) )
+    {
+      txPalToNcc( &info->table.nccTable, outputMip.pal );
+    }
+  
+  if( info->header.format == GR_TEXFMT_P_8 || info->header.format == GR_TEXFMT_AP_88 )
+    {
+      memcpy( info->table.palette.data, outputMip.pal, sizeof( FxU32 ) * 256 );
+    }
+
+  txFree( trueColorMip.data[0] );
+
+  return FXTRUE;
+}
+
+
Index: trunk/src/opengl/glide/sst1/texus/tga.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/tga.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/tga.c	(revision 2885)
@@ -0,0 +1,431 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:39 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+
+typedef struct _tgaHeader{
+    FxU8 IDLength;
+    FxU8 CMapType;
+    FxU8 ImgType;
+    FxU8 CMapStartLo;
+    FxU8 CMapStartHi;
+    FxU8 CMapLengthLo;
+    FxU8 CMapLengthHi;
+    FxU8 CMapDepth;
+    FxU8 XOffSetLo;
+    FxU8 XOffSetHi;
+    FxU8 YOffSetLo;
+    FxU8 YOffSetHi;
+    FxU8 WidthLo;
+    FxU8 WidthHi;
+    FxU8 HeightLo;
+    FxU8 HeightHi;
+    FxU8 PixelDepth;
+    FxU8 ImageDescriptor;
+} TgaHeader;
+
+/* Definitions for image types. */
+#define TGA_NULL	0
+#define TGA_CMAP	1
+#define TGA_TRUE	2
+#define TGA_MONO	3
+#define TGA_CMAP_RLE	9
+#define TGA_TRUE_RLE	10
+#define TGA_MONO_RLE	11
+
+FxBool
+_txReadTGAHeader( FILE *stream, FxU32 cookie, TxMip *info)
+{
+    TgaHeader	*tgaHeader = (TgaHeader *) info->pal;
+    int			i;
+
+    // Fill up rest of the TGA header. 
+    if ( fread( &(tgaHeader->ImgType), 1, sizeof(TgaHeader)-2, stream ) != 
+    	sizeof(TgaHeader)-2) {
+    	txPanic("Unexpected end of file.");
+    	return FXFALSE;
+    }
+    tgaHeader->IDLength	= (FxU8) ((cookie >>  8) & 0xFF);
+    tgaHeader->CMapType = (FxU8) ((cookie      ) & 0xFF);
+
+    // Optionally, skip the image id fields.
+    for (i= (tgaHeader->IDLength) & 0xFF; i; i--) {
+    	int	c;
+
+    	if ((c = getc(stream)) == EOF) {
+    		txPanic("Unexpected EOF.");
+    		return FXFALSE;
+    	}
+    }
+
+    // 3Dfx specific part here.
+    info->width  = tgaHeader->WidthHi << 8 | tgaHeader->WidthLo;
+    info->height = tgaHeader->HeightHi << 8 | tgaHeader->HeightLo;
+    info->depth  = 1;
+
+    if ((info->width <= 0) || (info->height <= 0)) {
+    	txError("TGA Image: width or height is 0.");
+    	return FXFALSE;
+    }
+
+    switch(tgaHeader->ImgType) {
+    case TGA_MONO:
+    case TGA_MONO_RLE:			// True color image.
+    	if (tgaHeader->PixelDepth != 8) {
+	    txError("TGA Image: Mono image is not 8 bits/pixel.");
+	    return FXFALSE;
+    	}
+    	info->format = GR_TEXFMT_I_8;
+    	break;
+
+    case TGA_TRUE:
+    case TGA_TRUE_RLE:
+    	switch (tgaHeader->PixelDepth ) {
+    	case	15: 
+    	case	16: 
+			info->format = GR_TEXFMT_ARGB_1555; break;
+    	case	24: 
+    	case	32: 
+			info->format = GR_TEXFMT_ARGB_8888; break;
+    	default:	
+    			txError("TGA Image: True color image is not 24/32 bits/pixel.");
+    			return FXFALSE; 
+    			break;
+    	}
+    	break;
+      
+    case TGA_CMAP:
+    case TGA_CMAP_RLE:			// Color mapped image.
+    	if ( tgaHeader->CMapType     != 1 ) {
+    		txError("TGA Image: Color-mapped TGA image has no palette");
+    		return FXFALSE;
+    	}
+    	if (((tgaHeader->CMapLengthLo + tgaHeader->CMapLengthHi * 256L)
+    	    +(tgaHeader->CMapStartLo + tgaHeader->CMapStartHi * 256L)) > 256){
+    		txError("TGA Image: Color-mapped image has > 256 colors");
+    		return FXFALSE;
+    	}
+    	info->format = GR_TEXFMT_P_8;
+    	break;
+
+    default:
+    	txError("TGA Image: unsupported format");
+    	return  FXFALSE;
+    }
+    info->size = info->width*info->height*GR_TEXFMT_SIZE(info->format);
+
+    return FXTRUE;
+}
+
+static FxBool
+_txReadTGAColorMap(FILE *stream, const TgaHeader *tgaHeader, FxU32 *palette)
+{
+    int		cmapStart;
+    int		cmapLength;
+    int		cmapDepth;
+    int		i;
+
+    cmapStart   = tgaHeader->CMapStartLo;
+    cmapStart  += tgaHeader->CMapStartHi * 256L;
+
+    cmapLength  = tgaHeader->CMapLengthLo;
+    cmapLength += tgaHeader->CMapLengthHi * 256L;
+
+    cmapDepth   = tgaHeader->CMapDepth;
+
+    if (tgaHeader->CMapType == 0) return FXTRUE;		// no colormap.
+
+    /* Validate some parameters */
+    if (cmapStart < 0) {
+    	txError("TGA Image: Bad Color Map start value.");
+    	return FXFALSE;
+    }
+
+    cmapDepth = (cmapDepth + 1) >> 3;		// to bytes.
+    if ((cmapDepth <= 0) || (cmapDepth > 4)) {
+    	txError("TGA Image: Bad Color Map depth.");
+    	return FXFALSE;
+    }
+
+    // May have to skip the color map.
+    if ((tgaHeader->ImgType != TGA_CMAP) && 
+    	(tgaHeader->ImgType != TGA_CMAP_RLE)) {
+    	/* True color, yet there is a palette, this is OK, just skip. */
+
+    	cmapLength *= cmapDepth;
+    	while (cmapLength--) {
+    		int		c;
+
+    		c = getc(stream);
+    		if (c == EOF) {
+    			txError("TGA Image: Unexpected EOF reading Color Map.");
+    			return FXFALSE;
+    		}
+    	}
+    	return FXTRUE;
+    }
+
+    // This is a real palette that's going to be used. 
+
+    // Verify that it's not too large.
+    if ((cmapStart + cmapLength) > 256) {
+    	txError("TGA Image: Color Map > 256 entries.");
+    	return FXFALSE;
+    }
+
+
+    // printf("cmapdepth = %d, start = %d, length = %d\n", cmapDepth,
+    // 	cmapStart, cmapLength);
+    for (i=0; i<256; i++) {
+    	int	r, g, b, a;
+
+    	if ((i < cmapStart) || (i >= (cmapStart + cmapLength))) {
+    		palette[i] = 0;
+    		// printf("Skipping palette entry %d\n", i);
+    		continue;
+    	}
+
+    	// Read this colormap entry.
+    	switch (cmapDepth) {
+    	case 1:	// 8 bpp
+    		r = getc(stream);
+    		if (r == EOF) {
+  		    txError("TGA Image: Unexpected End of File.");
+		    return FXFALSE;
+    		}
+    		r &= 0xFF;
+    		palette[i] = (r << 24) | (r << 16) | (r << 8) | (r);
+   		break;
+
+    	case 2:	// 15, 16 bpp.
+
+   		b = getc(stream);
+   		r = getc(stream);
+   		if ((r == EOF) || (b == EOF)) {
+   			txError("TGA Image: Unexpected End of File.");
+   			return FXFALSE;
+   		}
+   		r &= 0xFF;
+   		b &= 0xFF;
+   		g = ((r & 0x3) << 6) + ((b & 0xE0) >> 2);
+   		r = (r & 0x7C) << 1;
+   		b = (b & 0x1F) << 3;
+
+   		palette[i] = (r << 16) | (g << 8) | (b) | 0xFF000000L;
+   		break;
+
+    	case 3:
+    	case 4:
+   		b = getc(stream);
+   		g = getc(stream);
+   		r = getc(stream);
+   		a = (cmapDepth == 4) ? getc(stream) : 0x0FF;
+
+   		if ((r == EOF) || (g == EOF) || (b == EOF) | (a == EOF)) {
+   			txError("TGA Image: Unexpected End of File.");
+   			return FXFALSE;
+   		}
+   		palette[i] = (a << 24) | (r << 16) | (g << 8) | b;
+   		// printf("Setting palette %3d to %.08x\n", i, palette[i]);
+   		break;
+
+    	default:
+    		txError("TGA Image: Bad Color Map depth.");
+    		return FXFALSE;
+    	}
+    }
+    return FXTRUE;
+}
+
+static	int	tgaRLE, tgaRLEflag, tgaRLEcount, tgaRLEsav[4]; 
+
+static	FxBool
+_txReadTGARLEPixel( FILE *stream, FxU8 *data, int pixsize)
+{
+    int		c, i;
+
+    // Run length encoded data Only
+    if (tgaRLEcount == 0) {
+    	// Need to restart the run.
+    	if ( (tgaRLEcount = c = getc( stream )) == EOF) {
+    		txError("TGA Image: Unexpected End of File.");
+    		return FXFALSE;
+    	}
+    	tgaRLEflag = tgaRLEcount & 0x80;
+    	tgaRLEcount = (tgaRLEcount & 0x7F) + 1;
+
+    	if (tgaRLEflag) {
+	    // Replicated color, read the color to be replicated 
+    	    for (i=0; i<pixsize; i++) {
+		if ( (c = getc( stream )) == EOF) {
+    		    txError("TGA Image: Unexpected End of File\n");
+    		    return FXFALSE;
+    		}
+    		tgaRLEsav[i] = (FxU8) c;
+    	    }
+    	}
+    }
+
+    // Now deliver the data either from input or from saved values.
+    tgaRLEcount--;
+    if (tgaRLEflag) {
+    	// deliver from saved data.
+    	for (i=0; i<pixsize; i++) *data++ = (FxU8) tgaRLEsav[i];
+    } else {
+    	for (i=0; i<pixsize; i++) {
+    	    if ( (c = getc( stream )) == EOF) {
+    		txError("TGA Image: Unexpected End of File\n");
+    		return FXFALSE;
+	    }
+    	    *data++ = (FxU8) c;
+    	}
+    }
+    return FXTRUE;
+}
+
+static FxBool
+_txReadTGASpan( FILE *stream, FxU8 *data, int w, int pixsize)
+{
+    if (tgaRLE == 0) {
+    	if ( fread( data, 1, w * pixsize, stream) != (FxU32)(w * pixsize)) {
+    		txError("TGA Image: Unexpected End of File\n");
+    		return FXFALSE;
+    	}
+    	return FXTRUE;
+    }
+
+    // Otherwise, RLE data.
+    while (w--) {
+    	if (!_txReadTGARLEPixel( stream, data, pixsize)) {
+	    return FXFALSE;
+    	}
+    	data += pixsize;
+    }
+    return FXTRUE;
+}
+
+FxBool
+_txReadTGAData( FILE *stream, TxMip *info)
+{
+    TgaHeader	*tgaHeader = (TgaHeader *) info->pal;
+    int		i, stride;
+    int 	bpp;			// bytesPerPixel
+    FxU8*	data;
+    long	BigEndian = 0xff000000;
+
+    // printf("TxREAD TGA DATA\n");
+    tgaRLEcount = 0;
+
+    bpp = (tgaHeader->PixelDepth + 1) >> 3;
+
+    switch (tgaHeader->ImgType) {
+    case TGA_MONO:	tgaRLE = 0; info->format = GR_TEXFMT_I_8; break;
+    case TGA_MONO_RLE:	tgaRLE = 1; info->format = GR_TEXFMT_I_8; break;
+
+    case TGA_TRUE:	tgaRLE = 0; info->format = (bpp == 2) ? 
+    			GR_TEXFMT_ARGB_1555 : GR_TEXFMT_ARGB_8888; break;
+    case TGA_TRUE_RLE:	tgaRLE = 1; info->format = (bpp == 2) ? 
+    			GR_TEXFMT_ARGB_1555 : GR_TEXFMT_ARGB_8888; break;
+
+    case TGA_CMAP:	tgaRLE = 0; info->format = GR_TEXFMT_P_8; break;
+    case TGA_CMAP_RLE:	tgaRLE = 1; info->format = GR_TEXFMT_P_8; break;
+    }
+
+    // printf("bpp = %d, rle = %d\n", bpp, tgaRLE);
+
+    stride =  info->width * bpp;
+    data   =  info->data[0];
+    if ((tgaHeader->ImageDescriptor & 0x20) == 0) {
+    	// Origin is lower left
+    	data   = data + (info->height-1) * stride;
+    	stride = -stride;
+    }
+
+    /* If there's a colormap, read it now. */
+    if (!_txReadTGAColorMap(stream, tgaHeader, (FxU32 *) &(info->pal[0]))) 
+    	return FXFALSE;
+    // printf("read in color map\n");
+
+    /* Read in all the data */
+    for ( i = 0; i < info->height; i++) {
+    	if (!_txReadTGASpan( stream, data, info->width, bpp)) {
+    			txError("TGA Image: Unexpected end of file.");
+    			return FXFALSE;
+    	}
+    	data += stride;
+    }
+
+    /*
+     * BPP == 1 -> P8 or I8 formatted data.
+     * BPP == 2 -> ARGB1555 formatted data.
+     * BPP == 4 -> ARGB8888 formatted data.
+     * BPP == 3  should be translated to ARGB8888 from RGB888.
+     */
+    // printf("Repacking\n");
+    if (bpp == 3) {
+    	int		npixels = info->width * info->height;
+    	FxU8	*src = ((FxU8 *) info->data[0]) + (npixels - 1) * 3;
+    	FxU8	*dst = ((FxU8 *) info->data[0]) + (npixels - 1) * 4;
+
+    	while (npixels--) {
+    		dst[3] = 0xFF;
+    		dst[2] = src[2];
+    		dst[1] = src[1];
+    		dst[0] = src[0];
+    		dst -= 4;
+    		src -= 3;
+    	}
+    }
+    // printf("Done\n");
+    if (*(FxU8 *)&BigEndian) {
+	/* Repack 16bpp and 32bpp cases */
+        if (bpp == 2) {
+    	    int		npixels = info->width * info->height;
+    	    FxU16	*src = (FxU16 *) info->data[0];
+
+    	    while (npixels--) {
+            	*src = (*src << 8) | ((*src >> 8) & 0xff);
+                src++;
+    	    }
+        }
+        if ((bpp == 3) || (bpp == 4)) {
+    	    int		npixels = info->width * info->height;
+    	    FxU32	*src = (FxU32 *) info->data[0];
+
+    	    while (npixels--) {
+            	*src = (((*src      ) & 0xff)  << 24)|
+            	       (((*src >>  8) & 0xff)  << 16)|
+            	       (((*src >> 16) & 0xff)  <<  8)|
+            	       (((*src >> 24) & 0xff)       );
+                src++;
+    	    }
+        }
+    }
+    return FXTRUE;
+}
Index: trunk/src/opengl/glide/sst1/texus/util.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/util.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/util.c	(revision 2885)
@@ -0,0 +1,495 @@
+
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:40 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+int txVerbose = 0;
+
+char *Format_Name[] = {
+         "rgb332",                              // GR_TEXFMT_RGB_332 
+         "yiq",                                 // GR_TEXFMT_YIQ_422
+         "a8",                                  // GR_TEXFMT_ALPHA_8
+         "i8",                                  // GR_TEXFMT_INTENSITY_8
+         "ai44",                                // GR_TEXFMT_ALPHA_INTENSITY_44
+         "p8",                                  // GR_TEXFMT_P_8
+         "rsvd1",                               // GR_TEXFMT_RSVD1
+         "rsvd2",                               // GR_TEXFMT_RSVD2
+         "argb8332",                            // GR_TEXFMT_ARGB_8332
+         "ayiq8422",                            // GR_TEXFMT_AYIQ_8422
+         "rgb565",                              // GR_TEXFMT_RGB_565
+         "argb1555",                            // GR_TEXFMT_ARGB_1555
+         "argb4444",                            // GR_TEXFMT_ARGB_4444
+         "ai88",                                // GR_TEXFMT_ALPHA_INTENSITY_88
+         "ap88",                                // GR_TEXFMT_AP_88
+         "rsvd4",                               // GR_TEXFMT_RSVD4
+         "argb8888",                            // GR_TEXFMT_ARGB_8888
+};
+
+
+int
+txLog2(int n)
+{
+        switch (n) {
+        case    1:              return 0;
+        case    2:              return 1;
+        case    4:              return 2;
+        case    8:              return 3;
+        case    16:             return 4;
+        case    32:             return 5;
+        case    64:             return 6;
+        case    128:    return 7;
+        case    256:    return 8;
+        }
+
+        txPanic("Bad arg to Log2\n");
+        return 0;               // to keep compiler quiet.
+}
+
+int
+txFloorPow2(int n)
+{
+        // Find next smallest integer which is also a power of 2.
+
+        int             i;
+
+        if ((n & (n -1)) == 0) {
+                return n;               // already a power of 2.
+        }
+
+        for (i=1; i<= n; i+=i);
+        return i>>1;
+}
+
+int
+txCeilPow2(int n)
+{
+        // Find next smallest integer which is also a power of 2.
+
+        int             i;
+
+        if ((n & (n -1)) == 0) return n;                // already a power of 2.
+
+        for (i=1; i<= n; i+=i);
+        return i;
+}
+
+extern TxErrorCallbackFnc_t _txErrorCallback;
+
+void
+txPanic(char *message)
+{
+        _txErrorCallback( message, FXTRUE );
+}
+
+void
+txError(char *message)
+{
+        _txErrorCallback( message, FXFALSE );
+}
+
+int
+txGCD(int a, int b)
+{
+        // Greatest common divisor, used in resampling.
+
+        if (b > a) { int t;     t = a; a = b; b = t;}
+
+        // a>b here.
+
+        while (b > 0) {
+                int             t;
+
+                t = a % b;
+                a = b;
+                b = t;
+        }
+        return a;
+}
+
+void
+txYABtoPal256(long *palette, const long* yabTable)
+{
+        // Convert YAB table to a 256 color palette 
+        // Assume yabTable[] has first 16Y's, 12 A's, 12 B's
+
+        const   long    *Y = yabTable;
+        const   long    *A = yabTable + 16;
+        const   long    *B = yabTable + 16 + 12;
+        int             i;
+
+        for (i=0; i<256; i++) {
+                int             iy, ia, ib, r, g, b;
+
+                iy = (i >> 4) & 0xF;
+                ia = (i >> 2) & 0x3;
+                ib = (i >> 0) & 0x3;
+
+                r = Y[iy] + A[3*ia + 0] + B[3*ib + 0];
+                g = Y[iy] + A[3*ia + 1] + B[3*ib + 1];
+                b = Y[iy] + A[3*ia + 2] + B[3*ib + 2];
+
+                if (r < 0) r = 0; if (r > 255) r = 255;
+                if (g < 0) g = 0; if (g > 255) g = 255;
+                if (b < 0) b = 0; if (b > 255) b = 255;
+
+                palette[i] = (r << 16) | (g << 8) | b;
+        }
+}
+
+/*
+ * The following table was generated from this piece of code:
+
+main()
+{
+        int     i;
+
+        printf("static int      _explode3[256+256+4] = {\n");
+
+        for (i=-255; i<256; i++) {
+                int             k;
+                int             bits;
+
+                k = (i < 0) ? -i : i;
+                bits = 0;
+
+                if (k & 0x01) bits += 0x00000001 << 0;
+                if (k & 0x02) bits += 0x00000001 << 3;
+                if (k & 0x04) bits += 0x00000001 << 6;
+                if (k & 0x08) bits += 0x00000001 << 9;
+                if (k & 0x10) bits += 0x00000001 << 12;
+                if (k & 0x20) bits += 0x00000001 << 15;
+                if (k & 0x40) bits += 0x00000001 << 18;
+                if (k & 0x80) bits += 0x00000001 << 21;
+
+                // explode3[i] = bits;
+                printf("0x%.06x,", bits);
+                if (((i + 255) % 8) == 7) printf("\n");
+        }
+        printf("\n};\n");
+        printf("static int  *explode3 = &_explode3[255];\n");
+}
+ */
+
+int     _explode3[255+256] = {
+0x249249,0x249248,0x249241,0x249240,0x249209,0x249208,0x249201,0x249200,
+0x249049,0x249048,0x249041,0x249040,0x249009,0x249008,0x249001,0x249000,
+0x248249,0x248248,0x248241,0x248240,0x248209,0x248208,0x248201,0x248200,
+0x248049,0x248048,0x248041,0x248040,0x248009,0x248008,0x248001,0x248000,
+0x241249,0x241248,0x241241,0x241240,0x241209,0x241208,0x241201,0x241200,
+0x241049,0x241048,0x241041,0x241040,0x241009,0x241008,0x241001,0x241000,
+0x240249,0x240248,0x240241,0x240240,0x240209,0x240208,0x240201,0x240200,
+0x240049,0x240048,0x240041,0x240040,0x240009,0x240008,0x240001,0x240000,
+0x209249,0x209248,0x209241,0x209240,0x209209,0x209208,0x209201,0x209200,
+0x209049,0x209048,0x209041,0x209040,0x209009,0x209008,0x209001,0x209000,
+0x208249,0x208248,0x208241,0x208240,0x208209,0x208208,0x208201,0x208200,
+0x208049,0x208048,0x208041,0x208040,0x208009,0x208008,0x208001,0x208000,
+0x201249,0x201248,0x201241,0x201240,0x201209,0x201208,0x201201,0x201200,
+0x201049,0x201048,0x201041,0x201040,0x201009,0x201008,0x201001,0x201000,
+0x200249,0x200248,0x200241,0x200240,0x200209,0x200208,0x200201,0x200200,
+0x200049,0x200048,0x200041,0x200040,0x200009,0x200008,0x200001,0x200000,
+0x049249,0x049248,0x049241,0x049240,0x049209,0x049208,0x049201,0x049200,
+0x049049,0x049048,0x049041,0x049040,0x049009,0x049008,0x049001,0x049000,
+0x048249,0x048248,0x048241,0x048240,0x048209,0x048208,0x048201,0x048200,
+0x048049,0x048048,0x048041,0x048040,0x048009,0x048008,0x048001,0x048000,
+0x041249,0x041248,0x041241,0x041240,0x041209,0x041208,0x041201,0x041200,
+0x041049,0x041048,0x041041,0x041040,0x041009,0x041008,0x041001,0x041000,
+0x040249,0x040248,0x040241,0x040240,0x040209,0x040208,0x040201,0x040200,
+0x040049,0x040048,0x040041,0x040040,0x040009,0x040008,0x040001,0x040000,
+0x009249,0x009248,0x009241,0x009240,0x009209,0x009208,0x009201,0x009200,
+0x009049,0x009048,0x009041,0x009040,0x009009,0x009008,0x009001,0x009000,
+0x008249,0x008248,0x008241,0x008240,0x008209,0x008208,0x008201,0x008200,
+0x008049,0x008048,0x008041,0x008040,0x008009,0x008008,0x008001,0x008000,
+0x001249,0x001248,0x001241,0x001240,0x001209,0x001208,0x001201,0x001200,
+0x001049,0x001048,0x001041,0x001040,0x001009,0x001008,0x001001,0x001000,
+0x000249,0x000248,0x000241,0x000240,0x000209,0x000208,0x000201,0x000200,
+0x000049,0x000048,0x000041,0x000040,0x000009,0x000008,0x000001,0x000000,
+0x000001,0x000008,0x000009,0x000040,0x000041,0x000048,0x000049,0x000200,
+0x000201,0x000208,0x000209,0x000240,0x000241,0x000248,0x000249,0x001000,
+0x001001,0x001008,0x001009,0x001040,0x001041,0x001048,0x001049,0x001200,
+0x001201,0x001208,0x001209,0x001240,0x001241,0x001248,0x001249,0x008000,
+0x008001,0x008008,0x008009,0x008040,0x008041,0x008048,0x008049,0x008200,
+0x008201,0x008208,0x008209,0x008240,0x008241,0x008248,0x008249,0x009000,
+0x009001,0x009008,0x009009,0x009040,0x009041,0x009048,0x009049,0x009200,
+0x009201,0x009208,0x009209,0x009240,0x009241,0x009248,0x009249,0x040000,
+0x040001,0x040008,0x040009,0x040040,0x040041,0x040048,0x040049,0x040200,
+0x040201,0x040208,0x040209,0x040240,0x040241,0x040248,0x040249,0x041000,
+0x041001,0x041008,0x041009,0x041040,0x041041,0x041048,0x041049,0x041200,
+0x041201,0x041208,0x041209,0x041240,0x041241,0x041248,0x041249,0x048000,
+0x048001,0x048008,0x048009,0x048040,0x048041,0x048048,0x048049,0x048200,
+0x048201,0x048208,0x048209,0x048240,0x048241,0x048248,0x048249,0x049000,
+0x049001,0x049008,0x049009,0x049040,0x049041,0x049048,0x049049,0x049200,
+0x049201,0x049208,0x049209,0x049240,0x049241,0x049248,0x049249,0x200000,
+0x200001,0x200008,0x200009,0x200040,0x200041,0x200048,0x200049,0x200200,
+0x200201,0x200208,0x200209,0x200240,0x200241,0x200248,0x200249,0x201000,
+0x201001,0x201008,0x201009,0x201040,0x201041,0x201048,0x201049,0x201200,
+0x201201,0x201208,0x201209,0x201240,0x201241,0x201248,0x201249,0x208000,
+0x208001,0x208008,0x208009,0x208040,0x208041,0x208048,0x208049,0x208200,
+0x208201,0x208208,0x208209,0x208240,0x208241,0x208248,0x208249,0x209000,
+0x209001,0x209008,0x209009,0x209040,0x209041,0x209048,0x209049,0x209200,
+0x209201,0x209208,0x209209,0x209240,0x209241,0x209248,0x209249,0x240000,
+0x240001,0x240008,0x240009,0x240040,0x240041,0x240048,0x240049,0x240200,
+0x240201,0x240208,0x240209,0x240240,0x240241,0x240248,0x240249,0x241000,
+0x241001,0x241008,0x241009,0x241040,0x241041,0x241048,0x241049,0x241200,
+0x241201,0x241208,0x241209,0x241240,0x241241,0x241248,0x241249,0x248000,
+0x248001,0x248008,0x248009,0x248040,0x248041,0x248048,0x248049,0x248200,
+0x248201,0x248208,0x248209,0x248240,0x248241,0x248248,0x248249,0x249000,
+0x249001,0x249008,0x249009,0x249040,0x249041,0x249048,0x249049,0x249200,
+0x249201,0x249208,0x249209,0x249240,0x249241,0x249248,0x249249,
+};
+int  *explode3 = &_explode3[255];
+
+int
+txNearestColor(long ir, long ig, long ib, const FxU32 *pal, int ncolors)
+{
+        int             i, d; 
+        int             mindist, minpos;                // closest distance to input
+
+        if (&explode3[-255] != &_explode3[0])
+                txPanic("Bad explode\n");
+
+        mindist = DISTANCE((*pal>>16)&0xff, (*pal>>8)&0xff, (*pal)&0xff, 
+                ir, ig, ib);
+        minpos  = 0;
+        pal ++;
+
+        /* Find closest color */
+        for (i=1; i<ncolors; i++, pal ++) {
+                d = DISTANCE((*pal>>16)&0xff, (*pal>>8)&0xff, (*pal)&0xff, 
+                        ir, ig, ib);
+                if (d < mindist) { mindist = d; minpos = i; }
+        }
+        return minpos;          // best fit color is returned.
+}
+
+#ifdef GLIDE3
+int
+txAspectRatio(int w, int h)
+{
+        int             ar;
+
+        ar = (w >= h) ? (((w/h) << 4) | 1) : ((1 << 4) | (h/w));
+        switch (ar) {
+        case    0x81:   return 6;
+        case    0x41:   return 5;
+        case    0x21:   return 4;
+        case    0x11:   return 3;
+        case    0x12:   return 2;
+        case    0x14:   return 1;
+        case    0x18:   return 0;
+        }
+        return 0;
+}
+#else
+int
+txAspectRatio(int w, int h)
+{
+        int             ar;
+
+        ar = (w >= h) ? (((w/h) << 4) | 1) : ((1 << 4) | (h/w));
+        switch (ar) {
+        case    0x81:   return 0;
+        case    0x41:   return 1;
+        case    0x21:   return 2;
+        case    0x11:   return 3;
+        case    0x12:   return 4;
+        case    0x14:   return 5;
+        case    0x18:   return 6;
+        }
+        return 0;
+}
+#endif /* GLIDE3 */
+
+void
+txRectCopy(FxU8 *dst, int dstStride, const FxU8 *src, int srcStride, 
+        int width, int height)
+{
+        // Copy a rectangular region from src to dst, each with different strides.
+
+        while (height--) {
+                int             i;
+                for (i=0; i<width; i++) {
+                        dst[i] = src[i];
+                }
+                dst += dstStride;
+                src += srcStride;
+        }
+}
+
+int
+txMemRequired(TxMip *txMip)
+{
+        /* Tell me how much memory is need to hold this mipmap */
+        int             w, h, memsize, i;
+
+        w = txMip->width;
+        h = txMip->height;
+        memsize = 0;
+
+        for (i=0; i<txMip->depth; i++) {
+                memsize += (w * h);
+                if (w > 1) w >>= 1;
+                if (h > 1) h >>= 1;
+        }
+        return memsize * GR_TEXFMT_SIZE(txMip->format);
+}
+
+FxBool
+txMipAlloc(TxMip *txMip)
+{
+        int             i, w, h;
+        FxU8    *data;
+
+        txMip->size = txMemRequired(txMip);
+
+        data = (FxU8 *) txMalloc(txMip->size);
+        if (data == NULL) return FXFALSE;
+        w = txMip->width;
+        h = txMip->height;
+
+        for (i=0; i<TX_MAX_LEVEL; i++) {
+                if (i >= txMip->depth) {
+                        txMip->data[i] = NULL;
+                        continue;
+                }
+                txMip->data[i] = data;
+                data += (w * h * GR_TEXFMT_SIZE(txMip->format));
+                if (w > 1) w >>= 1;
+                if (h > 1) h >>= 1;
+        }
+        return FXTRUE;
+}
+
+FxBool
+txMipSetMipPointers(TxMip *txMip)
+{
+        int             i, w, h;
+        FxU8    *data = txMip->data[0];
+
+        txMip->size = txMemRequired(txMip);
+
+        w = txMip->width;
+        h = txMip->height;
+
+        for (i=0; i<TX_MAX_LEVEL; i++) {
+                if (i >= txMip->depth) {
+                        txMip->data[i] = NULL;
+                        continue;
+                }
+                txMip->data[i] = data;
+                data += (w * h * GR_TEXFMT_SIZE(txMip->format));
+                if (w > 1) w >>= 1;
+                if (h > 1) h >>= 1;
+        }
+        return FXTRUE;
+}
+
+void
+txBasename(const char *name, char* basename)
+{
+        /* Strip the pathname and leave us with filename.ext */
+        char    *s; 
+        const   char *p, *slash;
+
+        /* Find the last slash */
+        for (p = slash = name; *p;  p++) {
+                if ((*p == '/') || (*p == '\\')) slash = p + 1;
+        }
+
+        /* Copy everything after the last slash to output */
+        strcpy(basename, slash);
+
+        // Walk to end of string */
+        for (s = basename; *s; s++);
+
+        // Walk backwards; replace any . with 0 
+        while (--s >= basename) {
+                if (*s == '.') {*s = 0; break;}
+        }
+}
+
+void
+txPathAndBasename(const char *name, char* basename)
+{
+        /* Strip the extension and leave us with path,basename */
+        char    *s;
+
+        strcpy(basename, name);
+
+        /* Walk to the end of the string */
+        for (s = basename; *s; s++);
+
+        /* Walk backwards; stop when you hit a slash; replace any . with 0. */
+        while (--s >= basename) {
+                if ((*s == '/') || (*s == '\\')) break;
+                if (*s == '.') {*s = 0; break;}
+
+        }
+}
+
+void
+txExtension(const char *name, char *extname)
+{
+        const char      *p, *ext;
+
+        ext = NULL;
+        for (p = name; *p;  p++) {
+                if (*p == '.')  ext = p;
+        }
+
+        if (ext) 
+            while (*ext)  *extname++ = *ext++;
+        
+        *extname = 0;
+}
+
+void
+txMipFree( TxMip *mip )
+{
+  int i;
+
+  txFree( mip->data[0] );
+  for( i = 0; i < TX_MAX_LEVEL; i++ )
+    mip->data[i] = NULL;
+}
+
+void *txMalloc( size_t size )
+{
+  return malloc( size );
+}
+
+void txFree( void *ptr )
+{
+  free( ptr );
+}
+
+void *txRealloc( void *ptr, size_t size )
+{
+  return realloc( ptr, size );
+}
+
Index: trunk/src/opengl/glide/sst1/texus/view.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/view.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/view.c	(revision 2885)
@@ -0,0 +1,33 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+**
+** $Revision: 1.1 $
+** $Date: 2000-02-25 00:31:40 $
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+void    txMipView(TxMip *txMip, char *filename, int wait, int bgcolor) { }
+void    txViewClose() { }
+
Index: trunk/src/opengl/glide/sst1/texus/write.c
===================================================================
--- trunk/src/opengl/glide/sst1/texus/write.c	(revision 2885)
+++ trunk/src/opengl/glide/sst1/texus/write.c	(revision 2885)
@@ -0,0 +1,395 @@
+/*
+** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
+** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
+** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
+** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
+** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
+** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
+** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
+** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
+** 
+** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
+** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+** THE UNITED STATES.  
+** 
+** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "texusint.h"
+
+/*
+ * The only two file formats we can write are: 3df and tga.
+ */
+static  char *Version = "1.1";
+static char* aspect_names[] = { "8 1", "4 1", "2 1", "1 1", 
+                                                        "1 2", "1 4", "1 8" };
+
+/*************************************** tga files ****************************/
+/* 
+ * Write a tga file from an ARGB8888 mipmap.
+ */
+static FxBool 
+txWriteTGA( FILE *stream, TxMip *txMip)
+{
+
+    struct {
+        FxU8 IDLength;
+        FxU8 ColorMapType;
+        FxU8 ImgType;
+        FxU8 CMapStartLo;
+        FxU8 CMapStartHi;
+        FxU8 CMapLengthLo;
+        FxU8 CMapLengthHi;
+        FxU8 CMapDepth;
+        FxU8 XOffSetLo;
+        FxU8 XOffSetHi;
+        FxU8 YOffSetLo;
+        FxU8 YOffSetHi;
+        FxU8 WidthLo;
+        FxU8 WidthHi;
+        FxU8 HeightLo;
+        FxU8 HeightHi;
+        FxU8 PixelDepth;
+        FxU8 ImageDescriptor;
+    } tgaHeader;
+
+    FxU8        *data, *p;
+    FxU32       *data32;
+    int         outW, outH, w, h, i;
+
+    if (txMip->format != GR_TEXFMT_ARGB_8888) {
+        txPanic("TGA Image: Write: input format must be ARGB8888.");
+    }
+    if ( stream == NULL ) {
+        txPanic("Bad file handle");
+        return FXFALSE;
+    }
+    
+    outW = txMip->width;
+    outH = txMip->height;
+    if (txMip->depth > 1) outW += outW/2;
+    
+    tgaHeader.IDLength         = 0;
+    tgaHeader.ColorMapType     = 0;
+    tgaHeader.ImgType          = 0x2;
+    tgaHeader.CMapStartLo      = 0;
+    tgaHeader.CMapStartHi      = 0;
+    tgaHeader.CMapLengthLo     = 0;
+    tgaHeader.CMapLengthHi     = 0;
+    tgaHeader.CMapDepth        = 0;
+    tgaHeader.XOffSetLo        = 0;
+    tgaHeader.XOffSetHi        = 0;
+    tgaHeader.YOffSetLo        = 0;
+    tgaHeader.YOffSetHi        = 0;
+    tgaHeader.WidthHi          = (FxU8)((outW >> 8) & 0xFF);
+    tgaHeader.WidthLo          = (FxU8) (outW & 0xFF);
+    tgaHeader.HeightHi         = (FxU8)((outH >> 8) & 0xFF);
+    tgaHeader.HeightLo         = (FxU8) (outH & 0xFF);
+    tgaHeader.PixelDepth       = 32;
+    tgaHeader.ImageDescriptor  = 0x20;          // image always right side up.
+        
+
+    if ( fwrite( &tgaHeader, 1, 18, stream ) != 18 ) {
+        txPanic("TGA Header stream write error");
+        return FXFALSE;
+    }
+
+    /*
+     * Allocate memory to hold all mipmaps, and copy the mipmaps.
+     */
+    p = data = txMalloc(outW * outH * 4);
+    memset(data, 0, outW * outH * 4);
+
+    /* Copy level 0 into malloc'd area */
+    txRectCopy( data, outW * 4, txMip->data[0], txMip->width * 4, 
+        txMip->width * 4, txMip->height);
+
+    p += (txMip->width * 4);
+
+    /* Copy the rest of the levels to the right of level 0 */
+    w = txMip->width; 
+    h = txMip->height; 
+    for (i=1; i< txMip->depth; i++) {
+        // printf("Copying: level = %d\n", i);
+        if (w > 1) w >>= 1;
+        if (h > 1) h >>= 1;
+        txRectCopy(p, outW * 4, txMip->data[i], w * 4, w * 4, h);
+        p += ( h * outW * 4);
+    }
+
+    /* Write out the data */
+    data32 = (FxU32 *) data;
+    for (i=outW*outH; i; i--) {
+        putc(((*data32      ) & 0xff)    , stream);     
+        putc(((*data32 >>  8) & 0xff)    , stream);     
+        putc(((*data32 >> 16) & 0xff)    , stream);     
+        putc(((*data32 >> 24) & 0xff)    , stream);     
+        data32++;
+    }
+    return FXTRUE;
+}
+
+
+/*************************************** 3df files ****************************/
+/* Write word, msb first */
+
+static FxBool 
+_txWrite16 (FILE *stream, FxU16 data)
+{
+    FxU8 byte[2];
+
+    byte[0] = (FxU8) ((data >> 8) & 0xFF);
+    byte[1] = (FxU8) ((data     ) & 0xFF);
+
+    return (fwrite (byte, 2, 1, stream) != 1) ? FXFALSE : FXTRUE;
+}
+
+/* Write long word, msb first */
+
+static FxBool 
+_txWrite32 (FILE *stream, FxU32 data)
+{
+    FxU8 byte[4];
+
+    byte[0] = (FxU8) ((data >> 24) & 0xFF);
+    byte[1] = (FxU8) ((data >> 16) & 0xFF);
+    byte[2] = (FxU8) ((data >>  8) & 0xFF);
+    byte[3] = (FxU8) ((data      ) & 0xFF);
+
+    return (fwrite (byte, 4, 1, stream) != 1) ? FXFALSE : FXTRUE;
+}
+
+/* Write NCC table */
+static FxBool 
+_txWrite3dfNCCTable (FILE *stream, FxU32 *yab)
+{
+    int         i;
+
+    for (i = 0; i < 16; i++)
+        if (!_txWrite16 (stream, (FxU16) (yab[i] & 0x00ff))) return FXFALSE;
+
+    for (i = 0; i < 12; i++) 
+        if (!_txWrite16 (stream, (FxU16) (yab[16+i] & 0xffff))) return FXFALSE;
+
+    for (i = 0; i < 12; i++) 
+        if (!_txWrite16 (stream, (FxU16) (yab[28+i] & 0xffff))) return FXFALSE;
+
+    return FXTRUE;
+}
+
+static FxBool
+_txWrite3dfPalTable (FILE *stream, FxU32 *pal)
+{
+        int     i;
+
+        for (i=0; i<256; i++) {
+                if (!_txWrite32 (stream, pal[i])) return FXFALSE;
+        }
+        return FXTRUE;
+}
+
+static FxBool 
+txWrite3df (FILE *stream, TxMip *txMip)
+{
+    FxU32       i;
+    FxU32       n_pixels;
+    int         small_lod, large_lod, aspect;
+
+    /* Write out the header */
+    large_lod = (txMip->width > txMip->height) ? txMip->width : txMip->height;
+    small_lod = large_lod >> (txMip->depth - 1);
+    aspect    = txAspectRatio(txMip->width, txMip->height);
+
+    // printf("Format = %d\n", txMip->format);
+    // printf("Format = %s\n", Format_Name[txMip->format]);
+
+    // printf("Writing header...\n");
+    if (EOF == fprintf (stream, 
+        "3df v%s\n%s\nlod range: %d %d\naspect ratio: %s\n",
+        Version, 
+        Format_Name[txMip->format],
+        small_lod,
+        large_lod,
+        aspect_names[aspect])) return FXFALSE;
+
+    /* write out ncc table if necessary */
+    // printf("Writing NCC...\n");
+    if ((txMip->format == GR_TEXFMT_YIQ_422) ||
+        (txMip->format == GR_TEXFMT_AYIQ_8422)) {
+                if (!_txWrite3dfNCCTable (stream, txMip->pal)) return FXFALSE;
+    } 
+
+    else if ((txMip->format == GR_TEXFMT_P_8) ||
+        (txMip->format == GR_TEXFMT_AP_88)) {
+                if (!_txWrite3dfPalTable (stream, txMip->pal)) return FXFALSE;
+    } 
+
+
+    /* write out mipmap image data */
+    // printf("Writing mipmaps (%d bytes)...\n", txMip->size);
+    if (txMip->format < GR_TEXFMT_16BIT) {
+        n_pixels = txMip->size;
+        if (n_pixels != fwrite (txMip->data[0], 1, n_pixels, stream)) {
+                printf("Bad Bad Bad!\n");
+                return FXFALSE;
+        }
+    }
+    else if (txMip->format < GR_TEXFMT_32BIT) {
+        FxU16* data = (FxU16 *) txMip->data[0];
+        n_pixels = txMip->size >> 1;
+
+        for (i = 0; i < n_pixels; i ++)
+                if (FXFALSE == _txWrite16 (stream, *data++)) return FXFALSE;
+    }
+    else {
+        FxU32* data = (FxU32*) txMip->data[0];
+        n_pixels = txMip->size >> 2;
+
+        for (i = 0; i < n_pixels; i ++)
+                if (FXFALSE == _txWrite32 (stream, *data++)) return FXFALSE;
+    }
+    return FXTRUE;
+}
+
+void
+txMipWrite(TxMip *txMip, char *file, char *ext, int split)
+{
+    int         tgaformat;
+    FILE        *stream;
+    char        filename[128];
+    int         i, w, h;
+    TxMip       splitImg;
+
+    if ((txMip->width  & (txMip->width  - 1)) ||
+        (txMip->height & (txMip->height - 1))) {
+                txPanic("txMipWrite: size not power of 2!");
+    }
+
+    if (strcmp(ext, ".tga") && strcmp(ext, ".3df")) {
+                txPanic("txMipWrite: Bad output format");
+    }
+
+    tgaformat = (strcmp(ext, ".tga") == 0);
+    if (tgaformat && (txMip->format != GR_TEXFMT_ARGB_8888)) {
+        txPanic("txMipWrite: TGA format must be ARGB_8888");
+    }
+
+    /* If not split, write out a single file */
+    if (!split) {
+        strcpy(filename, file);
+        strcat(filename, ext);
+        if( txVerbose )
+          {
+            printf("Writing file \"%s\" (format: %s)\n", 
+                   filename, Format_Name[txMip->format]);
+          }
+        stream = fopen(filename, "wb");
+        if (stream == NULL) {
+                txPanic("Unable to open output file.");
+        }
+        if (tgaformat) {
+                if (!txWriteTGA( stream, txMip)) {
+                        txPanic("txMipWrite: Write failed.");
+                }
+        } else {
+                if (!txWrite3df( stream, txMip)) {
+                        txPanic("txMipWrite: Write failed.");
+                }
+        }
+        fclose(stream);
+        return;
+    }
+
+    /* Otherwise, we need to write out separate output files */
+    w = txMip->width;
+    h = txMip->height;
+
+    for (i=0; i<txMip->depth; i++) {
+        char    suffix[2];
+
+        splitImg = *txMip;              // Copy everything first, including palette.
+
+        // Then change stuff.
+        splitImg.format = txMip->format;
+        splitImg.width  = w;
+        splitImg.height = h;
+        splitImg.size   = w * h * GR_TEXFMT_SIZE( txMip->format );
+        splitImg.depth  = 1;
+        splitImg.data[0] = txMip->data[i];
+
+        // manufacture a new name.
+        suffix[0] = '0' + i;
+        suffix[1] = 0;
+        strcpy(filename, file);
+        strcat(filename, suffix);
+        strcat(filename, ext);
+        stream = fopen(filename, "wb");
+        if (stream == NULL) {
+                txPanic("Unable to open output file.");
+        }
+        if (tgaformat) {
+                if (!txWriteTGA( stream, &splitImg)) {
+                        txPanic("txMipWrite: Write failed.");
+                }
+        } else {
+                if (!txWrite3df( stream, &splitImg)) {
+                        txPanic("txMipWrite: Write failed.");
+                }
+        }
+        fclose(stream);
+        if (w > 1) w >>= 1;
+        if (h > 1) h >>= 1;
+    }
+}
+
+FxBool txWrite( Gu3dfInfo *info, FILE *fp, FxU32 flags )
+{
+  TxMip mip;
+
+  mip.format    = info->header.format;
+  mip.width     = info->header.width;
+  mip.height    = info->header.height;
+#ifdef GLIDE3
+  mip.depth     = info->header.large_lod - info->header.small_lod + 1;
+#else
+  mip.depth     = info->header.small_lod - info->header.large_lod + 1;
+#endif
+  mip.size      = info->mem_required;
+  mip.data[0]   = info->data;
+  if( mip.format == GR_TEXFMT_P_8 || mip.format == GR_TEXFMT_AP_88 )
+    {
+      memcpy( mip.pal, info->table.palette.data, sizeof( FxU32 ) * 256 );
+    }
+  if( mip.format == GR_TEXFMT_YIQ_422 || mip.format == GR_TEXFMT_AYIQ_8422 )
+    {
+      txNccToPal( mip.pal, &info->table.nccTable);
+    }
+  switch( flags & TX_WRITE_MASK )
+    {
+    case TX_WRITE_3DF:
+      if( !txWrite3df( fp, &mip ) )
+        return FXFALSE;
+      break;
+    case TX_WRITE_TGA:
+      if( mip.format == GR_TEXFMT_YIQ_422 || 
+          mip.format == GR_TEXFMT_AYIQ_8422 )
+        {
+          txPanic( "Don't know how to write NCC textures\n" );
+        }
+      if( !txWriteTGA( fp, &mip ) )
+        return FXFALSE;
+      break;
+    default:
+      txPanic( "Unknown texture write format" );
+      break;
+    }
+  return FXTRUE;
+}
