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, esi
- sub eax, ecx # eax = src - nbytes
- cmp edi, eax
- jl rightcpy
- mov edx, [esi] + ecx # edx = src + btytes
- cmp eax, edx
- jg rightcpy
- jmp leftcpy
- leftcpy:
- std
- rightcpy:
- rep movsb
- cld
- mov esp, ebp
- pop ebp
- ret
- .end
- Gcc Errors:
- ex1.s: Assembler messages:
- ex1.s:8: Error: ambiguous operand size or operands invalid for `push'
- ex1.s:10: Error: `edi' not allowed with `movb'
- ex1.s:11: Error: `esi' not allowed with `movb'
- ex1.s:17: Error: invalid use of register
- ex1.s:29: Error: ambiguous operand size or operands invalid for `pop'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement