BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Some assemby rewuired: WideStrEnd()

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM
View previous topic :: View next topic  
Author Message
Adem
Guest





PostPosted: Thu Apr 26, 2007 2:25 am    Post subject: Some assemby rewuired: WideStrEnd() Reply with quote



This is from D7.

Could someone please re-write this so that it uses PWideChar instead of
PChar.

function StrEnd(const Str: PChar): PChar; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,0FFFFFFFFH
XOR AL,AL
REPNE SCASB
LEA EAX,[EDI-1]
MOV EDI,EDX
end;

TVMIA,
Back to top
Per Larsen
Guest





PostPosted: Thu Apr 26, 2007 3:22 am    Post subject: Re: Some assemby rewuired: WideStrEnd() Reply with quote



"Adem" <adembaba (AT) excite (DOT) com> wrote in message
news:xn0f5eeqpf2dvr000 (AT) forums (DOT) borland.com...
Quote:

This is from D7.

Could someone please re-write this so that it uses PWideChar instead of
PChar.

function StrEnd(const Str: PChar): PChar; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,0FFFFFFFFH
XOR AL,AL
REPNE SCASB
LEA EAX,[EDI-1]
MOV EDI,EDX
end;

TVMIA,

That should be something like

function StrEndW(const Str: PWideChar): PWideChar; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,0FFFFFFFFH
XOR EAX,EAX
REPNE SCASW
LEA EAX,[EDI-2]
MOV EDI,EDX
end;

IHTH

- Per
Back to top
Adem
Guest





PostPosted: Thu Apr 26, 2007 7:54 am    Post subject: Re: Some assemby rewuired: WideStrEnd() Reply with quote



Per Larsen wrote:

Thank you. It seems to work. Magic Smile
Back to top
PaJi
Guest





PostPosted: Thu Apr 26, 2007 3:01 pm    Post subject: Re: Some assemby rewuired: WideStrEnd() Reply with quote

Hi all,

I think, you have to decrease the counter of the loop too.
You test word, not byte. Load max. $7FFFFFFF into register ECX.
I know that the chance is very low to reach maximum count,
but theoreticaly should be only $7FFFFFF.

MOV ECX,$7FFFFFFF
or
MOV ECX,7FFFFFFFh

The similar rule valids for StrLenW and for other similar wide functions.


function StrEndW(const Str: PWideChar): PWideChar; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,$7FFFFFFF
XOR EAX,EAX
REPNE SCASW
LEA EAX,[EDI-2]
MOV EDI,EDX
end;


Good luck.
PaJi.
------------------------------------

"Per Larsen" <perATportablemindsDOTcom> píše v diskusním příspěvku
news:462fd4b6 (AT) newsgroups (DOT) borland.com...
Quote:

"Adem" <adembaba (AT) excite (DOT) com> wrote in message
news:xn0f5eeqpf2dvr000 (AT) forums (DOT) borland.com...

This is from D7.

Could someone please re-write this so that it uses PWideChar instead of
PChar.

function StrEnd(const Str: PChar): PChar; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,0FFFFFFFFH
XOR AL,AL
REPNE SCASB
LEA EAX,[EDI-1]
MOV EDI,EDX
end;

TVMIA,

That should be something like

function StrEndW(const Str: PWideChar): PWideChar; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,0FFFFFFFFH
XOR EAX,EAX
REPNE SCASW
LEA EAX,[EDI-2]
MOV EDI,EDX
end;

IHTH

- Per

Back to top
Per Larsen
Guest





PostPosted: Thu Apr 26, 2007 5:05 pm    Post subject: Re: Some assemby rewuired: WideStrEnd() Reply with quote

"PaJi" <PaJi (AT) wo (DOT) cz> wrote in message news:4630786a (AT) newsgroups (DOT) borland.com...

Quote:
I think, you have to decrease the counter of the loop too.
You test word, not byte. Load max. $7FFFFFFF into register ECX.

Now you're being very very picky, PaJi :)

- Per
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.