Advertisement
Guest User

aaa2

a guest
Oct 31st, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1.  
  2.  
  3. #include<stdio.h>
  4. int main(){
  5. char s[]="Abcaadefgaaa";
  6. short int y;
  7. asm volatile(
  8. ".intel_syntax noprefix;"
  9. "mov ebx,%1;"
  10. "call zliczniki;"
  11. "mov %0,cx;"
  12. "jmp wyjscie;"
  13. // "mov ebx,%1;"
  14. "zliczniki:"
  15.  
  16. "mov cx,0;"
  17. "petla:"
  18. "mov al,[ebx];"
  19. "cmp al,0;"
  20. "jz koniec;"
  21. "cmp al,'a';"
  22. "jne aaa;"
  23. "inc cx;"
  24. "aaa:"
  25. "inc ebx;"
  26. "jmp petla;"
  27. "koniec:"
  28. "ret;"
  29. "wyjscie:"
  30. "mov %0, cx;"
  31.  
  32.  
  33.  
  34. ".att_syntax noprefix;"
  35. :"=r" (y)
  36. :"r" (s)
  37. :"ebx","cx","al"
  38.  
  39. );
  40.  
  41.  
  42. printf("s=%s, y=%hd \n",s,y);
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement