Quake-2

Quake 2 GPL Source Release
Log | Files | Refs

r_aclipa.asm (4916B)


      1  .386P
      2  .model FLAT
      3 ;
      4 ; r_aliasa.s
      5 ; x86 assembly-language Alias model transform and project code.
      6 ;
      7 
      8 include qasm.inc
      9 include d_if.inc
     10 
     11 if id386
     12 
     13 _DATA SEGMENT	
     14 Ltemp0 dd 0	
     15 Ltemp1 dd 0	
     16 
     17 _DATA ENDS
     18 _TEXT SEGMENT	
     19 
     20 pfv0		equ		8+4
     21 pfv1		equ		8+8
     22 outparm			equ		8+12
     23 
     24  public _R_Alias_clip_bottom	
     25 _R_Alias_clip_bottom:	
     26  push esi	
     27  push edi	
     28 
     29  mov esi,ds:dword ptr[pfv0+esp]	
     30  mov edi,ds:dword ptr[pfv1+esp]	
     31 
     32  mov eax,ds:dword ptr[_r_refdef+rd_aliasvrectbottom]	
     33 
     34 LDoForwardOrBackward:	
     35 
     36  mov edx,ds:dword ptr[fv_v+4+esi]	
     37  mov ecx,ds:dword ptr[fv_v+4+edi]	
     38 
     39  cmp edx,ecx	
     40  jl LDoForward	
     41 
     42  mov ecx,ds:dword ptr[fv_v+4+esi]	
     43  mov edx,ds:dword ptr[fv_v+4+edi]	
     44  mov edi,ds:dword ptr[pfv0+esp]	
     45  mov esi,ds:dword ptr[pfv1+esp]	
     46 
     47 LDoForward:	
     48 
     49  sub ecx,edx	
     50  sub eax,edx	
     51  mov ds:dword ptr[Ltemp1],ecx	
     52  mov ds:dword ptr[Ltemp0],eax	
     53  fild ds:dword ptr[Ltemp1]	
     54  fild ds:dword ptr[Ltemp0]	
     55  mov edx,ds:dword ptr[outparm+esp]	
     56  mov eax,2	
     57 
     58  fdivrp st(1),st(0)	; scale
     59 
     60 LDo3Forward:	
     61  fild ds:dword ptr[fv_v+0+esi]	; fv0v0 | scale
     62  fild ds:dword ptr[fv_v+0+edi]	; fv1v0 | fv0v0 | scale
     63  fild ds:dword ptr[fv_v+4+esi]	; fv0v1 | fv1v0 | fv0v0 | scale
     64  fild ds:dword ptr[fv_v+4+edi]	; fv1v1 | fv0v1 | fv1v0 | fv0v0 | scale
     65  fild ds:dword ptr[fv_v+8+esi]	; fv0v2 | fv1v1 | fv0v1 | fv1v0 | fv0v0 | scale
     66  fild ds:dword ptr[fv_v+8+edi]	; fv1v2 | fv0v2 | fv1v1 | fv0v1 | fv1v0 | fv0v0 |
     67 ;  scale
     68  fxch st(5)	; fv0v0 | fv0v2 | fv1v1 | fv0v1 | fv1v0 | fv1v2 |
     69 ;  scale
     70  fsub st(4),st(0)	; fv0v0 | fv0v2 | fv1v1 | fv0v1 | fv1v0-fv0v0 |
     71 ;  fv1v2 | scale
     72  fxch st(3)	; fv0v1 | fv0v2 | fv1v1 | fv0v0 | fv1v0-fv0v0 |
     73 ;  fv1v2 | scale
     74  fsub st(2),st(0)	; fv0v1 | fv0v2 | fv1v1-fv0v1 | fv0v0 |
     75 ;  fv1v0-fv0v0 | fv1v2 | scale
     76  fxch st(1)	; fv0v2 | fv0v1 | fv1v1-fv0v1 | fv0v0 |
     77 ;  fv1v0-fv0v0 | fv1v2 | scale
     78  fsub st(5),st(0)	; fv0v2 | fv0v1 | fv1v1-fv0v1 | fv0v0 |
     79 ;  fv1v0-fv0v0 | fv1v2-fv0v2 | scale
     80  fxch st(6)	; scale | fv0v1 | fv1v1-fv0v1 | fv0v0 |
     81 ;  fv1v0-fv0v0 | fv1v2-fv0v2 | fv0v2
     82  fmul st(4),st(0)	; scale | fv0v1 | fv1v1-fv0v1 | fv0v0 |
     83 ;  (fv1v0-fv0v0)*scale | fv1v2-fv0v2 | fv0v2
     84  add edi,12	
     85  fmul st(2),st(0)	; scale | fv0v1 | (fv1v1-fv0v1)*scale | fv0v0 |
     86 ;  (fv1v0-fv0v0)*scale | fv1v2-fv0v2 | fv0v2
     87  add esi,12	
     88  add edx,12	
     89  fmul st(5),st(0)	; scale | fv0v1 | (fv1v1-fv0v1)*scale | fv0v0 |
     90 ;  (fv1v0-fv0v0)*scale | (fv1v2-fv0v2)*scale |
     91 ;  fv0v2
     92  fxch st(3)	; fv0v0 | fv0v1 | (fv1v1-fv0v1)*scale | scale |
     93 ;  (fv1v0-fv0v0)*scale | (fv1v2-fv0v2)*scale |
     94 ;  fv0v2
     95  faddp st(4),st(0)	; fv0v1 | (fv1v1-fv0v1)*scale | scale |
     96 ;  fv0v0+(fv1v0-fv0v0)*scale |
     97 ;  (fv1v2-fv0v2)*scale | fv0v2
     98  faddp st(1),st(0)	; fv0v1+(fv1v1-fv0v1)*scale | scale |
     99 ;  fv0v0+(fv1v0-fv0v0)*scale |
    100 ;  (fv1v2-fv0v2)*scale | fv0v2
    101  fxch st(4)	; fv0v2 | scale | fv0v0+(fv1v0-fv0v0)*scale |
    102 ;  (fv1v2-fv0v2)*scale | fv0v1+(fv1v1-fv0v1)*scale
    103  faddp st(3),st(0)	; scale | fv0v0+(fv1v0-fv0v0)*scale |
    104 ;  fv0v2+(fv1v2-fv0v2)*scale |
    105 ;  fv0v1+(fv1v1-fv0v1)*scale
    106  fxch st(1)	; fv0v0+(fv1v0-fv0v0)*scale | scale | 
    107 ;  fv0v2+(fv1v2-fv0v2)*scale |
    108 ;  fv0v1+(fv1v1-fv0v1)*scale
    109  fadd ds:dword ptr[float_point5]	
    110  fxch st(3)	; fv0v1+(fv1v1-fv0v1)*scale | scale | 
    111 ;  fv0v2+(fv1v2-fv0v2)*scale |
    112 ;  fv0v0+(fv1v0-fv0v0)*scale
    113  fadd ds:dword ptr[float_point5]	
    114  fxch st(2)	; fv0v2+(fv1v2-fv0v2)*scale | scale | 
    115 ;  fv0v1+(fv1v1-fv0v1)*scale |
    116 ;  fv0v0+(fv1v0-fv0v0)*scale
    117  fadd ds:dword ptr[float_point5]	
    118  fxch st(3)	; fv0v0+(fv1v0-fv0v0)*scale | scale | 
    119 ;  fv0v1+(fv1v1-fv0v1)*scale |
    120 ;  fv0v2+(fv1v2-fv0v2)*scale
    121  fistp ds:dword ptr[fv_v+0-12+edx]	; scale | fv0v1+(fv1v1-fv0v1)*scale |
    122 ;  fv0v2+(fv1v2-fv0v2)*scale
    123  fxch st(1)	; fv0v1+(fv1v1-fv0v1)*scale | scale |
    124 ;  fv0v2+(fv1v2-fv0v2)*scale | scale
    125  fistp ds:dword ptr[fv_v+4-12+edx]	; scale | fv0v2+(fv1v2-fv0v2)*scale
    126  fxch st(1)	; fv0v2+(fv1v2-fv0v2)*sc | scale
    127  fistp ds:dword ptr[fv_v+8-12+edx]	; scale
    128 
    129  dec eax	
    130  jnz LDo3Forward	
    131 
    132  fstp st(0)	
    133 
    134  pop edi	
    135  pop esi	
    136 
    137  ret	
    138 
    139 
    140  public _R_Alias_clip_top	
    141 _R_Alias_clip_top:	
    142  push esi	
    143  push edi	
    144 
    145  mov esi,ds:dword ptr[pfv0+esp]	
    146  mov edi,ds:dword ptr[pfv1+esp]	
    147 
    148  mov eax,ds:dword ptr[_r_refdef+rd_aliasvrect+4]	
    149  jmp LDoForwardOrBackward	
    150 
    151 
    152 
    153  public _R_Alias_clip_right	
    154 _R_Alias_clip_right:	
    155  push esi	
    156  push edi	
    157 
    158  mov esi,ds:dword ptr[pfv0+esp]	
    159  mov edi,ds:dword ptr[pfv1+esp]	
    160 
    161  mov eax,ds:dword ptr[_r_refdef+rd_aliasvrectright]	
    162 
    163 LRightLeftEntry:	
    164 
    165 
    166  mov edx,ds:dword ptr[fv_v+4+esi]	
    167  mov ecx,ds:dword ptr[fv_v+4+edi]	
    168 
    169  cmp edx,ecx	
    170  mov edx,ds:dword ptr[fv_v+0+esi]	
    171 
    172  mov ecx,ds:dword ptr[fv_v+0+edi]	
    173  jl LDoForward2	
    174 
    175  mov ecx,ds:dword ptr[fv_v+0+esi]	
    176  mov edx,ds:dword ptr[fv_v+0+edi]	
    177  mov edi,ds:dword ptr[pfv0+esp]	
    178  mov esi,ds:dword ptr[pfv1+esp]	
    179 
    180 LDoForward2:	
    181 
    182  jmp LDoForward	
    183 
    184 
    185  public _R_Alias_clip_left	
    186 _R_Alias_clip_left:	
    187  push esi	
    188  push edi	
    189 
    190  mov esi,ds:dword ptr[pfv0+esp]	
    191  mov edi,ds:dword ptr[pfv1+esp]	
    192 
    193  mov eax,ds:dword ptr[_r_refdef+rd_aliasvrect+0]	
    194  jmp LRightLeftEntry	
    195 
    196 
    197 
    198 _TEXT ENDS
    199 endif	;id386
    200  END