Advertisement
kernel_memory_dump

2 for petlje

Mar 30th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .section .data
  2. text: .ascii   "Zdravo, Svete!\0"
  3. samoglasnici: .ascii "AEIOUaeiou\0"
  4. STRLEN_SAMOG 11
  5. broj: .long 0
  6. strlen_text: .long
  7.  
  8. tempEAX: .long 0
  9. tempEBX: .long 0
  10. tempECX: .long 0
  11. tempEDX: .long 0
  12.  
  13.  
  14. .section .text
  15. .globl main
  16. main:
  17. movl $text, %eax
  18. jmp str_len_text  # poziv kobajagi potprograma
  19. povratak_iz_potprograma:
  20. movl $0, %esi # ovo ce da bude i
  21. movl $0, %edi  # ovo ce da bude j
  22.  
  23. for_i:
  24.    cmpl  strlen_text, %esi   # i<strlen(text)
  25.    je kraj 
  26.     for_j:
  27.         cmpl STRLEN_SAMOG, %edi  # j< strlen(samoglasnici)
  28.         je for_i
  29.         movb text(, %esi, 1), %ebx  # povlacimo  element iz teksta
  30.         movb samoglasnici(, %edi, 1),  %ecx  #povucemo element samoglasnik
  31.         cmpb  %ebx, %ecx
  32.         jne for_j
  33.         inc broj
  34.         jmp for_j
  35.  
  36.  
  37.  
  38.  
  39. str_len_text:
  40. # Sacuvam regove da bi mogao
  41. # da ih koristim za svoj potprogram
  42. movl %eax, tempEAX
  43.  
  44. movl $text, %eax
  45. while:
  46.     cmpb  $0, (%eax)
  47.     je pocisti_za_sobom
  48.     incl strlen_text  
  49.     jmp while
  50.  
  51. movl tempEAX  %eax
  52. jmp povratak_iz_potprograma
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement