1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
|
.386P
.model FLAT
externdef _d_zistepu:dword
externdef _d_pzbuffer:dword
externdef _d_zistepv:dword
externdef _d_zrowbytes:dword
externdef _d_ziorigin:dword
externdef _r_turb_s:dword
externdef _r_turb_t:dword
externdef _r_turb_pdest:dword
externdef _r_turb_spancount:dword
externdef _r_turb_turb:dword
externdef _r_turb_pbase:dword
externdef _r_turb_sstep:dword
externdef _r_turb_tstep:dword
externdef _r_bmodelactive:dword
externdef _d_sdivzstepu:dword
externdef _d_tdivzstepu:dword
externdef _d_sdivzstepv:dword
externdef _d_tdivzstepv:dword
externdef _d_sdivzorigin:dword
externdef _d_tdivzorigin:dword
externdef _sadjust:dword
externdef _tadjust:dword
externdef _bbextents:dword
externdef _bbextentt:dword
externdef _cacheblock:dword
externdef _d_viewbuffer:dword
externdef _cachewidth:dword
externdef _d_pzbuffer:dword
externdef _d_zrowbytes:dword
externdef _d_zwidth:dword
externdef _d_scantable:dword
externdef _r_lightptr:dword
externdef _r_numvblocks:dword
externdef _prowdestbase:dword
externdef _pbasesource:dword
externdef _r_lightwidth:dword
externdef _lightright:dword
externdef _lightrightstep:dword
externdef _lightdeltastep:dword
externdef _lightdelta:dword
externdef _lightright:dword
externdef _lightdelta:dword
externdef _sourcetstep:dword
externdef _surfrowbytes:dword
externdef _lightrightstep:dword
externdef _lightdeltastep:dword
externdef _r_sourcemax:dword
externdef _r_stepback:dword
externdef _colormap:dword
externdef _blocksize:dword
externdef _sourcesstep:dword
externdef _lightleft:dword
externdef _blockdivshift:dword
externdef _blockdivmask:dword
externdef _lightleftstep:dword
externdef _r_origin:dword
externdef _r_ppn:dword
externdef _r_pup:dword
externdef _r_pright:dword
externdef _ycenter:dword
externdef _xcenter:dword
externdef _d_vrectbottom_particle:dword
externdef _d_vrectright_particle:dword
externdef _d_vrecty:dword
externdef _d_vrectx:dword
externdef _d_pix_shift:dword
externdef _d_pix_min:dword
externdef _d_pix_max:dword
externdef _d_y_aspect_shift:dword
externdef _screenwidth:dword
externdef _vright:dword
externdef _vup:dword
externdef _vpn:dword
externdef _BOPS_Error:dword
externdef _snd_scaletable:dword
externdef _paintbuffer:dword
externdef _snd_linear_count:dword
externdef _snd_p:dword
externdef _snd_vol:dword
externdef _snd_out:dword
externdef _r_leftclipped:dword
externdef _r_leftenter:dword
externdef _r_rightclipped:dword
externdef _r_rightenter:dword
externdef _modelorg:dword
externdef _xscale:dword
externdef _r_refdef:dword
externdef _yscale:dword
externdef _r_leftexit:dword
externdef _r_rightexit:dword
externdef _r_lastvertvalid:dword
externdef _cacheoffset:dword
externdef _newedges:dword
externdef _removeedges:dword
externdef _r_pedge:dword
externdef _r_framecount:dword
externdef _r_u1:dword
externdef _r_emitted:dword
externdef _edge_p:dword
externdef _surface_p:dword
externdef _surfaces:dword
externdef _r_lzi1:dword
externdef _r_v1:dword
externdef _r_ceilv1:dword
externdef _r_nearzi:dword
externdef _r_nearzionly:dword
externdef _edge_aftertail:dword
externdef _edge_tail:dword
externdef _current_iv:dword
externdef _edge_head_u_shift20:dword
externdef _span_p:dword
externdef _edge_head:dword
externdef _fv:dword
externdef _edge_tail_u_shift20:dword
externdef _r_apverts:dword
externdef _r_anumverts:dword
externdef _aliastransform:dword
externdef _r_avertexnormals:dword
externdef _r_plightvec:dword
externdef _r_ambientlight:dword
externdef _r_shadelight:dword
externdef _aliasxcenter:dword
externdef _aliasycenter:dword
externdef _a_sstepxfrac:dword
externdef _r_affinetridesc:dword
externdef _acolormap:dword
externdef _d_pcolormap:dword
externdef _r_affinetridesc:dword
externdef _d_sfrac:dword
externdef _d_ptex:dword
externdef _d_pedgespanpackage:dword
externdef _d_tfrac:dword
externdef _d_light:dword
externdef _d_zi:dword
externdef _d_pdest:dword
externdef _d_pz:dword
externdef _d_aspancount:dword
externdef _erroradjustup:dword
externdef _errorterm:dword
externdef _d_xdenom:dword
externdef _r_p0:dword
externdef _r_p1:dword
externdef _r_p2:dword
externdef _a_tstepxfrac:dword
externdef _r_sstepx:dword
externdef _r_tstepx:dword
externdef _a_ststepxwhole:dword
externdef _zspantable:dword
externdef _skintable:dword
externdef _r_zistepx:dword
externdef _erroradjustdown:dword
externdef _d_countextrastep:dword
externdef _ubasestep:dword
externdef _a_ststepxwhole:dword
externdef _a_tstepxfrac:dword
externdef _r_lstepx:dword
externdef _a_spans:dword
externdef _erroradjustdown:dword
externdef _d_pdestextrastep:dword
externdef _d_pzextrastep:dword
externdef _d_sfracextrastep:dword
externdef _d_ptexextrastep:dword
externdef _d_countextrastep:dword
externdef _d_tfracextrastep:dword
externdef _d_lightextrastep:dword
externdef _d_ziextrastep:dword
externdef _d_pdestbasestep:dword
externdef _d_pzbasestep:dword
externdef _d_sfracbasestep:dword
externdef _d_ptexbasestep:dword
externdef _ubasestep:dword
externdef _d_tfracbasestep:dword
externdef _d_lightbasestep:dword
externdef _d_zibasestep:dword
externdef _zspantable:dword
externdef _r_lstepy:dword
externdef _r_sstepy:dword
externdef _r_tstepy:dword
externdef _r_zistepy:dword
externdef _D_PolysetSetEdgeTable:dword
externdef _D_RasterizeAliasPolySmooth:dword
externdef float_point5:dword
externdef Float2ToThe31nd:dword
externdef izistep:dword
externdef izi:dword
externdef FloatMinus2ToThe31nd:dword
externdef float_1:dword
externdef float_particle_z_clip:dword
externdef float_minus_1:dword
externdef float_0:dword
externdef fp_16:dword
externdef fp_64k:dword
externdef fp_1m:dword
externdef fp_1m_minus_1:dword
externdef fp_8:dword
externdef entryvec_table:dword
externdef advancetable:dword
externdef sstep:dword
externdef tstep:dword
externdef pspantemp:dword
externdef counttemp:dword
externdef jumptemp:dword
externdef reciprocal_table:dword
externdef DP_Count:dword
externdef DP_u:dword
externdef DP_v:dword
externdef DP_32768:dword
externdef DP_Color:dword
externdef DP_Pix:dword
externdef DP_EntryTable:dword
externdef pbase:dword
externdef s:dword
externdef t:dword
externdef sfracf:dword
externdef tfracf:dword
externdef snext:dword
externdef tnext:dword
externdef spancountminus1:dword
externdef zi16stepu:dword
externdef sdivz16stepu:dword
externdef tdivz16stepu:dword
externdef zi8stepu:dword
externdef sdivz8stepu:dword
externdef tdivz8stepu:dword
externdef reciprocal_table_16:dword
externdef entryvec_table_16:dword
externdef ceil_cw:dword
externdef single_cw:dword
externdef fp_64kx64k:dword
externdef pz:dword
externdef spr8entryvec_table:dword
_TEXT SEGMENT
LClampHigh0:
mov esi,ds:dword ptr[_bbextents]
jmp LClampReentry0
LClampHighOrLow0:
jg LClampHigh0
xor esi,esi
jmp LClampReentry0
LClampHigh1:
mov edx,ds:dword ptr[_bbextentt]
jmp LClampReentry1
LClampHighOrLow1:
jg LClampHigh1
xor edx,edx
jmp LClampReentry1
LClampLow2:
mov ebp,2048
jmp LClampReentry2
LClampHigh2:
mov ebp,ds:dword ptr[_bbextents]
jmp LClampReentry2
LClampLow3:
mov ecx,2048
jmp LClampReentry3
LClampHigh3:
mov ecx,ds:dword ptr[_bbextentt]
jmp LClampReentry3
LClampLow4:
mov eax,2048
jmp LClampReentry4
LClampHigh4:
mov eax,ds:dword ptr[_bbextents]
jmp LClampReentry4
LClampLow5:
mov ebx,2048
jmp LClampReentry5
LClampHigh5:
mov ebx,ds:dword ptr[_bbextentt]
jmp LClampReentry5
align 4
public _D_DrawSpans8
_D_DrawSpans8:
push ebp
push edi
push esi
push ebx
fld ds:dword ptr[_d_sdivzstepu]
fmul ds:dword ptr[fp_8]
mov edx,ds:dword ptr[_cacheblock]
fld ds:dword ptr[_d_tdivzstepu]
fmul ds:dword ptr[fp_8]
mov ebx,ds:dword ptr[4+16+esp]
fld ds:dword ptr[_d_zistepu]
fmul ds:dword ptr[fp_8]
mov ds:dword ptr[pbase],edx
fstp ds:dword ptr[zi8stepu]
fstp ds:dword ptr[tdivz8stepu]
fstp ds:dword ptr[sdivz8stepu]
LSpanLoop:
fild ds:dword ptr[4+ebx]
fild ds:dword ptr[0+ebx]
fld st(1)
fmul ds:dword ptr[_d_sdivzstepv]
fld st(1)
fmul ds:dword ptr[_d_sdivzstepu]
fld st(2)
fmul ds:dword ptr[_d_tdivzstepu]
fxch st(1)
faddp st(2),st(0)
fxch st(1)
fld st(3)
fmul ds:dword ptr[_d_tdivzstepv]
fxch st(1)
fadd ds:dword ptr[_d_sdivzorigin]
fxch st(4)
fmul ds:dword ptr[_d_zistepv]
fxch st(1)
faddp st(2),st(0)
fxch st(2)
fmul ds:dword ptr[_d_zistepu]
fxch st(1)
fadd ds:dword ptr[_d_tdivzorigin]
fxch st(2)
faddp st(1),st(0)
fld ds:dword ptr[fp_64k]
fxch st(1)
fadd ds:dword ptr[_d_ziorigin]
fdiv st(1),st(0)
mov ecx,ds:dword ptr[_d_viewbuffer]
mov eax,ds:dword ptr[4+ebx]
mov ds:dword ptr[pspantemp],ebx
mov edx,ds:dword ptr[_tadjust]
mov esi,ds:dword ptr[_sadjust]
mov edi,ds:dword ptr[_d_scantable+eax*4]
add edi,ecx
mov ecx,ds:dword ptr[0+ebx]
add edi,ecx
mov ecx,ds:dword ptr[8+ebx]
cmp ecx,8
ja LSetupNotLast1
dec ecx
jz LCleanup1
mov ds:dword ptr[spancountminus1],ecx
fxch st(1)
fld st(0)
fmul st(0),st(4)
fxch st(1)
fmul st(0),st(3)
fxch st(1)
fistp ds:dword ptr[s]
fistp ds:dword ptr[t]
fild ds:dword ptr[spancountminus1]
fld ds:dword ptr[_d_tdivzstepu]
fld ds:dword ptr[_d_zistepu]
fmul st(0),st(2)
fxch st(1)
fmul st(0),st(2)
fxch st(2)
fmul ds:dword ptr[_d_sdivzstepu]
fxch st(1)
faddp st(3),st(0)
fxch st(1)
faddp st(3),st(0)
faddp st(3),st(0)
fld ds:dword ptr[fp_64k]
fdiv st(0),st(1)
jmp LFDIVInFlight1
LCleanup1:
fxch st(1)
fld st(0)
fmul st(0),st(4)
fxch st(1)
fmul st(0),st(3)
fxch st(1)
fistp ds:dword ptr[s]
fistp ds:dword ptr[t]
jmp LFDIVInFlight1
align 4
LSetupNotLast1:
fxch st(1)
fld st(0)
fmul st(0),st(4)
fxch st(1)
fmul st(0),st(3)
fxch st(1)
fistp ds:dword ptr[s]
fistp ds:dword ptr[t]
fadd ds:dword ptr[zi8stepu]
fxch st(2)
fadd ds:dword ptr[sdivz8stepu]
fxch st(2)
fld ds:dword ptr[tdivz8stepu]
faddp st(2),st(0)
fld ds:dword ptr[fp_64k]
fdiv st(0),st(1)
LFDIVInFlight1:
add esi,ds:dword ptr[s]
add edx,ds:dword ptr[t]
mov ebx,ds:dword ptr[_bbextents]
mov ebp,ds:dword ptr[_bbextentt]
cmp esi,ebx
ja LClampHighOrLow0
LClampReentry0:
mov ds:dword ptr[s],esi
mov ebx,ds:dword ptr[pbase]
shl esi,16
cmp edx,ebp
mov ds:dword ptr[sfracf],esi
ja LClampHighOrLow1
LClampReentry1:
mov ds:dword ptr[t],edx
mov esi,ds:dword ptr[s]
shl edx,16
mov eax,ds:dword ptr[t]
sar esi,16
mov ds:dword ptr[tfracf],edx
sar eax,16
mov edx,ds:dword ptr[_cachewidth]
imul eax,edx
add esi,ebx
add esi,eax
cmp ecx,8
jna LLastSegment
LNotLastSegment:
fld st(0)
fmul st(0),st(4)
fxch st(1)
fmul st(0),st(3)
fxch st(1)
fistp ds:dword ptr[snext]
fistp ds:dword ptr[tnext]
mov eax,ds:dword ptr[snext]
mov edx,ds:dword ptr[tnext]
mov bl,ds:byte ptr[esi]
sub ecx,8
mov ebp,ds:dword ptr[_sadjust]
mov ds:dword ptr[counttemp],ecx
mov ecx,ds:dword ptr[_tadjust]
mov ds:byte ptr[edi],bl
add ebp,eax
add ecx,edx
mov eax,ds:dword ptr[_bbextents]
mov edx,ds:dword ptr[_bbextentt]
cmp ebp,2048
jl LClampLow2
cmp ebp,eax
ja LClampHigh2
LClampReentry2:
cmp ecx,2048
jl LClampLow3
cmp ecx,edx
ja LClampHigh3
LClampReentry3:
mov ds:dword ptr[snext],ebp
mov ds:dword ptr[tnext],ecx
sub ebp,ds:dword ptr[s]
sub ecx,ds:dword ptr[t]
mov eax,ecx
mov edx,ebp
sar eax,19
jz LZero
sar edx,19
mov ebx,ds:dword ptr[_cachewidth]
imul eax,ebx
jmp LSetUp1
LZero:
sar edx,19
mov ebx,ds:dword ptr[_cachewidth]
LSetUp1:
add eax,edx
mov edx,ds:dword ptr[tfracf]
mov ds:dword ptr[advancetable+4],eax
add eax,ebx
shl ebp,13
mov ebx,ds:dword ptr[sfracf]
shl ecx,13
mov ds:dword ptr[advancetable],eax
mov ds:dword ptr[tstep],ecx
add edx,ecx
sbb ecx,ecx
add ebx,ebp
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
sbb ecx,ecx
mov al,ds:byte ptr[esi]
add ebx,ebp
mov ds:byte ptr[1+edi],al
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
sbb ecx,ecx
add ebx,ebp
mov al,ds:byte ptr[esi]
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
sbb ecx,ecx
mov ds:byte ptr[2+edi],al
add ebx,ebp
mov al,ds:byte ptr[esi]
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
sbb ecx,ecx
mov ds:byte ptr[3+edi],al
add ebx,ebp
mov al,ds:byte ptr[esi]
adc esi,ds:dword ptr[advancetable+4+ecx*4]
mov ecx,ds:dword ptr[counttemp]
cmp ecx,8
ja LSetupNotLast2
dec ecx
jz LFDIVInFlight2
mov ds:dword ptr[spancountminus1],ecx
fild ds:dword ptr[spancountminus1]
fld ds:dword ptr[_d_zistepu]
fmul st(0),st(1)
fld ds:dword ptr[_d_tdivzstepu]
fmul st(0),st(2)
fxch st(1)
faddp st(3),st(0)
fxch st(1)
fmul ds:dword ptr[_d_sdivzstepu]
fxch st(1)
faddp st(3),st(0)
fld ds:dword ptr[fp_64k]
fxch st(1)
faddp st(4),st(0)
fdiv st(0),st(1)
jmp LFDIVInFlight2
align 4
LSetupNotLast2:
fadd ds:dword ptr[zi8stepu]
fxch st(2)
fadd ds:dword ptr[sdivz8stepu]
fxch st(2)
fld ds:dword ptr[tdivz8stepu]
faddp st(2),st(0)
fld ds:dword ptr[fp_64k]
fdiv st(0),st(1)
LFDIVInFlight2:
mov ds:dword ptr[counttemp],ecx
add edx,ds:dword ptr[tstep]
sbb ecx,ecx
mov ds:byte ptr[4+edi],al
add ebx,ebp
mov al,ds:byte ptr[esi]
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
sbb ecx,ecx
mov ds:byte ptr[5+edi],al
add ebx,ebp
mov al,ds:byte ptr[esi]
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
sbb ecx,ecx
mov ds:byte ptr[6+edi],al
add ebx,ebp
mov al,ds:byte ptr[esi]
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edi,8
mov ds:dword ptr[tfracf],edx
mov edx,ds:dword ptr[snext]
mov ds:dword ptr[sfracf],ebx
mov ebx,ds:dword ptr[tnext]
mov ds:dword ptr[s],edx
mov ds:dword ptr[t],ebx
mov ecx,ds:dword ptr[counttemp]
cmp ecx,8
mov ds:byte ptr[-1+edi],al
ja LNotLastSegment
LLastSegment:
test ecx,ecx
jz LNoSteps
fld st(0)
fmul st(0),st(4)
fxch st(1)
fmul st(0),st(3)
fxch st(1)
fistp ds:dword ptr[snext]
fistp ds:dword ptr[tnext]
mov al,ds:byte ptr[esi]
mov ebx,ds:dword ptr[_tadjust]
mov ds:byte ptr[edi],al
mov eax,ds:dword ptr[_sadjust]
add eax,ds:dword ptr[snext]
add ebx,ds:dword ptr[tnext]
mov ebp,ds:dword ptr[_bbextents]
mov edx,ds:dword ptr[_bbextentt]
cmp eax,2048
jl LClampLow4
cmp eax,ebp
ja LClampHigh4
LClampReentry4:
mov ds:dword ptr[snext],eax
cmp ebx,2048
jl LClampLow5
cmp ebx,edx
ja LClampHigh5
LClampReentry5:
cmp ecx,1
je LOnlyOneStep
sub eax,ds:dword ptr[s]
sub ebx,ds:dword ptr[t]
add eax,eax
add ebx,ebx
imul ds:dword ptr[reciprocal_table-8+ecx*4]
mov ebp,edx
mov eax,ebx
imul ds:dword ptr[reciprocal_table-8+ecx*4]
LSetEntryvec:
mov ebx,ds:dword ptr[entryvec_table+ecx*4]
mov eax,edx
mov ds:dword ptr[jumptemp],ebx
mov ecx,ebp
sar edx,16
mov ebx,ds:dword ptr[_cachewidth]
sar ecx,16
imul edx,ebx
add edx,ecx
mov ecx,ds:dword ptr[tfracf]
mov ds:dword ptr[advancetable+4],edx
add edx,ebx
shl ebp,16
mov ebx,ds:dword ptr[sfracf]
shl eax,16
mov ds:dword ptr[advancetable],edx
mov ds:dword ptr[tstep],eax
mov edx,ecx
add edx,eax
sbb ecx,ecx
add ebx,ebp
adc esi,ds:dword ptr[advancetable+4+ecx*4]
jmp dword ptr[jumptemp]
LNoSteps:
mov al,ds:byte ptr[esi]
sub edi,7
jmp LEndSpan
LOnlyOneStep:
sub eax,ds:dword ptr[s]
sub ebx,ds:dword ptr[t]
mov ebp,eax
mov edx,ebx
jmp LSetEntryvec
public Entry2_8
Entry2_8:
sub edi,6
mov al,ds:byte ptr[esi]
jmp LLEntry2_8
public Entry3_8
Entry3_8:
sub edi,5
add edx,eax
mov al,ds:byte ptr[esi]
sbb ecx,ecx
add ebx,ebp
adc esi,ds:dword ptr[advancetable+4+ecx*4]
jmp LLEntry3_8
public Entry4_8
Entry4_8:
sub edi,4
add edx,eax
mov al,ds:byte ptr[esi]
sbb ecx,ecx
add ebx,ebp
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
jmp LLEntry4_8
public Entry5_8
Entry5_8:
sub edi,3
add edx,eax
mov al,ds:byte ptr[esi]
sbb ecx,ecx
add ebx,ebp
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
jmp LLEntry5_8
public Entry6_8
Entry6_8:
sub edi,2
add edx,eax
mov al,ds:byte ptr[esi]
sbb ecx,ecx
add ebx,ebp
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
jmp LLEntry6_8
public Entry7_8
Entry7_8:
dec edi
add edx,eax
mov al,ds:byte ptr[esi]
sbb ecx,ecx
add ebx,ebp
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
jmp LLEntry7_8
public Entry8_8
Entry8_8:
add edx,eax
mov al,ds:byte ptr[esi]
sbb ecx,ecx
add ebx,ebp
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
sbb ecx,ecx
mov ds:byte ptr[1+edi],al
add ebx,ebp
mov al,ds:byte ptr[esi]
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
LLEntry7_8:
sbb ecx,ecx
mov ds:byte ptr[2+edi],al
add ebx,ebp
mov al,ds:byte ptr[esi]
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
LLEntry6_8:
sbb ecx,ecx
mov ds:byte ptr[3+edi],al
add ebx,ebp
mov al,ds:byte ptr[esi]
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
LLEntry5_8:
sbb ecx,ecx
mov ds:byte ptr[4+edi],al
add ebx,ebp
mov al,ds:byte ptr[esi]
adc esi,ds:dword ptr[advancetable+4+ecx*4]
add edx,ds:dword ptr[tstep]
LLEntry4_8:
sbb ecx,ecx
mov ds:byte ptr[5+edi],al
add ebx,ebp
mov al,ds:byte ptr[esi]
adc esi,ds:dword ptr[advancetable+4+ecx*4]
LLEntry3_8:
mov ds:byte ptr[6+edi],al
mov al,ds:byte ptr[esi]
LLEntry2_8:
LEndSpan:
fstp st(0)
fstp st(0)
fstp st(0)
mov ebx,ds:dword ptr[pspantemp]
mov ebx,ds:dword ptr[12+ebx]
test ebx,ebx
mov ds:byte ptr[7+edi],al
jnz LSpanLoop
pop ebx
pop esi
pop edi
pop ebp
ret
LClamp:
mov edx,040000000h
xor ebx,ebx
fstp st(0)
jmp LZDraw
LClampNeg:
mov edx,040000000h
xor ebx,ebx
fstp st(0)
jmp LZDrawNeg
public _D_DrawZSpans
_D_DrawZSpans:
push ebp
push edi
push esi
push ebx
fld ds:dword ptr[_d_zistepu]
mov eax,ds:dword ptr[_d_zistepu]
mov esi,ds:dword ptr[4+16+esp]
test eax,eax
jz LFNegSpan
fmul ds:dword ptr[Float2ToThe31nd]
fistp ds:dword ptr[izistep]
mov ebx,ds:dword ptr[izistep]
LFSpanLoop:
fild ds:dword ptr[4+esi]
fild ds:dword ptr[0+esi]
mov ecx,ds:dword ptr[4+esi]
mov edi,ds:dword ptr[_d_pzbuffer]
fmul ds:dword ptr[_d_zistepu]
fxch st(1)
fmul ds:dword ptr[_d_zistepv]
fxch st(1)
fadd ds:dword ptr[_d_ziorigin]
imul ecx,ds:dword ptr[_d_zrowbytes]
faddp st(1),st(0)
fcom ds:dword ptr[float_point5]
add edi,ecx
mov edx,ds:dword ptr[0+esi]
add edx,edx
mov ecx,ds:dword ptr[8+esi]
add edi,edx
push esi
fnstsw ax
test ah,045h
jz LClamp
fmul ds:dword ptr[Float2ToThe31nd]
fistp ds:dword ptr[izi]
mov edx,ds:dword ptr[izi]
LZDraw:
test edi,2
jz LFMiddle
mov eax,edx
add edx,ebx
shr eax,16
dec ecx
mov ds:word ptr[edi],ax
add edi,2
LFMiddle:
push ecx
shr ecx,1
jz LFLast
shr ecx,1
jnc LFMiddleLoop
mov eax,edx
add edx,ebx
shr eax,16
mov esi,edx
add edx,ebx
and esi,0FFFF0000h
or eax,esi
mov ds:dword ptr[edi],eax
add edi,4
and ecx,ecx
jz LFLast
LFMiddleLoop:
mov eax,edx
add edx,ebx
shr eax,16
mov esi,edx
add edx,ebx
and esi,0FFFF0000h
or eax,esi
mov ebp,edx
mov ds:dword ptr[edi],eax
add edx,ebx
shr ebp,16
mov esi,edx
add edx,ebx
and esi,0FFFF0000h
or ebp,esi
mov ds:dword ptr[4+edi],ebp
add edi,8
dec ecx
jnz LFMiddleLoop
LFLast:
pop ecx
pop esi
and ecx,1
jz LFSpanDone
shr edx,16
mov ds:word ptr[edi],dx
LFSpanDone:
mov esi,ds:dword ptr[12+esi]
test esi,esi
jnz LFSpanLoop
jmp LFDone
LFNegSpan:
fmul ds:dword ptr[FloatMinus2ToThe31nd]
fistp ds:dword ptr[izistep]
mov ebx,ds:dword ptr[izistep]
LFNegSpanLoop:
fild ds:dword ptr[4+esi]
fild ds:dword ptr[0+esi]
mov ecx,ds:dword ptr[4+esi]
mov edi,ds:dword ptr[_d_pzbuffer]
fmul ds:dword ptr[_d_zistepu]
fxch st(1)
fmul ds:dword ptr[_d_zistepv]
fxch st(1)
fadd ds:dword ptr[_d_ziorigin]
imul ecx,ds:dword ptr[_d_zrowbytes]
faddp st(1),st(0)
fcom ds:dword ptr[float_point5]
add edi,ecx
mov edx,ds:dword ptr[0+esi]
add edx,edx
mov ecx,ds:dword ptr[8+esi]
add edi,edx
push esi
fnstsw ax
test ah,045h
jz LClampNeg
fmul ds:dword ptr[Float2ToThe31nd]
fistp ds:dword ptr[izi]
mov edx,ds:dword ptr[izi]
LZDrawNeg:
test edi,2
jz LFNegMiddle
mov eax,edx
sub edx,ebx
shr eax,16
dec ecx
mov ds:word ptr[edi],ax
add edi,2
LFNegMiddle:
push ecx
shr ecx,1
jz LFNegLast
shr ecx,1
jnc LFNegMiddleLoop
mov eax,edx
sub edx,ebx
shr eax,16
mov esi,edx
sub edx,ebx
and esi,0FFFF0000h
or eax,esi
mov ds:dword ptr[edi],eax
add edi,4
and ecx,ecx
jz LFNegLast
LFNegMiddleLoop:
mov eax,edx
sub edx,ebx
shr eax,16
mov esi,edx
sub edx,ebx
and esi,0FFFF0000h
or eax,esi
mov ebp,edx
mov ds:dword ptr[edi],eax
sub edx,ebx
shr ebp,16
mov esi,edx
sub edx,ebx
and esi,0FFFF0000h
or ebp,esi
mov ds:dword ptr[4+edi],ebp
add edi,8
dec ecx
jnz LFNegMiddleLoop
LFNegLast:
pop ecx
pop esi
and ecx,1
jz LFNegSpanDone
shr edx,16
mov ds:word ptr[edi],dx
LFNegSpanDone:
mov esi,ds:dword ptr[12+esi]
test esi,esi
jnz LFNegSpanLoop
LFDone:
pop ebx
pop esi
pop edi
pop ebp
ret
_TEXT ENDS
END
|