Hello Bart!
25 Oct 97, 05:04, Bart Broersma wrote to All:
> Function UpString(S:String):String; Assembler;
Doesn't your Delphi already have an Uppercase function? Mine has.
> Asm
> les di,@Result {put address of returned string in es:di}
> .... ^^^^^^^^ wil give me a compile error: operandsize does not
> match (or soemthing like that...)
> ....
> ....
> end;
The point is that you are using DI as the function result ( don't forget
anyway
that LES should be avoided in PM even if it's a Dos APP - e.g.
MOV EDI,@Result). That worked with 16 both TP/D1 programs that supported
strings having the 1st byte as string length.
D2 and D3, since they like null-terminated dynamically allocated long
strings more instead, expect the function result to be returned as a pointer
from EAX (e.g. MOV @Result, EAX). Think of something like referencing arrays
in C.
On the other hand, Delphi32 produces very efficient and optimized code even
using plain Pascal statements (it's even faster than C, when using smart and
rationally planned algorithms). I think that using the "brute force" as we
were
doing in TP could help somewhat, but it isn't strictly necessary any longer.
As a rough example i don't see a great speed difference between these two
routines (they do the same thing) of a program of mine, while i saw when they
where 16 bit TP.
Procedure PutLabel(p: LongInt);
Var i : LongInt;
Begin
If IsPass1 Then Begin
For i:=0 To Labelp Do If p=Labels[i] Then Exit;
Inc(labelp);
Labels[labelp] := p;
End;
End;
Procedure PutLabel(p: LongInt); StdCall; Assembler;
Asm mov ecx,dword ptr [p]
cmp dword ptr [IsPass1],1
jne @NotEq
xor edx,edx
mov eax,offset Labels
jmp @Comp
@Start: cmp ecx,dword ptr [eax]
je @NotEq
@IncVa: inc edx
add eax,4
@Comp: cmp edx,dword ptr [Labelp]
jb @Start
mov eax,dword ptr [Labelp]
mov dword ptr [Labels+4*eax], ecx
inc dword ptr [Labelp]
@NotEq:
End;
C U!
Alessandro Antonini - p0010838@www.leonet.it
--- GEcho/32 1.20/Pro
2:332/617.43)
---------------
* Origin: Home Page: www.geocities.com/CapeCanaveral/Lab/1131/
|