Advertisement
anja99

Untitled

Mar 25th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. .section .data
  2.  
  3. poruka: .ascii "Unesite string:\0"
  4. len1 = .-poruka
  5.  
  6. poruka2: .ascii "Upcase:\0"
  7. len2 = .-poruka2
  8.  
  9. max = 30
  10. string: .fill max, 1, 42
  11.  
  12. .section .text
  13. .globl main
  14.  
  15. main:
  16. movl $4, %eax
  17. movl $1, %ebx
  18. leal poruka, %ecx
  19. movl $len1, %edx
  20. int $0x80
  21.  
  22. movl $3, %eax
  23. movl $0, %ebx
  24. leal string, %ecx
  25. movl $max, %edx
  26. int $0x80
  27.  
  28.  
  29. movl %eax, %edi
  30.  
  31. pocetak:
  32. movl $string, %esi
  33.  
  34. provera1:
  35. cmpb $'a', (%esi)
  36. jl petlja
  37. cmpb $'z', (%esi)
  38. jg petlja
  39.  
  40. subb $32, (%esi) #prvo slovo postaje veliko
  41. incl %esi
  42.  
  43. petlja:
  44. cmpb $10, (%esi)
  45. je ispis
  46. cmpb $' ', (%esi)
  47. je slovo
  48. incl %esi
  49. jmp petlja
  50.  
  51. slovo:
  52. cmpb $'a', 1(%esi)
  53. jl nista
  54. cmpb $'z',1(%esi)
  55. jg nista
  56.  
  57. subb $32, 1(%esi)
  58. incl %esi
  59. jmp petlja
  60.  
  61. nista:
  62. incl %esi
  63. jmp petlja
  64.  
  65. ispis:
  66. movl $4, %eax
  67. movl $1, %ebx
  68. leal poruka2, %ecx
  69. movl $len2, %edx
  70. int $0x80
  71.  
  72. movl $4, %eax
  73. movl $1, %ebx
  74. leal string, %ecx
  75. movl %edi, %edx
  76. int $0x80
  77.  
  78. kraj:
  79. movl $1, %eax
  80. movl $0, %ebx
  81. int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement