Advertisement
Guest User

dupa2

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