Browse Source

+ changed wehere possible, procs to assembler procs

michael 27 years ago
parent
commit
ae929aed5a
1 changed files with 26 additions and 80 deletions
  1. 26 80
      rtl/i386/strings.pp

+ 26 - 80
rtl/i386/strings.pp

@@ -94,9 +94,8 @@ implementation
 
 {$ASMMODE ATT}
 
-    function strcopy(dest,source : pchar) : pchar;
+    function strcopy(dest,source : pchar) : pchar; assembler;
 
-      begin
          asm
             cld
             movl 12(%ebp),%edi
@@ -116,14 +115,10 @@ implementation
             rep
             movsb
             movl 8(%ebp),%eax
-            leave
-            ret $8
          end;
-      end;
 
-    function strecopy(dest,source : pchar) : pchar;
+    function strecopy(dest,source : pchar) : pchar;assembler;
 
-      begin
          asm
             cld
             movl 12(%ebp),%edi
@@ -145,14 +140,10 @@ implementation
             movl 8(%ebp),%eax
             decl %edi
             movl %edi,%eax
-            leave
-            ret $8
-         end ['EAX','ESI','EDI'];
       end;
 
-    function strlcopy(dest,source : pchar;maxlen : longint) : pchar;
+    function strlcopy(dest,source : pchar;maxlen : longint) : pchar;assembler;
 
-      begin
          asm
             movl 8(%ebp),%edi
             movl 12(%ebp),%esi
@@ -168,18 +159,13 @@ implementation
             movl 8(%ebp),%eax
             leave
             ret $12
-        .LSTRLCOPY2:
-
+         .LSTRLCOPY2:
             xorb %al,%al        // If cutted
             stosb               // add a #0
             movl 8(%ebp),%eax
-            leave
-            ret $12
-         end ['EAX','ECX','ESI','EDI'];
-      end;
+          end;
 
-    function strlen(p : pchar) : longint;
-    begin
+    function strlen(p : pchar) : longint;assembler;
       asm
         cld
         movl    8(%ebp),%edi
@@ -189,14 +175,10 @@ implementation
         scasb
         movl    $0xfffffffe,%eax
         subl    %ecx,%eax
-        leave
-        ret     $4
-      end ['EDI','ECX','EAX'];
     end;
 
-    function strend(p : pchar) : pchar;
+    function strend(p : pchar) : pchar;assembler;
 
-      begin
          asm
             cld
             movl 8(%ebp),%edi
@@ -206,15 +188,11 @@ implementation
             scasb
             movl %edi,%eax
             decl %eax
-            leave
-            ret $4
-         end ['EDI','ECX','EAX'];
-      end;
+         end;
 
-    function strpcopy(d : pchar;const s : string) : pchar;
+    function strpcopy(d : pchar;const s : string) : pchar; assembler;
 
-      begin
-         asm
+      asm
             pushl %esi          // Save ESI
             cld
             movl 8(%ebp),%edi   // load destination address
@@ -228,9 +206,6 @@ implementation
             stosb
             movl %ebx,%eax      // return value to EAX
             popl %esi
-            leave               // ... and ready
-            ret $8
-         end ['EDI','ESI','EBX','EAX','ECX'];
       end;
 
 {$ASMMODE DIRECT}
@@ -288,9 +263,8 @@ implementation
          strlcat:=strlcopy(destend,source,l);
       end;
 
-    function strcomp(str1,str2 : pchar) : longint;
+    function strcomp(str1,str2 : pchar) : longint; assembler;
 
-      begin
          asm
             // Find terminating zero
             movl 12(%ebp),%edi
@@ -307,14 +281,10 @@ implementation
             movb -1(%esi),%al
             movzbl -1(%edi),%ecx
             subl %ecx,%eax
-            leave
-            ret $8
-         end ['EAX','ECX','ESI','EDI'];
-      end;
+          end;
 
-    function strlcomp(str1,str2 : pchar;l : longint) : longint;
+    function strlcomp(str1,str2 : pchar;l : longint) : longint;assembler;
 
-      begin
          asm
             // Find terminating zero
             movl 12(%ebp),%edi
@@ -327,7 +297,7 @@ implementation
             cmpl 16(%ebp),%ecx
             jl .LSTRLCOMP1
             movl 16(%ebp),%ecx
-        .LSTRLCOMP1:
+         .LSTRLCOMP1:
             movl 12(%ebp),%edi
             movl 8(%ebp),%esi
             repe
@@ -335,14 +305,10 @@ implementation
             movb -1(%esi),%al
             movzbl -1(%edi),%ecx
             subl %ecx,%eax
-            leave
-            ret $12
-         end ['EAX','ECX','ESI','EDI'];
-      end;
+         end;
 
-    function stricomp(str1,str2 : pchar) : longint;
+    function stricomp(str1,str2 : pchar) : longint;assembler;
 
-      begin
          asm
             // Find terminating zero
             movl 12(%ebp),%edi
@@ -375,14 +341,10 @@ implementation
             subl %ebx,%eax
             jz .LSTRICOMP2      // If still equal, compare again
        .LSTRICOMP3:
-            leave
-            ret $8
-         end ['EAX','ECX','ESI','EDI'];
       end;
 
-    function strlicomp(str1,str2 : pchar;l : longint) : longint;
+    function strlicomp(str1,str2 : pchar;l : longint) : longint;assembler;
 
-      begin
          asm
             // Search terminating zero
             movl 12(%ebp),%edi
@@ -420,10 +382,7 @@ implementation
             jz .LSTRLICOMP2
 
        .LSTRLICOMP3:
-            leave
-            ret $12
-         end ['EAX','ECX','ESI','EDI'];
-      end;
+           end;
 
     function strmove(dest,source : pchar;l : longint) : pchar;
 
@@ -432,9 +391,8 @@ implementation
          strmove:=dest;
       end;
 
-    function strscan(p : pchar;c : char) : pchar;
+    function strscan(p : pchar;c : char) : pchar; assembler;
 
-      begin
          asm
             movl 8(%ebp),%edi
             movl $0xffffffff,%ecx
@@ -452,14 +410,10 @@ implementation
             movl %edi,%eax
             decl %eax
         .LSTRSCAN:
-            leave
-            ret $6
          end;
-      end;
 
-    function strrscan(p : pchar;c : char) : pchar;
+    function strrscan(p : pchar;c : char) : pchar;assembler;
 
-      begin
          asm
             movl 8(%ebp),%edi
             movl $0xffffffff,%ecx
@@ -481,14 +435,10 @@ implementation
             movl %edi,%eax
             incl %eax
         .LSTRRSCAN:
-            leave
-            ret $6
-         end;
       end;
 
-    function strupper(p : pchar) : pchar;
+    function strupper(p : pchar) : pchar;assembler;
 
-      begin
          asm
             movl 8(%ebp),%esi
             movl %esi,%edi
@@ -504,14 +454,10 @@ implementation
             orb %al,%al
             jnz .LSTRUPPER1
             movl 8(%ebp),%eax
-            leave
-            ret $4
          end;
-      end;
 
-    function strlower(p : pchar) : pchar;
+    function strlower(p : pchar) : pchar; assembler;
 
-      begin
          asm
             movl 8(%ebp),%esi
             movl %esi,%edi
@@ -527,10 +473,7 @@ implementation
             orb %al,%al
             jnz .LSTRLOWER1
             movl 8(%ebp),%eax
-            leave
-            ret $4
          end;
-      end;
 
     function strpos(str1,str2 : pchar) : pchar;
 
@@ -589,7 +532,10 @@ end.
 
 {
   $Log$
-  Revision 1.4  1998-05-31 14:15:52  peter
+  Revision 1.5  1998-07-29 23:46:37  michael
+  + changed wehere possible, procs to assembler procs
+
+  Revision 1.4  1998/05/31 14:15:52  peter
     * force to use ATT or direct parsing
 
   Revision 1.3  1998/05/30 14:30:22  peter