cradleasm8.asm 486 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. [BITS 64]
  2. ; begining of the assembly program
  3. ; sys calls
  4. %define SYS_EXIT 60
  5. %define SYS_WRITE 1
  6. %define STD_IN 0
  7. %define STD_OUT 1
  8. %define STD_ERR 2
  9. section .bss
  10. ; nada
  11. section .data
  12. section .text
  13. global main
  14. main:
  15. mov rbp, rsp; for correct debugging
  16. xor rax, rax
  17. push rax
  18. mov rax,8
  19. push rax
  20. mov rax,7
  21. push rax
  22. mov rax,9
  23. pop rbx
  24. sub rax, rbx
  25. neg rax
  26. pop rbx
  27. imul rax, rbx
  28. pop rbx
  29. sub rax, rbx
  30. neg rax
  31. ; end of program
  32. mov rdi,rax
  33. mov rax,SYS_EXIT
  34. syscall