fork(1) download
  1. section .bss
  2. msg resb 1 ; reserva 1 byte para um caractere
  3.  
  4. section .data
  5.  
  6. section .text
  7. global _start
  8.  
  9. _start:
  10. ; Lê 1 caractere do teclado
  11. mov eax, 3 ; sys_read
  12. mov ebx, 0 ; stdin
  13. mov ecx, msg ; onde armazenar
  14. mov edx, 5 ; quantos bytes
  15. int 0x80 ; chamada de sistema
  16. jmp validar
  17.  
  18. validar:
  19. mov al, [msg]
  20. cmp al, 'A'
  21. jl exit
  22. cmp al, 'Z'
  23. jle trocar
  24.  
  25. trocar:
  26. mov al, [msg]
  27. or al, 32
  28. mov [msg], al
  29. jmp imprime_caractere
  30.  
  31. imprime_caractere:
  32. mov eax, 4 ; sys_write
  33. mov ebx, 1 ; stdout
  34. mov ecx, msg ; endereço da string
  35. mov edx, 5 ; tamanho da string (8 chars + newline)
  36. int 0x80 ; chamada de sistema
  37. jmp exit
  38.  
  39. exit:
  40. mov eax, 1 ; sys_exit
  41. mov ebx, 0
  42. int 0x80
Success #stdin #stdout 0s 5324KB
stdin
P
stdout
p