1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71:
| function CharPosEY_JOH_IA32_2_d(const SearchCharacter : Char; const SourceString : AnsiString; Occurrence : Integer = 1; StartPos : Integer = 1): Integer; asm push ebx push edi push edx test edx, edx jz @@NotFound sub ecx, 1 jl @@NotFound cmp StartPos, 1 jl @@NotFound mov ebx, [edx-4] lea ebx, [edx+ebx-1] mov edx, StartPos add edx, [esp] sub edx, 1 jmp @@CheckFinish @@Loop: cmp al, [edx] jne @@Done1 sub ecx, 1 jc @@SetResult1 @@Done1: cmp al, [edx+1] jne @@Done2 sub ecx, 1 jnc @@Done2 cmp edx, ebx jge @@NotFound jmp @@SetResult2 @@Done2: cmp al, [edx+2] jne @@Done3 sub ecx, 1 jnc @@Done3 cmp edx, ebx jg @@NotFound jmp @@SetResult3 @@Done3: cmp al, [edx+3] jne @@Done4 sub ecx, 1 jnc @@Done4 add edx, 3 cmp edx, ebx jle @@SetResult1 @@Done4: add edx, 4 @@CheckFinish: lea edi, [edx+ecx] cmp edi, ebx jle @@Loop @@NotFound: xor eax, eax pop edx jmp @@Exit; @@SetResult3: add edx, 1 @@SetResult2: add edx, 1 @@SetResult1: pop ecx neg ecx lea eax, [edx+ecx+1] @@Exit: pop edi pop ebx end; |