fork download
  1. section .bss
  2. msg resb 1 ; reserva 1 byte para um caractere
  3.  
  4. section .data
  5. traco db '-'
  6. contador dd 0
  7.  
  8. section .text
  9. global _start
  10.  
  11. _start:
  12. ; Lê 1 caractere do teclado
  13. mov eax, 3 ; sys_read
  14. mov ebx, 0 ; stdin
  15. mov ecx, msg ; onde armazenar
  16. mov edx, 5 ; quantos bytes
  17. int 0x80 ; chamada de sistema
  18.  
  19. mov dword [contador], 10
  20.  
  21. imprime_caractere:
  22. mov eax, 4 ; sys_write
  23. mov ebx, 1 ; stdout
  24. mov ecx, msg ; endereço da string
  25. mov edx, 5 ; tamanho da string (8 chars + newline)
  26. int 0x80 ; chamada de sistema
  27.  
  28. cmp dword [contador], 0
  29. je exit
  30.  
  31. ; Decrementa o contador
  32. dec dword [contador]
  33.  
  34. ; Repete o processo
  35. jmp imprime_caractere
  36.  
  37. exit:
  38. mov eax, 1 ; sys_exit
  39. mov ebx, 0
  40. int 0x80
Success #stdin #stdout 0s 5292KB
stdin
12345
stdout
1234512345123451234512345123451234512345123451234512345