fork download
  1. global _start
  2.  
  3. section .data
  4. buffer dw 0h
  5.  
  6. section .text
  7.  
  8. _start:
  9. mov ecx, buffer
  10. mov edx, 02h
  11. call read
  12. mov cx, word [buffer]
  13. cmp cx, 3234h
  14. je exit
  15. cmp ch, 0ah
  16. je one_dig
  17. jmp two_dig
  18.  
  19. one_dig:
  20. mov ecx, buffer
  21. mov edx, 02h
  22. call write
  23. jmp _start
  24.  
  25. two_dig:
  26. mov ecx, buffer
  27. mov edx, 02h
  28. call write
  29. mov edx, 01h
  30. mov ecx, buffer
  31. call read ; read the 0ah
  32. mov ecx, buffer
  33. call write ; write the 0ah
  34. jmp _start
  35.  
  36. exit:
  37. mov eax, 01h ; exit()
  38. xor ebx, ebx ; errno
  39. int 80h
  40.  
  41.  
  42. read:
  43. mov eax, 03h ; read()
  44. mov ebx, 00h ; stdin
  45. int 80h
  46. ret
  47. write:
  48. mov eax, 04h ; write()
  49. mov ebx, 01h ; stdout
  50. int 80h
  51. ret
Success #stdin #stdout 0s 5304KB
stdin
1
2
10
42
11
stdout
1
2
10