fork download
  1. %macro WRITE 02
  2. mov rax,1
  3. mov rdi,1
  4. mov rsi,%1
  5. mov rdx,%2
  6. syscall
  7. %endmacro
  8.  
  9. %macro READ 02
  10. mov rax,0
  11. mov rdi,0
  12. mov rsi,%1
  13. mov rdx,%2
  14. syscall
  15. %endmacro
  16.  
  17. %macro EXIT 00
  18. mov rax, 60
  19. mov rdi, 0
  20. syscall
  21. %endmacro
  22.  
  23. section .data
  24. msg1 db "Enter two number",10
  25. len1 equ $-msg1
  26. msg2 db "The addition is",10
  27. len2 equ $-msg2
  28.  
  29. section .bss
  30. a resb 1
  31. b resb 1
  32. c resb 1
  33.  
  34. section .text
  35. global _start
  36. _start:
  37. WRITE msg1,len1
  38. READ a,01
  39. READ b,01
  40. sub byte[a],30H
  41. sub byte[b],30H
  42.  
  43. mov bl,byte[a]
  44. add bl,byte[b]
  45. mov byte[c],bl
  46. add byte[c],30H
  47.  
  48. WRITE msg2,len2
  49. WRITE c,01
  50. EXIT
Success #stdin #stdout 0s 5280KB
stdin
72
stdout
Enter two number
The addition is
9