Advertisement
Coriic

Untitled

May 29th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .data
  2.     buf:
  3.     .byte   0
  4.  
  5. .text
  6. .type fun,@function
  7. .global fun
  8.  
  9. #rdi - pierwszy argument
  10. #rsi - drugi argument
  11. #rdx - trzeci argument
  12.  
  13. fun:
  14.     MOV %rdi, buf
  15.  
  16. nextChar:
  17.     JMP takeFromFirst
  18.     JMP takeFromSecond
  19.     JMP nextChar
  20.  
  21. takeFromFirst:
  22.     MOV(%rsi), %al
  23.     CMPB $0, %al
  24.     JE isEndOfSecond
  25.     MOV %al, (%rdi)
  26.     INC %rdi
  27.     INC %rsi
  28.  
  29. takeFromSecond:
  30.     MOV(%rdx), %al
  31.     CMPB $0, %al
  32.     JE isEndOfFirst
  33.     MOV %al, (%rdi)
  34.     INC %rdi
  35.     INC %rdx
  36.  
  37. isEndOfFirst:
  38.     MOV (%rsi),%al
  39.     CMPB $0, %al
  40.     JE exit
  41.     JMP takeFromFirst
  42.  
  43. isEndOfSecond:
  44.     MOV (%rdx),%al
  45.     CMPB $0, %al
  46.     JE exit
  47.     JMP takeFromSecond
  48.  
  49. exit:
  50.     MOV buf, %rax
  51.     RET
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement