Status: wont-apply Index: b/glide2x/cvg/glide/src/makefile.linux =================================================================== --- a/glide2x/cvg/glide/src/makefile.linux +++ b/glide2x/cvg/glide/src/makefile.linux @@ -259,7 +259,8 @@ gdraw.o: fxinline.h endif xdraw2.o : xdraw2.S xdraw2.inc.S fxgasm.h fxinline.h - gasp xdraw2.S $(ASM_OPTS) $(LAOPTS) | as -V -Qy -o xdraw2.o + #gasp xdraw2.S $(ASM_OPTS) $(LAOPTS) | as -V -Qy -o xdraw2.o + as -V -Qy xdraw2.gasp -o xdraw2.o cpudtect.o : gasp cpudtect.S $(LAOPTS) | as -V -Qy -o cpudtect.o Index: b/glide2x/cvg/glide/src/xdraw2.gasp =================================================================== --- /dev/null +++ b/glide2x/cvg/glide/src/xdraw2.gasp @@ -0,0 +1,559 @@ + ## 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: /cvsroot/glide/glide2x/cvg/glide/src/xdraw2.S,v 1.1 2000/1/6 20:35:11 joseph Exp $ + ## $Revision: 1.1 $ + ## $Log: xdraw2.S,v $ + ## Revision 1.1 2000/1/6 20:35:11 joseph + ## Changes to support building against shared swlibs. + ## + ## Revision 1.2 1999/12/11 0:42:21 joseph + ## Changed .data to .section .data to fix build errors with binutils 2.9.5. + ## + ## Revision 1.1.1.1 1999/12/7 21:49:13 joseph + ## Initial checkin into SourceForge. + ## + ## + ## + ## 7 5/18/98 12:16p Peter + ## culling enabling + # + # 6 1/15/98 1:12p Peter + # dispatch w/o packing + # + # 5 11/6/97 3:47p Peter + # + # 4 11/4/97 5:4p Peter + # cataclysm part deux + # + # 3 11/1/97 10:1a Peter + # tri dispatch stuff + # + # 2 10/30/97 6:53p Peter + # first real cut at tri asm + # + # 1 10/30/97 4:29p Peter + # asm tri code + # + # 2 7/7/97 2:14p Jdt + # assembly now on par with C code. + # + # 1 7/7/97 8:37a Jdt + # B4 Chip field fix. + ## + + .file "xdraw2.s" + #OPTION OLDSTRUCTS + # 586P + + # This was xdraw2.s but I renamed it for now to work with the shared + # swlibs. It hasn't changed to the format used in the .S files for + # the Voodoo3 Glide soruces. + # some useful floating load and store macros + #flds TEXTEQU + #fsubs TEXTEQU + #fmuls TEXTEQU + + .align 4 + .section .data +One: .long 0x03f800000 +Area: .long 0 +dxAB: .long 0 +dxBC: .long 0 +dyAB: .long 0 +dyBC: .long 0 +culltest: .long 0 + + ## Extra junk to pad out to the next cache line. +bias0: .long 0 +pad1: .long 0 +pad2: .long 0 +pad3: .long 0 +pad4: .long 0 +pad5: .long 0 +pad6: .long 0 +pad7: .long 0 +bias1: .long 0 + + # _DATA ENDS + + # Ugly, but seems to workaround the problem with locally defined + # data segment globals not getting relocated properly when using + # djgpp. + + + ### Definitions of cvg regs and glide root structures. + + #---------------------------------------------------------------------- + # Assembler offsets for SSTREGS struct + #---------------------------------------------------------------------- + + + + #---------------------------------------------------------------------- + # Assembler offsets for GC struct + #---------------------------------------------------------------------- + + + + #---------------------------------------------------------------------- + # Assembler offsets for GlideRoot struct + #---------------------------------------------------------------------- + + + + #---------------------------------------------------------------------- + # Assembler offsets for GrVertex struct + #---------------------------------------------------------------------- + + + + ## enables/disables 116 and 120 counters + + #-------------------------------------------------------------------------- + # Arguments : STKOFF = 16 from 4 pushes + #.AIF EQ 1 + #STKOFF .EQU 20 + #.AELSE + #.AENDI + + # edx is used as index, loading from *src + + .text + + .align 4 + .globl _trisetup_cull + .type _trisetup_cull, @function +_trisetup_cull: + # .code + + + ## -*-asm-*- + ## 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: /cvsroot/glide/glide2x/cvg/glide/src/xdraw2.inc.S,v 1.1 2000/1/6 20:35:11 joseph Exp $ + ## $Revision: 1.1 $ + ## $Log: xdraw2.inc.S,v $ + ## Revision 1.1 2000/1/6 20:35:11 joseph + ## Changes to support building against shared swlibs. + ## + ## Revision 1.1.1.1 1999/12/7 21:49:13 joseph + ## Initial checkin into SourceForge. + ## + # + # 2 10/30/97 6:53p Peter + # first real cut at tri asm + # + # 1 10/30/97 4:29p Peter + # asm tri code + # + # 2 7/7/97 2:14p Jdt + # assembly now on par with C code. + # + # 1 7/7/97 8:3728 Jdt + # B4 Chip field fix. + ## + + .file "xdraw2.inc.s" + #.586P + #EXTRN _GlideRoot:DWORD + #EXTRN _FifoMakeRoom:NEAR + + # Ugly, but seems to workaround the problem with locally defined + # data segment globals not getting relocated properly when using + # djgpp. + + #One .EQU One+4 + #One .EQU One+8 + #One .EQU One+12 + #One .EQU One+16 + #One .EQU One+20 + #One .EQU One+24 + + + ## Prologue stuff + push %esi + push %edi + + push %ebx + push %ebp + + mov (_GlideRoot + 12), %esi ## GR_DCL_GC + + .align 4 + + ## Pre-load the current culling mode before all of the + ## floating point area stuff. + mov 584(%esi), %edx + mov 20(%esp), %eax + + mov 24(%esp), %ebx + mov 28(%esp), %ecx + shl $31, %edx + .LCULLArea_Computation: + # 47-3 + # jmp ret_pop0f + flds 0(%eax) # xa + fsubs 0(%ebx) # dxAB + flds 0(%ebx) # | xb + fsubs 0(%ecx) # | dxBC + flds 4(%ebx) # | | yb + fsubs 4(%ecx) # | | dyBC + flds 4(%eax) # | | | ya + fsubs 4(%ebx) # | | | 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 + fsubrp %st, %st(1) # | | | | area + fsts One # | | | | area + + ## Pop temp things from the sw culling off the fp stack + fstp %st # 4 + fstp %st # 3 + fstp %st # 2 + fstp %st # 1 + fstp %st # 0 + mov One, %ebp # j = *(long *)&area + xor %eax, %eax # Clear the returnv value (0 == culled) + # Zero Area Triangle Check + and $0x7fffffff, %ebp # if ((j & 0x7FFFFFFF) == 0) + jz .LCULL__triDone + + ## Triangle area check vs culling mode + mov One, %ebp + xor %edx, %ebp + + jge .LCULL__triDone + + .align 4 + ## Check to make sure that we have enough room for + ## the complete triangle packet. + mov (_GlideRoot + 24), %eax + mov 888(%esi), %ebx + add $4, %eax + cmp %eax, %ebx + jge .LCULL__triBegin + + push $0 + push $0 + push %eax + call _FifoMakeRoom + + add $12, %esp + + ## Send triangle parameters + + + + .align 4 + .LCULL__triBegin: + mov 880(%esi), %ebp # Fetch Fifo Ptr + mov $4, %ecx # Starting %edx + + mov 848(%esi), %eax # Packet 3 header + nop + + # Write packet header to %ebp + mov %eax, 0(%ebp) + add $4, %ebp # Advance %ebp for hdr & 0/4 coordinate + + .align 4 + .LCULL__vertexStart: + mov 16(%esp,%ecx), %edx # Current %edx + add $8, %ebp + + nop # Avoid p5 agi w/ load of %edx ptr + nop + movl 0(%edx), %eax # 0 + lea 396(%esi), %ebx # Reset the dataList + # PCI write 0 + mov %eax, -8(%ebp) + movl 4(%edx), %eax # 4 + + xor %edi, %edi # Clear packed color + # PCI write 4 + mov %eax, -4(%ebp) + + + .LCULL__doParams: + movl (%ebx), %eax # Get first offset from the data list + add $4, %ebx # %ebx++ + + cmp $0, %eax # Are we done? + je .LCULL__nextVertex + + ## Not using align directive here because it sometimes + ## introduces an agi for the eax use below. + nop + nop + .LCULL__paramLoop: + movl (%eax, %edx), %edi + add $4, %ebp + movl (%ebx), %eax + add $4, %ebx + cmp $0, %eax + mov %edi, -4(%ebp) + + jne .LCULL__paramLoop + + .align 4 + .LCULL__nextVertex: + ## On to the next %edx + add $4, %ecx + mov (_GlideRoot + 12), %esi # Reload %esi incase we trashed it as 28 temp + + cmp $16, %ecx # Offset of one past last %edx? + + jne .LCULL__vertexStart + + ## Update %esi->880 and %esi->888 + mov %ebp, %eax + mov 880(%esi), %ebx + mov %ebp, 880(%esi) + sub %ebx, %eax + + mov (_GlideRoot + 120), %ebx + sub %eax, 888(%esi) + + add $1, %ebx + mov %ebx, (_GlideRoot + 120) + + ## return 1 (triangle drawn) + mov $1, %eax + + .LCULL__triDone: + ## Restore trashed registers + mov (_GlideRoot + 116), %esi + pop %ebp + + add $1, %esi + pop %ebx + pop %edi + mov %esi, (_GlideRoot + 116) + + pop %esi + ret + .L_end_trisetup_cull: + .size _trisetup_cull,.L_end_trisetup_cull-_trisetup_cull + + + .align 4 + .global _trisetup + .type _trisetup, @function +_trisetup: + # .code + + ## -*-asm-*- + ## 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: /cvsroot/glide/glide2x/cvg/glide/src/xdraw2.inc.S,v 1.1 2000/1/6 20:35:11 joseph Exp $ + ## $Revision: 1.1 $ + ## $Log: xdraw2.inc.S,v $ + ## Revision 1.1 2000/1/6 20:35:11 joseph + ## Changes to support building against shared swlibs. + ## + ## Revision 1.1.1.1 1999/12/7 21:49:13 joseph + ## Initial checkin into SourceForge. + ## + # + # 2 10/30/97 6:53p Peter + # first real cut at tri asm + # + # 1 10/30/97 4:29p Peter + # asm tri code + # + # 2 7/7/97 2:14p Jdt + # assembly now on par with C code. + # + # 1 7/7/97 8:3728 Jdt + # B4 Chip field fix. + ## + + .file "xdraw2.inc.s" + #.586P + #EXTRN _GlideRoot:DWORD + #EXTRN _FifoMakeRoom:NEAR + + # Ugly, but seems to workaround the problem with locally defined + # data segment globals not getting relocated properly when using + # djgpp. + + #One .EQU One+4 + #One .EQU One+8 + #One .EQU One+12 + #One .EQU One+16 + #One .EQU One+20 + #One .EQU One+24 + + + ## Prologue stuff + push %esi + push %edi + + push %ebx + push %ebp + + mov (_GlideRoot + 12), %esi ## GR_DCL_GC + + .align 4 + .align 4 + ## Check to make sure that we have enough room for + ## the complete triangle packet. + mov (_GlideRoot + 24), %eax + mov 888(%esi), %ebx + add $4, %eax + cmp %eax, %ebx + jge .LNOCULL__triBegin + + push $0 + push $0 + push %eax + call _FifoMakeRoom + + add $12, %esp + + ## Send triangle parameters + + + + .align 4 + .LNOCULL__triBegin: + mov 880(%esi), %ebp # Fetch Fifo Ptr + mov $4, %ecx # Starting %edx + + mov 848(%esi), %eax # Packet 3 header + nop + + # Write packet header to %ebp + mov %eax, 0(%ebp) + add $4, %ebp # Advance %ebp for hdr & 0/4 coordinate + + .align 4 + .LNOCULL__vertexStart: + mov 16(%esp,%ecx), %edx # Current %edx + add $8, %ebp + + nop # Avoid p5 agi w/ load of %edx ptr + nop + movl 0(%edx), %eax # 0 + lea 396(%esi), %ebx # Reset the dataList + # PCI write 0 + mov %eax, -8(%ebp) + movl 4(%edx), %eax # 4 + + xor %edi, %edi # Clear packed color + # PCI write 4 + mov %eax, -4(%ebp) + + + .LNOCULL__doParams: + movl (%ebx), %eax # Get first offset from the data list + add $4, %ebx # %ebx++ + + cmp $0, %eax # Are we done? + je .LNOCULL__nextVertex + + ## Not using align directive here because it sometimes + ## introduces an agi for the eax use below. + nop + nop + .LNOCULL__paramLoop: + movl (%eax, %edx), %edi + add $4, %ebp + movl (%ebx), %eax + add $4, %ebx + cmp $0, %eax + mov %edi, -4(%ebp) + + jne .LNOCULL__paramLoop + + .align 4 + .LNOCULL__nextVertex: + ## On to the next %edx + add $4, %ecx + mov (_GlideRoot + 12), %esi # Reload %esi incase we trashed it as 28 temp + + cmp $16, %ecx # Offset of one past last %edx? + + jne .LNOCULL__vertexStart + + ## Update %esi->880 and %esi->888 + mov %ebp, %eax + mov 880(%esi), %ebx + mov %ebp, 880(%esi) + sub %ebx, %eax + + mov (_GlideRoot + 120), %ebx + sub %eax, 888(%esi) + + add $1, %ebx + mov %ebx, (_GlideRoot + 120) + + ## return 1 (triangle drawn) + mov $1, %eax + + .LNOCULL__triDone: + ## Restore trashed registers + mov (_GlideRoot + 116), %esi + pop %ebp + + add $1, %esi + pop %ebx + pop %edi + mov %esi, (_GlideRoot + 116) + + pop %esi + ret + .L_end_trisetup: + .size _trisetup,.L_end_trisetup-_trisetup + + + #_TEXT ENDS