Einzelnen Beitrag anzeigen

Benutzerbild von 3_of_8
3_of_8

Registriert seit: 22. Mär 2005
Ort: Dingolfing
4.129 Beiträge
 
Turbo Delphi für Win32
 
#9

Re: Substring an bestimmter Position im String?

  Alt 3. Aug 2006, 21:42
Funktioniert, aber wie kriege ich das Case Insensitive? Ich weiß nicht, wir man in Assembler Funktionen aufruft. (Also Parameter übergibt)

Meine Idee wäre jetzt sowas gewesen:
Ich rufe AnsiLowerCase auf, denn substr steht in eax.
Dann pushe ich eax auf den Stack und lade edx (wo s steht) nach eax, rufe wieder AnsiLowerCase auf und lade eax nach edx.
Dann poppe ich eax wieder runter.
Gibt nur ne AV. Warum? Was mache ich falsch?
Delphi-Quellcode:
function StrAtPos(substr, s: string; p: integer): boolean;
asm
         call AnsiLowerCase
         push eax
         mov eax, edx
         call AnsiLowerCase
         mov edx, eax
         pop eax
         push edi
         push esi
         test eax,eax
         je @Fail
         test edx,edx
         je @Fail
         test ecx,ecx
         jne @1
         mov ecx,1
@1: mov esi,eax
         lea edi,[edx+ecx-1]
         mov eax,ecx
         mov ecx,[esi-4]
         test ecx,ecx
         je @Fail
         lea eax,[eax+ecx-1]
         cmp eax,[edx-4]
         jbe @Cmp
@Fail: xor eax,eax
         jmp @End
@Cmp: mov edx,ecx
         shr ecx,2
         repe cmpsd
         jne @SetRes
@Bytes: mov ecx,edx
         and ecx,3
         repe cmpsb
@SetRes: sete al
@End: pop esi
         pop edi
end;
Manuel Eberl
„The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.“
- Terry Pratchett
  Mit Zitat antworten Zitat