Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .intel_syntax noprefix
- .text
- .global amemmove
- amemmove:
- push ebp
- mov ebp,esp
- mov edi, DWORD PTR [ebp+8] # edi = *dest
- mov esi, DWORD PTR [ebp+12] # esi = *src
- mov ecx, WORD [ebp+16] # ecx = nbytes
- mov eax, esi
- sub eax, ecx # eax = src - nbytes
- cmp edi, eax
- jl rightcpy
- mov edx, esi
- add edx, ecx # edx = src + btytes
- cmp eax, edx
- jg rightcpy
- jmp leftcpy
- leftcpy:
- std
- rightcpy:
- rep movsb
- cld
- mov esp, ebp
- pop ebp
- ret
- .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement