fork download
  1. global _start
  2.  
  3. section .data
  4. xmsg: db "x is "
  5. ymsg: db "y is "
  6. nl: db 0ah,0dh
  7. end:
  8.  
  9. section .bss
  10. struct: resb 8
  11. dmsg: resb 1
  12.  
  13. section .text
  14.  
  15. _start:
  16. ; your code goes here
  17.  
  18. ; fill the struct
  19. mov eax,struct
  20. mov byte [eax],4
  21. mov byte [eax+4],9
  22. ; erase ~evidence~ register
  23. xor eax,eax
  24. ; read the struct
  25. mov esi,struct
  26. mov eax,xmsg
  27. mov ebx,ymsg
  28. call print
  29. mov eax,[esi]
  30. add eax,48
  31. mov [dmsg],eax
  32. mov eax,dmsg
  33. mov ebx,eax
  34. inc ebx
  35. call print
  36. mov eax,nl
  37. mov ebx,end
  38. call print
  39. mov eax,ymsg
  40. mov ebx,nl
  41. call print
  42. mov eax,[esi+4]
  43. add eax,48
  44. mov [dmsg],eax
  45. mov eax,dmsg
  46. mov ebx,eax
  47. inc ebx
  48. call print
  49. mov eax,nl
  50. mov ebx,end
  51. call print
  52. ; clear ... yk
  53. xor eax,eax
  54. xor ebx,ebx
  55. xor ecx,ecx
  56. xor edx,edx
  57. xor esi,esi
  58.  
  59.  
  60. je exit
  61.  
  62. exit:
  63. mov eax, 01h ; exit()
  64. xor ebx, ebx ; errno
  65. int 80h
  66.  
  67. print:
  68. mov ecx,eax
  69. sub ebx,eax
  70. mov edx,ebx
  71. mov eax,4
  72. mov ebx,1
  73. int 80h
  74. ret
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
x is 4

y is 9