Difference for texmap/tmappent.S from version 1.1 to 1.2


version 1.1 version 1.2
Line 1
 
Line 1
 /// tmap_scanline_per - Pentium-optimized assembly version  /// tmap_scanline_per - Pentium-optimized assembly version
 /// written by Brian Raiter, Mar 1998.  /// written by Brian Raiter, Mar 1998.
   /// lighting roundoff error fixed by Matt Mueller, July 1999
   
    
 /// The gist of the algorithm is as follows (note that this is  /// The gist of the algorithm is as follows (note that this is
Line 280
 
Line 281
 // original values are divided by 256 so that the byte needed for the  // original values are divided by 256 so that the byte needed for the
 // fade table offset is squarely in %dh.  // fade table offset is squarely in %dh.
   
   //Dividing by 256 is bad.. rounding errors and crap.  We'll now do that
   //right before we need to access the table instead.  -MM
   
                 movl    (_fx_l), %ebp                  movl    (_fx_l), %ebp
  sarl $8, %ebp  // sarl $8, %ebp
                 movl    (_fx_dl_dx), %edx                  movl    (_fx_dl_dx), %edx
  sarl $6, %edx  // sarl $6, %edx
    sall $2, %edx
  movl %edx, (dldx)   movl %edx, (dldx)
   
 // Store pixptr, the pointer to our 64x64 texture map, in %esi. Store  // Store pixptr, the pointer to our 64x64 texture map, in %esi. Store
Line 395
 
Line 400
                 movb    %cl, %ch                // 0 b                  movb    %cl, %ch                // 0 b
  subl %eax, %ebx   subl %eax, %ebx
                 shrl    $10, %ecx               // 0 c                  shrl    $10, %ecx               // 0 c
 //edited 05/14/99 Matt Mueller - original glitches in really dark places, so changed from 0xFF00 to 0x7F00 to eliminate invalid values   movl $0x7F0000, %edx
  movl $0x7F00, %edx  
 //end edit -MM  
  shrl $2, %ebx   shrl $2, %ebx
  andl %ebp, %edx   andl %ebp, %edx
    sarl $8, %edx
                 movb    (%esi,%ecx), %dl        // 0 d                  movb    (%esi,%ecx), %dl        // 0 d
  addl $4, %edi   addl $4, %edi
                 lea     (%eax,%ebx,2), %ecx     // %ecx = uv value for pixel 2                  lea     (%eax,%ebx,2), %ecx     // %ecx = uv value for pixel 2
Line 488
 
Line 492
                 movb    %cl, %ch                // 0 b                  movb    %cl, %ch                // 0 b
  addl $4, %edi   addl $4, %edi
                 shrl    $10, %ecx               // 0 c                  shrl    $10, %ecx               // 0 c
 //edited 05/14/99 Matt Mueller - original glitches in really dark places, so changed from 0xFF00 to 0x7F00 to eliminate invalid values   movl $0x7F0000, %edx
  movl $0x7F00, %edx  
 //end edit -MM  
  movl %ebx, (uvzero)   movl %ebx, (uvzero)
  andl %ebp, %edx   andl %ebp, %edx
    sarl $8, %edx
                 movb    (%esi,%ecx), %dl        // 0 d                  movb    (%esi,%ecx), %dl        // 0 d
  orl $0x1000, %ebx   orl $0x1000, %ebx
  subl %eax, %ebx   subl %eax, %ebx
Line 579
 
Line 582
  andl $0x003FC0FF, %ecx   andl $0x003FC0FF, %ecx
  movl %ebp, %edx   movl %ebp, %edx
  movl (lastpixel), %ebp   movl (lastpixel), %ebp
 //added 05/14/99 Matt Mueller - original glitches in really dark places, this fixes it.  whee.   andl $0x7F0000, %edx
  andl $0x7F00, %edx   sarl $8, %edx
 //end addition -MM  
   
 LoopLastBits: movl %ebx, %eax  LoopLastBits: movl %ebx, %eax
  movb %al, %ah   movb %al, %ah

Legend:
line(s) removed in v.1.1 
line(s) changed
 line(s) added in v.1.2