fork download
  1. %macro READ 02
  2. mov rax,00H
  3. mov rdi,00H
  4. mov rsi,%1
  5. mov rdx,%2
  6. syscall
  7. %endmacro
  8.  
  9. %macro WRITE 02
  10. mov rax,01H
  11. mov rdi,01H
  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 "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. WRITE a,01
  41. WRITE b,01
  42.  
  43. sub byte[a],30H
  44. sub byte[b],30H
  45.  
  46. mov bl,byte[a]
  47. add bl,byte[b]
  48. mov byte[c],bl
  49. add byte[c],30H
  50.  
  51. WRITE msg2,len2
  52. WRITE c,01
  53. EXIT
Success #stdin #stdout 0s 5320KB
stdin
23
stdout
Enter two number
23Addition is....
5