+ changed wehere possible, procs to assembler procs

This commit is contained in:
michael 1998-07-29 23:46:37 +00:00
parent 6827a17d38
commit ae929aed5a

View File

@ -94,9 +94,8 @@ implementation
{$ASMMODE ATT} {$ASMMODE ATT}
function strcopy(dest,source : pchar) : pchar; function strcopy(dest,source : pchar) : pchar; assembler;
begin
asm asm
cld cld
movl 12(%ebp),%edi movl 12(%ebp),%edi
@ -116,14 +115,10 @@ implementation
rep rep
movsb movsb
movl 8(%ebp),%eax movl 8(%ebp),%eax
leave
ret $8
end;
end; end;
function strecopy(dest,source : pchar) : pchar; function strecopy(dest,source : pchar) : pchar;assembler;
begin
asm asm
cld cld
movl 12(%ebp),%edi movl 12(%ebp),%edi
@ -145,14 +140,10 @@ implementation
movl 8(%ebp),%eax movl 8(%ebp),%eax
decl %edi decl %edi
movl %edi,%eax movl %edi,%eax
leave
ret $8
end ['EAX','ESI','EDI'];
end; end;
function strlcopy(dest,source : pchar;maxlen : longint) : pchar; function strlcopy(dest,source : pchar;maxlen : longint) : pchar;assembler;
begin
asm asm
movl 8(%ebp),%edi movl 8(%ebp),%edi
movl 12(%ebp),%esi movl 12(%ebp),%esi
@ -169,17 +160,12 @@ implementation
leave leave
ret $12 ret $12
.LSTRLCOPY2: .LSTRLCOPY2:
xorb %al,%al // If cutted xorb %al,%al // If cutted
stosb // add a #0 stosb // add a #0
movl 8(%ebp),%eax movl 8(%ebp),%eax
leave
ret $12
end ['EAX','ECX','ESI','EDI'];
end; end;
function strlen(p : pchar) : longint; function strlen(p : pchar) : longint;assembler;
begin
asm asm
cld cld
movl 8(%ebp),%edi movl 8(%ebp),%edi
@ -189,14 +175,10 @@ implementation
scasb scasb
movl $0xfffffffe,%eax movl $0xfffffffe,%eax
subl %ecx,%eax subl %ecx,%eax
leave
ret $4
end ['EDI','ECX','EAX'];
end; end;
function strend(p : pchar) : pchar; function strend(p : pchar) : pchar;assembler;
begin
asm asm
cld cld
movl 8(%ebp),%edi movl 8(%ebp),%edi
@ -206,14 +188,10 @@ implementation
scasb scasb
movl %edi,%eax movl %edi,%eax
decl %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 pushl %esi // Save ESI
cld cld
@ -228,9 +206,6 @@ implementation
stosb stosb
movl %ebx,%eax // return value to EAX movl %ebx,%eax // return value to EAX
popl %esi popl %esi
leave // ... and ready
ret $8
end ['EDI','ESI','EBX','EAX','ECX'];
end; end;
{$ASMMODE DIRECT} {$ASMMODE DIRECT}
@ -288,9 +263,8 @@ implementation
strlcat:=strlcopy(destend,source,l); strlcat:=strlcopy(destend,source,l);
end; end;
function strcomp(str1,str2 : pchar) : longint; function strcomp(str1,str2 : pchar) : longint; assembler;
begin
asm asm
// Find terminating zero // Find terminating zero
movl 12(%ebp),%edi movl 12(%ebp),%edi
@ -307,14 +281,10 @@ implementation
movb -1(%esi),%al movb -1(%esi),%al
movzbl -1(%edi),%ecx movzbl -1(%edi),%ecx
subl %ecx,%eax 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 asm
// Find terminating zero // Find terminating zero
movl 12(%ebp),%edi movl 12(%ebp),%edi
@ -335,14 +305,10 @@ implementation
movb -1(%esi),%al movb -1(%esi),%al
movzbl -1(%edi),%ecx movzbl -1(%edi),%ecx
subl %ecx,%eax 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 asm
// Find terminating zero // Find terminating zero
movl 12(%ebp),%edi movl 12(%ebp),%edi
@ -375,14 +341,10 @@ implementation
subl %ebx,%eax subl %ebx,%eax
jz .LSTRICOMP2 // If still equal, compare again jz .LSTRICOMP2 // If still equal, compare again
.LSTRICOMP3: .LSTRICOMP3:
leave
ret $8
end ['EAX','ECX','ESI','EDI'];
end; end;
function strlicomp(str1,str2 : pchar;l : longint) : longint; function strlicomp(str1,str2 : pchar;l : longint) : longint;assembler;
begin
asm asm
// Search terminating zero // Search terminating zero
movl 12(%ebp),%edi movl 12(%ebp),%edi
@ -420,9 +382,6 @@ implementation
jz .LSTRLICOMP2 jz .LSTRLICOMP2
.LSTRLICOMP3: .LSTRLICOMP3:
leave
ret $12
end ['EAX','ECX','ESI','EDI'];
end; end;
function strmove(dest,source : pchar;l : longint) : pchar; function strmove(dest,source : pchar;l : longint) : pchar;
@ -432,9 +391,8 @@ implementation
strmove:=dest; strmove:=dest;
end; end;
function strscan(p : pchar;c : char) : pchar; function strscan(p : pchar;c : char) : pchar; assembler;
begin
asm asm
movl 8(%ebp),%edi movl 8(%ebp),%edi
movl $0xffffffff,%ecx movl $0xffffffff,%ecx
@ -452,14 +410,10 @@ implementation
movl %edi,%eax movl %edi,%eax
decl %eax decl %eax
.LSTRSCAN: .LSTRSCAN:
leave
ret $6
end;
end; end;
function strrscan(p : pchar;c : char) : pchar; function strrscan(p : pchar;c : char) : pchar;assembler;
begin
asm asm
movl 8(%ebp),%edi movl 8(%ebp),%edi
movl $0xffffffff,%ecx movl $0xffffffff,%ecx
@ -481,14 +435,10 @@ implementation
movl %edi,%eax movl %edi,%eax
incl %eax incl %eax
.LSTRRSCAN: .LSTRRSCAN:
leave
ret $6
end;
end; end;
function strupper(p : pchar) : pchar; function strupper(p : pchar) : pchar;assembler;
begin
asm asm
movl 8(%ebp),%esi movl 8(%ebp),%esi
movl %esi,%edi movl %esi,%edi
@ -504,14 +454,10 @@ implementation
orb %al,%al orb %al,%al
jnz .LSTRUPPER1 jnz .LSTRUPPER1
movl 8(%ebp),%eax movl 8(%ebp),%eax
leave
ret $4
end;
end; end;
function strlower(p : pchar) : pchar; function strlower(p : pchar) : pchar; assembler;
begin
asm asm
movl 8(%ebp),%esi movl 8(%ebp),%esi
movl %esi,%edi movl %esi,%edi
@ -527,9 +473,6 @@ implementation
orb %al,%al orb %al,%al
jnz .LSTRLOWER1 jnz .LSTRLOWER1
movl 8(%ebp),%eax movl 8(%ebp),%eax
leave
ret $4
end;
end; end;
function strpos(str1,str2 : pchar) : pchar; function strpos(str1,str2 : pchar) : pchar;
@ -589,7 +532,10 @@ end.
{ {
$Log$ $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 * force to use ATT or direct parsing
Revision 1.3 1998/05/30 14:30:22 peter Revision 1.3 1998/05/30 14:30:22 peter