Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > by-pkgid > f4ff491002f051797b330d46898cdbe6 > files > 2

VisualBoyAdvance-1.8.0-1plf2011.0.src.rpm

#! /bin/sh /usr/share/dpatch/dpatch-run
## 06_old_2xSaImmx_asm.dpatch by Jose Carlos Medeiros <debian@psabs.com.br>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad visualboyadvance-1.8.0~/src/i386/2xSaImmx.asm visualboyadvance-1.8.0/src/i386/2xSaImmx.asm
--- visualboyadvance-1.8.0~/src/i386/2xSaImmx.asm	2007-05-18 16:22:58.000000000 -0300
+++ visualboyadvance-1.8.0/src/i386/2xSaImmx.asm	2007-05-18 17:19:58.000000000 -0300
@@ -1,38 +1,40 @@
 ;/*---------------------------------------------------------------------*
 ; * The following (piece of) code, (part of) the 2xSaI engine,          *
-; * copyright (c) 2001 by Derek Liauw Kie Fa.                           *
-; * Non-Commercial use of the engine is allowed and is encouraged,      *
-; * provided that appropriate credit be given and that this copyright   *
-; * notice will not be removed under any circumstance.                  *
+; * copyright (c) 1999 - 2001 by Derek Liauw Kie Fa.                    *
+; * Non-Commercial use of this software is allowed and is encouraged,   *
+; * provided that appropriate credit be given.                          *
 ; * You may freely modify this code, but I request                      *
 ; * that any improvements to the engine be submitted to me, so          *
 ; * that I can implement these improvements in newer versions of        *
-; * the engine.                                                         *
+; * the software.                                                       *
 ; * If you need more information, have any comments or suggestions,     *
-; * you can e-mail me. My e-mail: DerekL666@yahoo.com                   *
+; * you can e-mail me. My e-mail: derek-liauw@usa.net.                  *
 ; *---------------------------------------------------------------------*/
-; modified by Spacy to compile with yasm [2006-06-20]
 
 ;----------------------
-; 2xSaI, Super2xSaI, SuperEagle .. FINAL. no versioning anymore..
+; 2xSaI version 0.59 WIP, soon to become version 0.60
 ;----------------------
 
-	  BITS 32
+;%define FAR_POINTER
+
+
+
+          BITS 32
 %ifdef __DJGPP__
           GLOBAL __2xSaILine
           GLOBAL __2xSaISuperEagleLine
-          GLOBAL __2xSaISuper2xSaILine
+                  GLOBAL __2xSaISuper2xSaILine
           GLOBAL _Init_2xSaIMMX
 %else
           GLOBAL _2xSaILine
           GLOBAL _2xSaISuperEagleLine
-          GLOBAL _2xSaISuper2xSaILine
+                  GLOBAL _2xSaISuper2xSaILine
           GLOBAL Init_2xSaIMMX
 %endif
-	  SECTION .text ALIGN = 32
+          SECTION .text ALIGN = 32
 
-%ifdef __DJGPP__
-;EXTERN_C void __2xSaILine (uint8 *srcPtr, uint32 srcPitch, uint32 width,
+%ifdef FAR_POINTER
+;EXTERN_C void _2xSaILine (uint8 *srcPtr, uint32 srcPitch, uint32 width,
 ;                        uint8 *dstPtr, uint32 dstPitch, uint16 dstSegment);
 %else
 ;EXTERN_C void _2xSaILine (uint8 *srcPtr, uint32 srcPitch, uint32 width,
@@ -48,6 +50,8 @@
 dstSegment    equ 32
 
 
+
+
 colorB0   equ -2
 colorB1   equ 0
 colorB2   equ 2
@@ -75,23 +79,18 @@
 
 
 
-
-
-
-
-
 %ifdef __DJGPP__
 __2xSaISuper2xSaILine:
 %else
-NEWSYM _2xSaISuper2xSaILine
+_2xSaISuper2xSaILine:
 %endif
 ; Store some stuff
-	 push ebp
-	 mov ebp, esp
+         push ebp
+         mov ebp, esp
          pushad
 
 ; Prepare the destination
-%ifdef __DJGPP__
+%ifdef FAR_POINTER
          ; Set the selector
          mov eax, [ebp+dstSegment]
          mov fs, ax
@@ -99,11 +98,11 @@
          mov edx, [ebp+dstOffset]         ; edx points to the screen
 ; Prepare the source
          ; eax points to colorA
-         mov eax, [ebp+srcPtr]				;eax points to colorA
-         mov ebx, [ebp+srcPitch]			;ebx contains the source pitch
-         mov ecx, [ebp+width]				;ecx contains the number of pixels to process
+         mov eax, [ebp+srcPtr]                          ;eax points to colorA
+         mov ebx, [ebp+srcPitch]                        ;ebx contains the source pitch
+         mov ecx, [ebp+width]                           ;ecx contains the number of pixels to process
          ; eax now points to colorB1
-         sub eax, ebx						;eax points to B1 which is the base 
+         sub eax, ebx                                           ;eax points to B1 which is the base 
 
 ; Main Loop
 .Loop:   push ecx
@@ -112,7 +111,7 @@
          mov ecx, [ebp+deltaPtr]
 
 
-		;load source img
+                ;load source img
          movq mm0, [eax+colorB0]
          movq mm1, [eax+colorB3]
          movq mm2, [eax+ebx+color4]
@@ -125,7 +124,7 @@
          movq mm7, [eax+ebx+ebx+colorA3]
          pop eax
 
-		;compare to delta
+                ;compare to delta
          pcmpeqw mm0, [ecx+2+colorB0]
          pcmpeqw mm1, [ecx+2+colorB3]
          pcmpeqw mm2, [ecx+ebx+2+color4]
@@ -138,7 +137,7 @@
          sub ecx, ebx
 
 
-		;compose results
+                ;compose results
          pand mm0, mm1
          pand mm2, mm3
          pand mm4, mm5
@@ -148,14 +147,14 @@
          pxor mm7, mm7
          pand mm0, mm4
          movq mm6, [eax+colorB0]
-         pcmpeqw mm7, mm0			;did any compare give us a zero ?
+         pcmpeqw mm7, mm0                       ;did any compare give us a zero ?
 
          movq [ecx+2+colorB0], mm6
 
          packsswb mm7, mm7
          movd ecx, mm7
-         test ecx, ecx				
-         jz near .SKIP_PROCESS		;no, so we can skip
+         test ecx, ecx                          
+         jz near .SKIP_PROCESS          ;no, so we can skip
 
          ;End Delta
 
@@ -433,15 +432,15 @@
          pcmpgtw mm0, mm1
 
          por mm7, [Mask35]
-         por mm0, [Mask26]
+         por mm0, [Mask26] 
          movq [Mask35], mm7
          movq [Mask26], mm0
 
 .SKIP_GUESS:
 
-         ;Start the ASSEMBLY !!!	eh... compose all the results together to form the final image...
+         ;Start the ASSEMBLY !!!        eh... compose all the results together to form the final image...
 
-		 
+                 
          movq mm0, [eax+ebx+color5]
          movq mm1, [eax+ebx+ebx+color2]
          movq mm2, mm0
@@ -460,7 +459,7 @@
 
          pand mm3, mm2
          paddw mm0, mm3                ;mm0 contains the interpolated values
-		 ;---------------------------
+                 ;---------------------------
 
 
 
@@ -485,102 +484,102 @@
 %endif
 
 
-		 movq mm7, [Mask26]
-		 movq mm6, [eax+colorB2]
-		 movq mm5, [eax+ebx+ebx+color2]
-		 movq mm4, [eax+ebx+ebx+color1]
-		 pcmpeqw mm4, mm5
-		 pcmpeqw mm6, mm5
-		 pxor mm5, mm5
-		 pand mm7, mm4
-		 pcmpeqw mm6, mm5
-		 pand mm7, mm6
+                 movq mm7, [Mask26]
+                 movq mm6, [eax+colorB2]
+                 movq mm5, [eax+ebx+ebx+color2]
+                 movq mm4, [eax+ebx+ebx+color1]
+                 pcmpeqw mm4, mm5
+                 pcmpeqw mm6, mm5
+                 pxor mm5, mm5
+                 pand mm7, mm4
+                 pcmpeqw mm6, mm5
+                 pand mm7, mm6
 
 
 
-		 movq mm6, [eax+ebx+ebx+color3]
-		 movq mm5, [eax+ebx+ebx+color2]
-		 movq mm4, [eax+ebx+ebx+color1]
-		 movq mm2, [eax+ebx+color5]
-		 movq mm1, [eax+ebx+color4]
-		 movq mm3, [eax+colorB0]
+                 movq mm6, [eax+ebx+ebx+color3]
+                 movq mm5, [eax+ebx+ebx+color2]
+                 movq mm4, [eax+ebx+ebx+color1]
+                 movq mm2, [eax+ebx+color5]
+                 movq mm1, [eax+ebx+color4]
+                 movq mm3, [eax+colorB0]
 
-		 pcmpeqw mm2, mm4
-		 pcmpeqw mm6, mm5
-		 pcmpeqw mm1, mm5
-		 pcmpeqw mm3, mm5
-		 pxor mm5, mm5
-		 pcmpeqw mm2, mm5
-		 pcmpeqw mm3, mm5
-		 pand mm6, mm1
-		 pand mm2, mm3
-		 pand mm6, mm2
-		 por mm7, mm6
+                 pcmpeqw mm2, mm4
+                 pcmpeqw mm6, mm5
+                 pcmpeqw mm1, mm5
+                 pcmpeqw mm3, mm5
+                 pxor mm5, mm5
+                 pcmpeqw mm2, mm5
+                 pcmpeqw mm3, mm5
+                 pand mm6, mm1
+                 pand mm2, mm3
+                 pand mm6, mm2
+                 por mm7, mm6
 
-		 
-		 movq mm6, mm7
-		 pcmpeqw mm6, mm5
-		 pand mm7, mm0
+                 
+                 movq mm6, mm7
+                 pcmpeqw mm6, mm5
+                 pand mm7, mm0
 
-		 movq mm1, [eax+ebx+color5]
-		 pand mm6, mm1
-		 por mm7, mm6
-		 movq [final1a], mm7			;finished  1a
+                 movq mm1, [eax+ebx+color5]
+                 pand mm6, mm1
+                 por mm7, mm6
+                 movq [final1a], mm7                    ;finished  1a
 
 
-	 
-	     ;--------------------------------		 
+         
+             ;--------------------------------           
 
-		 movq mm7, [Mask35]
-		 push eax
-		 add eax, ebx
-		 movq mm6, [eax+ebx+ebx+colorA2]
-		 pop eax
-		 movq mm5, [eax+ebx+color5]
-		 movq mm4, [eax+ebx+color4]
-		 pcmpeqw mm4, mm5
-		 pcmpeqw mm6, mm5
-		 pxor mm5, mm5
-		 pand mm7, mm4
-		 pcmpeqw mm6, mm5
-		 pand mm7, mm6
+                 movq mm7, [Mask35]
+                 push eax
+                 add eax, ebx
+                 movq mm6, [eax+ebx+ebx+colorA2]
+                 pop eax
+                 movq mm5, [eax+ebx+color5]
+                 movq mm4, [eax+ebx+color4]
+                 pcmpeqw mm4, mm5
+                 pcmpeqw mm6, mm5
+                 pxor mm5, mm5
+                 pand mm7, mm4
+                 pcmpeqw mm6, mm5
+                 pand mm7, mm6
 
 
 
-		 movq mm6, [eax+ebx+color6]
-		 movq mm5, [eax+ebx+color5]
-		 movq mm4, [eax+ebx+color4]
-		 movq mm2, [eax+ebx+ebx+color2]
-		 movq mm1, [eax+ebx+ebx+color1]
-		 push eax
-		 add eax, ebx
-		 movq mm3, [eax+ebx+ebx+colorA0]
-		 pop eax
+                 movq mm6, [eax+ebx+color6]
+                 movq mm5, [eax+ebx+color5]
+                 movq mm4, [eax+ebx+color4]
+                 movq mm2, [eax+ebx+ebx+color2]
+                 movq mm1, [eax+ebx+ebx+color1]
+                 push eax
+                 add eax, ebx
+                 movq mm3, [eax+ebx+ebx+colorA0]
+                 pop eax
 
-		 pcmpeqw mm2, mm4
-		 pcmpeqw mm6, mm5
-		 pcmpeqw mm1, mm5
-		 pcmpeqw mm3, mm5
-		 pxor mm5, mm5
-		 pcmpeqw mm2, mm5
-		 pcmpeqw mm3, mm5
-		 pand mm6, mm1
-		 pand mm2, mm3
-		 pand mm6, mm2
-		 por mm7, mm6
+                 pcmpeqw mm2, mm4
+                 pcmpeqw mm6, mm5
+                 pcmpeqw mm1, mm5
+                 pcmpeqw mm3, mm5
+                 pxor mm5, mm5
+                 pcmpeqw mm2, mm5
+                 pcmpeqw mm3, mm5
+                 pand mm6, mm1
+                 pand mm2, mm3
+                 pand mm6, mm2
+                 por mm7, mm6
 
-		 
-		 movq mm6, mm7
-		 pcmpeqw mm6, mm5
-		 pand mm7, mm0
+                 
+                 movq mm6, mm7
+                 pcmpeqw mm6, mm5
+                 pand mm7, mm0
 
-		 movq mm1, [eax+ebx+ebx+color2]
-		 pand mm6, mm1
-		 por mm7, mm6
-		 movq [final2a], mm7			;finished  2a
+                 movq mm1, [eax+ebx+ebx+color2]
+                 pand mm6, mm1
+                 por mm7, mm6
+                 movq [final2a], mm7                    ;finished  2a
 
 
-		 ;--------------------------------------------
+                 ;--------------------------------------------
  
 
 %ifdef dfhsdfhsdahdsfhdsfh
@@ -601,133 +600,168 @@
                       product1b = INTERPOLATE (color5, color6);
 %endif
 
-		 push eax
-		 add eax, ebx
-		 pxor mm7, mm7
-		 movq mm0, [eax+ebx+ebx+colorA0]
-		 movq mm1, [eax+ebx+ebx+colorA1]
-		 movq mm2, [eax+ebx+ebx+colorA2]
-		 movq mm3, [eax+ebx+ebx+colorA3]
-		 pop eax
-		 movq mm4, [eax+ebx+ebx+color2]
-		 movq mm5, [eax+ebx+ebx+color3]
-		 movq mm6, [eax+ebx+color6]
+                 push eax
+                 add eax, ebx
+                 pxor mm7, mm7
+                 movq mm0, [eax+ebx+ebx+colorA0]
+                 movq mm1, [eax+ebx+ebx+colorA1]
+                 movq mm2, [eax+ebx+ebx+colorA2]
+                 movq mm3, [eax+ebx+ebx+colorA3]
+                 pop eax
+                 movq mm4, [eax+ebx+ebx+color2]
+                 movq mm5, [eax+ebx+ebx+color3]
+                 movq mm6, [eax+ebx+color6]
 
-		 pcmpeqw mm6, mm5
-		 pcmpeqw mm1, mm5
-		 pcmpeqw mm4, mm2
-		 pcmpeqw mm0, mm5
-		 pcmpeqw mm4, mm7
-		 pcmpeqw mm0, mm7
-		 pand mm0, mm4
-		 pand mm6, mm1
-		 pand mm0, mm6
+                 pcmpeqw mm6, mm5
+                 pcmpeqw mm1, mm5
+                 pcmpeqw mm4, mm2
+                 pcmpeqw mm0, mm5
+                 pcmpeqw mm4, mm7
+                 pcmpeqw mm0, mm7
+                 pand mm0, mm4
+                 pand mm6, mm1
+                 pand mm0, mm6
 
-		 movq mm4, [eax+ebx+color2]
-		 movq mm5, [eax+ebx+ebx+color5]
-		 movq mm6, [eax+ebx+ebx+color3]
 
-		 pcmpeqw mm5, mm4
-		 pcmpeqw mm2, mm4
-		 pcmpeqw mm1, mm6
-		 pcmpeqw mm3, mm4
-		 pcmpeqw mm1, mm7
-		 pcmpeqw mm3, mm7
-		 pand mm2, mm5
-		 pand mm1, mm3
-		 pand mm1, mm2
+                 push eax
+                 add eax, ebx
+                 movq mm1, [eax+ebx+ebx+colorA1]
+                 pop eax
+                 movq mm4, [eax+ebx+ebx+color2]
+                 movq mm5, [eax+ebx+color5]
+                 movq mm6, [eax+ebx+ebx+color3]
 
-		 movq mm2, mm0
-		 movq mm7, [I2333Pixel]
-		 movq mm6, [I2223Pixel]
-		 movq mm5, [I23Pixel]
-		 movq mm4, [Mask35]
-		 movq mm3, [Mask26]
+                 pcmpeqw mm5, mm4
+                 pcmpeqw mm2, mm4
+                 pcmpeqw mm1, mm6
+                 pcmpeqw mm3, mm4
+                 pcmpeqw mm1, mm7
+                 pcmpeqw mm3, mm7
+                 pand mm2, mm5
+                 pand mm1, mm3
+                 pand mm1, mm2
 
-		 por mm2, mm4
-		 pand mm4, [eax+ebx+ebx+color3]
-		 por mm2, mm3
-		 pand mm3, [eax+ebx+ebx+color2]
-		 por mm2, mm1
-		 pand mm0, mm7
-		 pand mm1, mm6
-		 pxor mm7, mm7
-		 pcmpeqw mm2, mm7
-		 por mm0, mm1
-		 por mm3, mm4
-		 pand mm2, mm5
-		 por mm0, mm3
-		 por mm0, mm2
-		 movq [final2b], mm0
 
-		 ;-----------------------------------
-		 
+                 movq mm7, mm0
+                 por mm7, mm1
 
-		 pxor mm7, mm7
-		 movq mm0, [eax+colorB0]
-		 movq mm1, [eax+colorB1]
-		 movq mm2, [eax+colorB2]
-		 movq mm3, [eax+colorB3]
-		 movq mm4, [eax+ebx+color5]
-		 movq mm5, [eax+ebx+color6]
-		 movq mm6, [eax+ebx+ebx+color3]
+                 movq mm4, [Mask35]
+                 movq mm3, [Mask26]
+                 
+                 movq mm6, mm4
+                 pand mm6, mm7
+                 pxor mm4, mm6
 
-		 pcmpeqw mm6, mm5
-		 pcmpeqw mm1, mm5
-		 pcmpeqw mm4, mm2
-		 pcmpeqw mm0, mm5
-		 pcmpeqw mm4, mm7
-		 pcmpeqw mm0, mm7
-		 pand mm0, mm4
-		 pand mm6, mm1
-		 pand mm0, mm6
+                 movq mm6, mm3
+                 pand mm6, mm7
+                 pxor mm3, mm6
 
-		 movq mm4, [eax+ebx+color5]
-		 movq mm5, [eax+ebx+ebx+color2]
-		 movq mm6, [eax+ebx+color6]
+                 movq mm2, mm0
+                 movq mm7, [I2333Pixel]
+                 movq mm6, [I2223Pixel]
+                 movq mm5, [I23Pixel]
 
-		 pcmpeqw mm5, mm4
-		 pcmpeqw mm2, mm4
-		 pcmpeqw mm1, mm6
-		 pcmpeqw mm3, mm4
-		 pcmpeqw mm1, mm7
-		 pcmpeqw mm3, mm7
-		 pand mm2, mm5
-		 pand mm1, mm3
-		 pand mm1, mm2
 
-		 movq mm2, mm0
-		 movq mm7, [I5666Pixel]
-		 movq mm6, [I5556Pixel]
-		 movq mm5, [I56Pixel]
-		 movq mm4, [Mask35]
-		 movq mm3, [Mask26]
+                 por mm2, mm4
+                 pand mm4, [eax+ebx+ebx+color3]
+                 por mm2, mm3
+                 pand mm3, [eax+ebx+ebx+color2]
+                 por mm2, mm1
+                 pand mm0, mm7
+                 pand mm1, mm6
+                 pxor mm7, mm7
+                 pcmpeqw mm2, mm7
+                 por mm0, mm1
+                 por mm3, mm4
+                 pand mm2, mm5
+                 por mm0, mm3
+                 por mm0, mm2
+                 movq [final2b], mm0
 
-		 por mm2, mm4
-		 pand mm4, [eax+ebx+color5]
-		 por mm2, mm3
-		 pand mm3, [eax+ebx+color6]
-		 por mm2, mm1
-		 pand mm0, mm7
-		 pand mm1, mm6
-		 pxor mm7, mm7
-		 pcmpeqw mm2, mm7
-		 por mm0, mm1
-		 por mm3, mm4
-		 pand mm2, mm5
-		 por mm0, mm3
-		 por mm0, mm2
-		 movq [final1b], mm0
-		 
-	  ;---------
+                 ;-----------------------------------
+                 
 
-		 movq mm0, [final1a]
-		 movq mm4, [final2a]
-		 movq mm2, [final1b]
-		 movq mm6, [final2b]
+                 pxor mm7, mm7
+                 movq mm0, [eax+colorB0]
+                 movq mm1, [eax+colorB1]
+                 movq mm2, [eax+colorB2]
+                 movq mm3, [eax+colorB3]
+                 movq mm4, [eax+ebx+color5]
+                 movq mm5, [eax+ebx+color6]
+                 movq mm6, [eax+ebx+ebx+color3]
 
-		 movq mm1, mm0
-		 movq mm5, mm4
+                 pcmpeqw mm6, mm5
+                 pcmpeqw mm1, mm5
+                 pcmpeqw mm4, mm2
+                 pcmpeqw mm0, mm5
+                 pcmpeqw mm4, mm7
+                 pcmpeqw mm0, mm7
+                 pand mm0, mm4
+                 pand mm6, mm1
+                 pand mm0, mm6
+
+                 movq mm1, [eax+colorB1]
+                 movq mm4, [eax+ebx+color5]
+                 movq mm5, [eax+ebx+ebx+color2]
+                 movq mm6, [eax+ebx+color6]
+
+                 pcmpeqw mm5, mm4
+                 pcmpeqw mm2, mm4
+                 pcmpeqw mm1, mm6
+                 pcmpeqw mm3, mm4
+                 pcmpeqw mm1, mm7
+                 pcmpeqw mm3, mm7
+                 pand mm2, mm5
+                 pand mm1, mm3
+                 pand mm1, mm2
+
+
+                 movq mm7, mm0
+                 por mm7, mm1
+
+                 movq mm4, [Mask35]
+                 movq mm3, [Mask26]
+                 
+                 movq mm6, mm4
+                 pand mm6, mm7
+                 pxor mm4, mm6
+
+                 movq mm6, mm3
+                 pand mm6, mm7
+                 pxor mm3, mm6
+
+                 movq mm2, mm0
+                 movq mm7, [I5666Pixel]
+                 movq mm6, [I5556Pixel]
+                 movq mm5, [I56Pixel]
+
+
+                 por mm2, mm4
+                 pand mm4, [eax+ebx+color5]
+                 por mm2, mm3
+                 pand mm3, [eax+ebx+color6]
+                 por mm2, mm1
+                 pand mm0, mm7
+                 pand mm1, mm6
+                 pxor mm7, mm7
+                 pcmpeqw mm2, mm7
+                 por mm0, mm1
+                 por mm3, mm4
+                 pand mm2, mm5
+                 por mm0, mm3
+                 por mm0, mm2
+                 movq [final1b], mm0
+                 
+          ;---------
+
+                 movq mm0, [final1a]
+                 movq mm4, [final2a]
+                 movq mm2, [final1b]
+                 movq mm6, [final2b]
+
+
+                 movq mm1, mm0
+                 movq mm5, mm4
 
 
          punpcklwd mm0, mm2
@@ -746,12 +780,12 @@
          movq [fs:edx+8], mm5
          pop edx
 %else
-         movq [es:edx], mm0
-         movq [es:edx+8], mm1
+         movq [edx], mm0
+         movq [edx+8], mm1
          push edx
          add edx, [ebp+dstPitch]
-         movq [es:edx], mm4
-         movq [es:edx+8], mm5
+         movq [edx], mm4
+         movq [edx+8], mm5
          pop edx
 %endif
 .SKIP_PROCESS:
@@ -784,22 +818,18 @@
 
 
 
-
-
-
-
 %ifdef __DJGPP__
 __2xSaISuperEagleLine:
 %else
-NEWSYM _2xSaISuperEagleLine
+_2xSaISuperEagleLine:
 %endif
 ; Store some stuff
-	 push ebp
-	 mov ebp, esp
+         push ebp
+         mov ebp, esp
          pushad
 
 ; Prepare the destination
-%ifdef __DJGPP__
+%ifdef FAR_POINTER
          ; Set the selector
          mov eax, [ebp+dstSegment]
          mov fs, ax
@@ -1187,9 +1217,9 @@
          pcmpgtw mm0, mm1
 
          por mm7, [Mask35]
-         por mm1, [Mask26]
+         por mm0, [Mask26]
          movq [Mask35], mm7
-         movq [Mask26], mm1
+         movq [Mask26], mm0
 
 .SKIP_GUESS:
          ;Start the ASSEMBLY !!!
@@ -1301,7 +1331,7 @@
 
 
 
-%ifdef __DJGPP__
+%ifdef FAR_POINTER
          movq [fs:edx], mm0
          movq [fs:edx+8], mm1
          push edx
@@ -1310,12 +1340,12 @@
          movq [fs:edx+8], mm5
          pop edx
 %else
-         movq [es:edx], mm0
-         movq [es:edx+8], mm1
+         movq [edx], mm0
+         movq [edx+8], mm1
          push edx
          add edx, [ebp+dstPitch]
-         movq [es:edx], mm4
-         movq [es:edx+8], mm5
+         movq [edx], mm4
+         movq [edx+8], mm5
          pop edx
 %endif
 .SKIP_PROCESS:
@@ -1347,7 +1377,7 @@
 ;-------------------------------------------------------------------------
 
 
-;This is 2xSaI
+;This is version 0.50
 colorI   equ -2
 colorE   equ 0
 colorF   equ 2
@@ -1371,15 +1401,15 @@
 %ifdef __DJGPP__
 __2xSaILine:
 %else
-NEWSYM _2xSaILine
+_2xSaILine:
 %endif
 ; Store some stuff
-	 push ebp
-	 mov ebp, esp
+         push ebp
+         mov ebp, esp
          pushad
 
 ; Prepare the destination
-%ifdef __DJGPP__
+%ifdef FAR_POINTER
          ; Set the selector
          mov eax, [ebp+dstSegment]
          mov fs, ax
@@ -1569,12 +1599,12 @@
          punpcklwd mm5, mm0
          punpckhwd mm6, mm0
 
-%ifdef __DJGPP__
+%ifdef FAR_POINTER
          movq [fs:edx], mm5
          movq [fs:edx+8], mm6
 %else
-         movq [es:edx], mm5
-         movq [es:edx+8], mm6
+         movq [edx], mm5
+         movq [edx+8], mm6
 %endif
 
 ;------------------------------------------------
@@ -1736,6 +1766,7 @@
          movd ecx, mm7
          test ecx, ecx
          jz near .SKIP_GUESS
+
 ;---------------------------------------------
 ; Map of the pixels:                    I|E F|J
 ;                                       G|A B|K
@@ -1856,9 +1887,9 @@
          pcmpgtw mm0, mm1
 
          por mm7, [Mask1]
-         por mm1, [Mask2]
+         por mm0, [Mask2]
          movq [Mask1], mm7
-         movq [Mask2], mm1
+         movq [Mask2], mm0
 
 .SKIP_GUESS:
          ;----------------------------
@@ -1922,12 +1953,12 @@
          push edx
          add edx, [ebp+dstPitch]
 
-%ifdef __DJGPP__
+%ifdef FAR_POINTER
          movq [fs:edx], mm0
          movq [fs:edx+8], mm1
 %else
-         movq [es:edx], mm0
-         movq [es:edx+8], mm1
+         movq [edx], mm0
+         movq [edx+8], mm1
 %endif
          pop edx
 
@@ -1961,28 +1992,28 @@
 %ifdef __DJGPP__
 _Init_2xSaIMMX:
 %else
-NEWSYM Init_2xSaIMMX
+Init_2xSaIMMX:
 %endif
 ; Store some stuff
-	 push ebp
-	 mov ebp, esp
+         push ebp
+         mov ebp, esp
          push edx
 
 
 ;Damn thing doesn't work
-;	 mov eax,1
-;	 cpuid
-;	 test edx, 0x00800000     ;test bit 23
-;	 jz end2 ;bit not set => no MMX detected
+;        mov eax,1
+;        cpuid
+;        test edx, 0x00800000     ;test bit 23
+;        jz end2 ;bit not set => no MMX detected
 
-	 mov eax, [ebp+8]         ;PixelFormat
-	 cmp eax, 555
-	 jz Bits555
-	 cmp eax, 565
-	 jz Bits565
+         mov eax, [ebp+8]         ;PixelFormat
+         cmp eax, 555
+         jz Bits555
+         cmp eax, 565
+         jz Bits565
 end2:
-	 mov eax, 1
-	 jmp end
+         mov eax, 1
+         jmp end3
 Bits555:
          mov edx, 0x7BDE7BDE
          mov eax, colorMask
@@ -2001,7 +2032,7 @@
          mov [eax], edx
          mov [eax+4], edx
          mov eax, 0
-         jmp end
+         jmp end3
 Bits565:
          mov edx, 0xF7DEF7DE
          mov eax, colorMask
@@ -2020,12 +2051,12 @@
          mov [eax], edx
          mov [eax+4], edx
          mov eax, 0
-         jmp end
-end:	
+         jmp end3
+end3:   
          pop edx
-	 mov esp, ebp
-	 pop ebp
-	 ret
+         mov esp, ebp
+         pop ebp
+         ret
 
 
 ;-------------------------------------------------------------------------
@@ -2036,17 +2067,21 @@
 ;-------------------------------------------------------------------------
 ;-------------------------------------------------------------------------
 
-	SECTION .data ALIGN = 32
+        SECTION .data ALIGN = 32
 ;Some constants
-colorMask     dd 0xF7DEF7DE, 0xF7DEF7DE
-lowPixelMask  dd 0x08210821, 0x08210821
+colorMask     dd 0xF7DEF7DE,0xF7DEF7DE
+lowPixelMask  dd 0x08210821,0x08210821
 
-qcolorMask    dd 0xE79CE79C, 0xE79CE79C
-qlowpixelMask dd 0x18631863, 0x18631863
+qcolorMask    dd 0xE79CE79C,0xE79CE79C
+qlowpixelMask dd 0x18631863,0x18631863
 
-FALSE         dd 0x00000000, 0x00000000
-TRUE          dd 0xffffffff, 0xffffffff
-ONE           dd 0x00010001, 0x00010001
+darkenMask    dd 0xC718C718,0xC718C718
+GreenMask     dd 0x07E007E0,0x07E007E0
+RedBlueMask   dd 0xF81FF81F,0xF81FF81F
+
+FALSE         dd 0x00000000,0x00000000
+TRUE          dd 0xffffffff,0xffffffff
+ONE           dd 0x00010001,0x00010001
 
 
         SECTION .bss ALIGN = 32