Advertisement
almdudler

Replace all

Jan 20th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; rdi - buffer, rsi - string, rdx - symbol to replace, rcx - replacement
  2. replace_all:
  3. xor r9, r9
  4. _loop:
  5. mov al, byte[rsi + r9]
  6. cmp al, dl
  7. jne no_rep
  8. mov [rdi+r9], cl
  9. jmp continue
  10. no_rep:
  11. mov [rdi+r9], al
  12. continue:
  13. inc r9
  14. cmp al, 0
  15. je replace_all_exit
  16. jmp _loop
  17.  
  18. replace_all_exit:
  19. mov rax, rdi
  20. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement