123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901 |
- #include "asm_i386.h"
- #include "quakeasm.h"
- #include "asm_draw.h"
- #if id386
- .text
- LClampHigh0:
- movl C(bbextents),%esi
- jmp LClampReentry0
- LClampHighOrLow0:
- jg LClampHigh0
- xorl %esi,%esi
- jmp LClampReentry0
- LClampHigh1:
- movl C(bbextentt),%edx
- jmp LClampReentry1
- LClampHighOrLow1:
- jg LClampHigh1
- xorl %edx,%edx
- jmp LClampReentry1
- LClampLow2:
- movl $2048,%ebp
- jmp LClampReentry2
- LClampHigh2:
- movl C(bbextents),%ebp
- jmp LClampReentry2
- LClampLow3:
- movl $2048,%ecx
- jmp LClampReentry3
- LClampHigh3:
- movl C(bbextentt),%ecx
- jmp LClampReentry3
- LClampLow4:
- movl $2048,%eax
- jmp LClampReentry4
- LClampHigh4:
- movl C(bbextents),%eax
- jmp LClampReentry4
- LClampLow5:
- movl $2048,%ebx
- jmp LClampReentry5
- LClampHigh5:
- movl C(bbextentt),%ebx
- jmp LClampReentry5
- #define pspans 4+16
- .align 4
- .globl C(D_SpriteDrawSpans)
- C(D_SpriteDrawSpans):
- pushl %ebp
- pushl %edi
- pushl %esi
- pushl %ebx
- flds C(d_sdivzstepu)
- fmuls fp_8
- movl C(cacheblock),%edx
- flds C(d_tdivzstepu)
- fmuls fp_8
- movl pspans(%esp),%ebx
- flds C(d_zistepu)
- fmuls fp_8
- movl %edx,pbase
- flds C(d_zistepu)
- fmuls fp_64kx64k
- fxch %st(3)
- fstps sdivz8stepu
- fstps zi8stepu
- fstps tdivz8stepu
- fistpl izistep
- movl izistep,%eax
- rorl $16,%eax
- movl sspan_t_count(%ebx),%ecx
- movl %eax,izistep
- cmpl $0,%ecx
- jle LNextSpan
- LSpanLoop:
- fildl sspan_t_v(%ebx)
- fildl sspan_t_u(%ebx)
- fld %st(1)
- fmuls C(d_sdivzstepv)
- fld %st(1)
- fmuls C(d_sdivzstepu)
- fld %st(2)
- fmuls C(d_tdivzstepu)
-
- fxch %st(1)
-
- faddp %st(0),%st(2)
-
- fxch %st(1)
-
- fld %st(3)
-
- fmuls C(d_tdivzstepv)
-
-
- fxch %st(1)
-
- fadds C(d_sdivzorigin)
-
- fxch %st(4)
-
- fmuls C(d_zistepv)
-
- fxch %st(1)
-
- faddp %st(0),%st(2)
-
- fxch %st(2)
-
- fmuls C(d_zistepu)
-
-
- fxch %st(1)
-
- fadds C(d_tdivzorigin)
-
- fxch %st(2)
- faddp %st(0),%st(1)
- flds fp_64k
- fxch %st(1)
- fadds C(d_ziorigin)
-
-
- fld %st(0)
- fmuls fp_64kx64k
- fxch %st(1)
- fdivr %st(0),%st(2)
- fxch %st(1)
- fistpl izi
- movl izi,%ebp
- rorl $16,%ebp
- movl sspan_t_v(%ebx),%eax
- movl %ebp,izi
- movl sspan_t_u(%ebx),%ebp
- imull C(d_zrowbytes)
- shll $1,%ebp
- addl C(d_pzbuffer),%eax
- addl %ebp,%eax
- movl %eax,pz
- movl C(d_viewbuffer),%ebp
- movl sspan_t_v(%ebx),%eax
- pushl %ebx
- movl C(tadjust),%edx
- movl C(sadjust),%esi
- movl C(d_scantable)(,%eax,4),%edi
- addl %ebp,%edi
- movl sspan_t_u(%ebx),%ebp
- addl %ebp,%edi
- cmpl $8,%ecx
- ja LSetupNotLast1
- decl %ecx
- jz LCleanup1
- movl %ecx,spancountminus1
- fxch %st(1)
- fld %st(0)
- fmul %st(4),%st(0)
- fxch %st(1)
- fmul %st(3),%st(0)
- fxch %st(1)
- fistpl s
- fistpl t
- fildl spancountminus1
- flds C(d_tdivzstepu)
- flds C(d_zistepu)
- fmul %st(2),%st(0)
- fxch %st(1)
- fmul %st(2),%st(0)
- fxch %st(2)
- fmuls C(d_sdivzstepu)
-
- fxch %st(1)
-
- faddp %st(0),%st(3)
- fxch %st(1)
- faddp %st(0),%st(3)
- faddp %st(0),%st(3)
- flds fp_64k
- fdiv %st(1),%st(0)
-
- jmp LFDIVInFlight1
- LCleanup1:
- fxch %st(1)
- fld %st(0)
- fmul %st(4),%st(0)
- fxch %st(1)
- fmul %st(3),%st(0)
- fxch %st(1)
- fistpl s
- fistpl t
- jmp LFDIVInFlight1
- .align 4
- LSetupNotLast1:
- fxch %st(1)
- fld %st(0)
- fmul %st(4),%st(0)
- fxch %st(1)
- fmul %st(3),%st(0)
- fxch %st(1)
- fistpl s
- fistpl t
- fadds zi8stepu
- fxch %st(2)
- fadds sdivz8stepu
- fxch %st(2)
- flds tdivz8stepu
- faddp %st(0),%st(2)
- flds fp_64k
- fdiv %st(1),%st(0)
-
-
- LFDIVInFlight1:
- addl s,%esi
- addl t,%edx
- movl C(bbextents),%ebx
- movl C(bbextentt),%ebp
- cmpl %ebx,%esi
- ja LClampHighOrLow0
- LClampReentry0:
- movl %esi,s
- movl pbase,%ebx
- shll $16,%esi
- cmpl %ebp,%edx
- movl %esi,sfracf
- ja LClampHighOrLow1
- LClampReentry1:
- movl %edx,t
- movl s,%esi
- shll $16,%edx
- movl t,%eax
- sarl $16,%esi
- movl %edx,tfracf
- sarl $16,%eax
- addl %ebx,%esi
- imull C(cachewidth),%eax
- addl %eax,%esi
-
- cmpl $8,%ecx
- jna LLastSegment
- LNotLastSegment:
- fld %st(0)
- fmul %st(4),%st(0)
- fxch %st(1)
- fmul %st(3),%st(0)
- fxch %st(1)
- fistpl snext
- fistpl tnext
- movl snext,%eax
- movl tnext,%edx
- subl $8,%ecx
- movl C(sadjust),%ebp
- pushl %ecx
- movl C(tadjust),%ecx
- addl %eax,%ebp
- addl %edx,%ecx
- movl C(bbextents),%eax
- movl C(bbextentt),%edx
- cmpl $2048,%ebp
- jl LClampLow2
- cmpl %eax,%ebp
- ja LClampHigh2
- LClampReentry2:
- cmpl $2048,%ecx
- jl LClampLow3
- cmpl %edx,%ecx
- ja LClampHigh3
- LClampReentry3:
- movl %ebp,snext
- movl %ecx,tnext
- subl s,%ebp
- subl t,%ecx
-
- movl %ecx,%eax
- movl %ebp,%edx
- sarl $19,%edx
- movl C(cachewidth),%ebx
- sarl $19,%eax
- jz LIsZero
- imull %ebx,%eax
- LIsZero:
- addl %edx,%eax
-
- movl tfracf,%edx
- movl %eax,advancetable+4
- addl %ebx,%eax
-
- shll $13,%ebp
- movl %ebp,sstep
- movl sfracf,%ebx
- shll $13,%ecx
- movl %eax,advancetable
- movl %ecx,tstep
- movl pz,%ecx
- movl izi,%ebp
- cmpw (%ecx),%bp
- jl Lp1
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp1
- movw %bp,(%ecx)
- movb %al,(%edi)
- Lp1:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- cmpw 2(%ecx),%bp
- jl Lp2
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp2
- movw %bp,2(%ecx)
- movb %al,1(%edi)
- Lp2:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- cmpw 4(%ecx),%bp
- jl Lp3
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp3
- movw %bp,4(%ecx)
- movb %al,2(%edi)
- Lp3:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- cmpw 6(%ecx),%bp
- jl Lp4
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp4
- movw %bp,6(%ecx)
- movb %al,3(%edi)
- Lp4:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- cmpw 8(%ecx),%bp
- jl Lp5
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp5
- movw %bp,8(%ecx)
- movb %al,4(%edi)
- Lp5:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- popl %eax
- cmpl $8,%eax
- ja LSetupNotLast2
- decl %eax
- jz LFDIVInFlight2
- movl %eax,spancountminus1
- fildl spancountminus1
- flds C(d_zistepu)
- fmul %st(1),%st(0)
- flds C(d_tdivzstepu)
- fmul %st(2),%st(0)
- fxch %st(1)
- faddp %st(0),%st(3)
- fxch %st(1)
- fmuls C(d_sdivzstepu)
- fxch %st(1)
- faddp %st(0),%st(3)
- flds fp_64k
- fxch %st(1)
- faddp %st(0),%st(4)
- fdiv %st(1),%st(0)
-
- jmp LFDIVInFlight2
- .align 4
- LSetupNotLast2:
- fadds zi8stepu
- fxch %st(2)
- fadds sdivz8stepu
- fxch %st(2)
- flds tdivz8stepu
- faddp %st(0),%st(2)
- flds fp_64k
- fdiv %st(1),%st(0)
-
-
- LFDIVInFlight2:
- pushl %eax
- cmpw 10(%ecx),%bp
- jl Lp6
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp6
- movw %bp,10(%ecx)
- movb %al,5(%edi)
- Lp6:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- cmpw 12(%ecx),%bp
- jl Lp7
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp7
- movw %bp,12(%ecx)
- movb %al,6(%edi)
- Lp7:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- cmpw 14(%ecx),%bp
- jl Lp8
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp8
- movw %bp,14(%ecx)
- movb %al,7(%edi)
- Lp8:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- addl $8,%edi
- addl $16,%ecx
- movl %edx,tfracf
- movl snext,%edx
- movl %ebx,sfracf
- movl tnext,%ebx
- movl %edx,s
- movl %ebx,t
- movl %ecx,pz
- movl %ebp,izi
- popl %ecx
- cmpl $8,%ecx
- ja LNotLastSegment
- LLastSegment:
- testl %ecx,%ecx
- jz LNoSteps
- fld %st(0)
- fmul %st(4),%st(0)
- fxch %st(1)
- fmul %st(3),%st(0)
- fxch %st(1)
- fistpl snext
- fistpl tnext
- movl C(tadjust),%ebx
- movl C(sadjust),%eax
- addl snext,%eax
- addl tnext,%ebx
- movl C(bbextents),%ebp
- movl C(bbextentt),%edx
- cmpl $2048,%eax
- jl LClampLow4
- cmpl %ebp,%eax
- ja LClampHigh4
- LClampReentry4:
- movl %eax,snext
- cmpl $2048,%ebx
- jl LClampLow5
- cmpl %edx,%ebx
- ja LClampHigh5
- LClampReentry5:
- cmpl $1,%ecx
- je LOnlyOneStep
-
- subl s,%eax
- subl t,%ebx
- addl %eax,%eax
- addl %ebx,%ebx
- imull reciprocal_table-8(,%ecx,4)
- movl %edx,%ebp
- movl %ebx,%eax
- imull reciprocal_table-8(,%ecx,4)
- LSetEntryvec:
- movl spr8entryvec_table(,%ecx,4),%ebx
- movl %edx,%eax
- pushl %ebx
- movl %ebp,%ecx
- sarl $16,%ecx
- movl C(cachewidth),%ebx
- sarl $16,%edx
- jz LIsZeroLast
- imull %ebx,%edx
- LIsZeroLast:
- addl %ecx,%edx
-
- movl tfracf,%ecx
- movl %edx,advancetable+4
- addl %ebx,%edx
-
- shll $16,%ebp
- movl sfracf,%ebx
- shll $16,%eax
- movl %edx,advancetable
- movl %eax,tstep
- movl %ebp,sstep
- movl %ecx,%edx
- movl pz,%ecx
- movl izi,%ebp
- ret
- LNoSteps:
- movl pz,%ecx
- subl $7,%edi
- subl $14,%ecx
- jmp LEndSpan
- LOnlyOneStep:
- subl s,%eax
- subl t,%ebx
- movl %eax,%ebp
- movl %ebx,%edx
- jmp LSetEntryvec
- .globl Spr8Entry2_8
- Spr8Entry2_8:
- subl $6,%edi
- subl $12,%ecx
- movb (%esi),%al
- jmp LLEntry2_8
- .globl Spr8Entry3_8
- Spr8Entry3_8:
- subl $5,%edi
- subl $10,%ecx
- jmp LLEntry3_8
- .globl Spr8Entry4_8
- Spr8Entry4_8:
- subl $4,%edi
- subl $8,%ecx
- jmp LLEntry4_8
- .globl Spr8Entry5_8
- Spr8Entry5_8:
- subl $3,%edi
- subl $6,%ecx
- jmp LLEntry5_8
- .globl Spr8Entry6_8
- Spr8Entry6_8:
- subl $2,%edi
- subl $4,%ecx
- jmp LLEntry6_8
- .globl Spr8Entry7_8
- Spr8Entry7_8:
- decl %edi
- subl $2,%ecx
- jmp LLEntry7_8
- .globl Spr8Entry8_8
- Spr8Entry8_8:
- cmpw (%ecx),%bp
- jl Lp9
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp9
- movw %bp,(%ecx)
- movb %al,(%edi)
- Lp9:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- LLEntry7_8:
- cmpw 2(%ecx),%bp
- jl Lp10
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp10
- movw %bp,2(%ecx)
- movb %al,1(%edi)
- Lp10:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- LLEntry6_8:
- cmpw 4(%ecx),%bp
- jl Lp11
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp11
- movw %bp,4(%ecx)
- movb %al,2(%edi)
- Lp11:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- LLEntry5_8:
- cmpw 6(%ecx),%bp
- jl Lp12
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp12
- movw %bp,6(%ecx)
- movb %al,3(%edi)
- Lp12:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- LLEntry4_8:
- cmpw 8(%ecx),%bp
- jl Lp13
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp13
- movw %bp,8(%ecx)
- movb %al,4(%edi)
- Lp13:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- LLEntry3_8:
- cmpw 10(%ecx),%bp
- jl Lp14
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp14
- movw %bp,10(%ecx)
- movb %al,5(%edi)
- Lp14:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- LLEntry2_8:
- cmpw 12(%ecx),%bp
- jl Lp15
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp15
- movw %bp,12(%ecx)
- movb %al,6(%edi)
- Lp15:
- addl izistep,%ebp
- adcl $0,%ebp
- addl tstep,%edx
- sbbl %eax,%eax
- addl sstep,%ebx
- adcl advancetable+4(,%eax,4),%esi
- LEndSpan:
- cmpw 14(%ecx),%bp
- jl Lp16
- movb (%esi),%al
- cmpb $(TRANSPARENT_COLOR),%al
- jz Lp16
- movw %bp,14(%ecx)
- movb %al,7(%edi)
- Lp16:
- fstp %st(0)
- fstp %st(0)
- fstp %st(0)
- popl %ebx
- LNextSpan:
- addl $(sspan_t_size),%ebx
- movl sspan_t_count(%ebx),%ecx
- cmpl $0,%ecx
- jg LSpanLoop
- jz LNextSpan
- popl %ebx
- popl %esi
- popl %edi
- popl %ebp
- ret
- #endif
|