Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TailPos(const S, SubStr: AnsiString; fromPos: integer): integer;
- // TailPos('Искать тут', 'искомое', с какой позиции - интеджер);
- asm
- PUSH EDI
- PUSH ESI
- PUSH EBX
- PUSH EAX
- OR EAX,EAX
- JE @@2
- OR EDX,EDX
- JE @@2
- DEC ECX
- JS @@2
- MOV EBX,[EAX-4]
- SUB EBX,ECX
- JLE @@2
- SUB EBX,[EDX-4]
- JL @@2
- INC EBX
- ADD EAX,ECX
- MOV ECX,EBX
- MOV EBX,[EDX-4]
- DEC EBX
- MOV EDI,EAX
- @@1: MOV ESI,EDX
- LODSB
- REPNE SCASB
- JNE @@2
- MOV EAX,ECX
- PUSH EDI
- MOV ECX,EBX
- REPE CMPSB
- POP EDI
- MOV ECX,EAX
- JNE @@1
- LEA EAX,[EDI-1]
- POP EDX
- SUB EAX,EDX
- INC EAX
- JMP @@3
- @@2: POP EAX
- XOR EAX,EAX
- @@3: POP EBX
- POP ESI
- POP EDI
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement