fork download
  1. global _start
  2.  
  3. section .bss
  4. address: RESB 4
  5.  
  6. section .data
  7. var db 1
  8.  
  9.  
  10. section .text
  11.  
  12. ; Input
  13. ; eax = number to display
  14.  
  15. section .data
  16. const10: dd 10
  17. section .text
  18.  
  19. printCharacter:
  20. ; pushad
  21. mov ecx, eax
  22. mov edx, 1 ; Length of sum message
  23. mov ebx, 1 ; File descriptor (stdout)
  24. mov eax, 4 ; System call number (write)
  25. int 0x80
  26. ; popad
  27. ret
  28.  
  29. printNumber:
  30. push eax
  31. push edx
  32. xor edx,edx ;edx:eax = number
  33. div dword [const10] ;eax = quotient, edx = remainder
  34. test eax,eax ;Is quotient zero?
  35. je .l1 ; yes, don't display it
  36. call printNumber ;Display the quotient
  37. .l1:
  38. lea eax,[edx+'0']
  39. call printCharacter ;Display the remainder
  40. pop edx
  41. pop eax
  42. ret
  43.  
  44. _start:
  45. ; your code goes here
  46. mov eax, var
  47. mov [address], eax
  48. mov edx, 0
  49. call printNumber
  50. mov eax,65
  51. call printCharacter
  52. mov eax,65
  53. call printCharacter
  54. mov eax,65
  55. call printCharacter
  56. mov eax,13
  57. call printCharacter
  58. mov eax,10
  59. call printCharacter
  60. je exit
  61.  
  62. exit:
  63. mov eax, 01h ; exit()
  64. xor ebx, ebx ; errno
  65. int 80h
  66.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty