Browse Source

* some optimizations in GetPixel16

git-svn-id: trunk@40984 -
nickysn 6 years ago
parent
commit
d653193c36
1 changed files with 20 additions and 26 deletions
  1. 20 26
      packages/graph/src/msdos/graph.pp

+ 20 - 26
packages/graph/src/msdos/graph.pp

@@ -1701,44 +1701,38 @@ end;
     out   dx,ax
     out   dx,ax
     inc   dx
     inc   dx
 
 
-    xchg  ax, di
-    and   ax,0007h
-    mov   cl,07
-    sub   cl,al
-    mov   bl,cl
+    mov   cx, di
+    not   cx
+    and   cl,7
 
 
     { read plane 3 }
     { read plane 3 }
-    mov   al,es:[si]       { read display memory }
-    shr   al,cl
-    and   al,01h
-    mov   ah,al            { save bit in AH       }
+    mov   ah,es:[si]       { read display memory }
+    shr   ah,cl
+    and   ah,01h           { save bit in AH       }
 
 
     { read plane 2 }
     { read plane 2 }
     mov   al,2             { Select plane to read }
     mov   al,2             { Select plane to read }
     out   dx,al
     out   dx,al
-    mov   al,es:[si]
-    shr   al,cl
-    and   al,01h
-    shl   ah,1
-    or    ah,al            { save bit in AH      }
+    mov   bl,es:[si]
+    shr   bl,cl
+    shr   bl,1
+    rcl   ah,1             { save bit in AH      }
 
 
     { read plane 1 }
     { read plane 1 }
-    mov   al,1             { Select plane to read }
+    dec   ax               { Select plane to read }
     out   dx,al
     out   dx,al
-    mov   al,es:[si]
-    shr   al,cl
-    and   al,01h
-    shl   ah,1
-    or    ah,al            { save bit in AH       }
+    mov   bl,es:[si]
+    shr   bl,cl
+    shr   bl,1
+    rcl   ah,1             { save bit in AH       }
 
 
     { read plane 0 }
     { read plane 0 }
-    mov   al,0             { Select plane to read }
+    dec   ax               { Select plane to read }
     out   dx,al
     out   dx,al
-    mov   al,es:[si]
-    shr   al,cl
-    and   al,01h
-    shl   ah,1
-    or    ah,al            { save bit in AH       }
+    mov   bl,es:[si]
+    shr   bl,cl
+    shr   bl,1
+    rcl   ah,1             { save bit in AH       }
 
 
     mov   al,ah            { 16-bit pixel in AX   }
     mov   al,ah            { 16-bit pixel in AX   }
     { 1 byte shorter than 'xor ah, ah'; will always set ah to 0, because sign(al)=0 }
     { 1 byte shorter than 'xor ah, ah'; will always set ah to 0, because sign(al)=0 }