Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. #uneti string,i izracunati procenat alfa numerickih znakova( mala,velika slova i brojevi ),i taj broj ispisati u heksadecimalnom sistemu na ekranu.
  2. .section .data
  3. string_max = 200
  4. string_unos: .fill string_max,1,0
  5. string_ispis: .fill string_max,1,0
  6. .section .text
  7. .globl main
  8. main:
  9.  
  10. unos:
  11. movl $3, %eax
  12. movl $0, %ebx
  13. leal string_unos, %ecx
  14. movl $string_max, %edx
  15. int $0x80
  16.  
  17. provjera_znaka:
  18. xorl %esp, %esp
  19. xorl %esi, %esi
  20. leal string_unos, %edi
  21.  
  22. provjera_znaka_1:
  23. movb (%edi), %bl
  24. cmpb $10, %bl
  25. je racunaj
  26. cmpb $'0', %bl
  27. jb nije_alfanum
  28. cmpb $'9', %bl
  29. jbe alfanum
  30. cmpb $'A', %bl
  31. jb nije_alfanum
  32. cmpb $'Z', %bl
  33. jbe alfanum
  34. cmpb $'a', %bl
  35. jb nije_alfanum
  36. cmpb $'z', %bl
  37. jbe alfanum
  38.  
  39. nije_alfanum:
  40. incl %esp
  41. incl %edi
  42. jmp provjera_znaka_1
  43.  
  44. alfanum:
  45. incl %esp
  46. incl %esi
  47. incl %edi
  48. jmp provjera_znaka_1
  49.  
  50. racunaj:
  51. movl $100, %ebp
  52. movl %esi, %eax
  53. movl $0, %edx
  54. mull %ebp
  55. divl %esp
  56.  
  57. konverzija_u_hex:
  58. xorl %esi, %esi
  59. xorl %esp, %esp
  60.  
  61. leal string_ispis, %esi
  62. konverzija1:
  63. xorl %edx, %edx
  64. movl $16, %ecx
  65. cmpl $0, %eax
  66. je obrtanje
  67. divl %ecx
  68. cmpl $90, %edx
  69. ja malo_slovo
  70. cmpl $9, %edx
  71. ja veliko_slovo
  72. jmp broj
  73. malo_slovo:
  74. addl $87, %edx
  75. movl %edx, (%esi)
  76. incl %esi
  77. jmp konverzija1
  78. veliko_slovo:
  79. addl $55, %edx
  80. movl %edx, (%esi)
  81. incl %esi
  82. jmp konverzija1
  83. broj:
  84. addl $'0', %edx
  85. movl %edx, (%esi)
  86. incl %esi
  87. jmp konverzija1
  88.  
  89. obrtanje:
  90. leal string_ispis, %edi
  91. decl %esi
  92. movl %esi, %ebp
  93. obrtanje1:
  94. movb (%esi), %al
  95. movb (%edi), %ah
  96. movb %al, (%edi)
  97. movb %ah, (%esi)
  98. incl %edi
  99. decl %esi
  100. cmpl %edi, %esi
  101. jbe ispis
  102. jmp obrtanje1
  103. ispis:
  104. incl %ebp
  105. movl $10, (%ebp)
  106. movl $4, %eax
  107. movl $1, %ebx
  108. leal string_ispis, %ecx
  109. movl $string_max, %edx
  110. int $0x80
  111. kraj:
  112. movl $1, %eax
  113. int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement