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, BYTE PTR [ebp+8] // edi = *dest
- mov esi, BYTE PTR [ebp+12] // esi = *src
- mov ecx, WORD [ebp+16] // ecx = nbytes
- mov eax, [edi] // eax = dest
- mov edx, [esi] - ecx // edx = src - nbtytes
- cmp eax, edx
- jl rightcpy
- mov edx, [esi] + ecx // edx = src + btytes
- cmp eax, edx
- jg rightcpy
- jmp leftcpy
- rightcpy:
- rep movsb
- jmp fim
- leftcpy:
- pushf
- std
- rep movsb
- popf
- fim:
- mov esp, ebp
- pop ebp
- ret
- .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement