Advertisement
Guest User

Untitled

a guest
Nov 6th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.         char s[] = "Hello worlds";
  6.  
  7.         asm volatile(
  8.                 ".intel_syntax noprefix;"
  9.                 "mov eax,%0;"
  10.                 "xor ebx,ebx;"
  11.                 "xor ecx,ecx;"
  12.                 "Petla:"
  13.                        
  14.                         "mov ebx,[eax];"
  15.                         "cmp ebx,0;"
  16.                         "je setbegin;"
  17.                         "push ebx;"
  18.                         "inc eax;"
  19.                         "inc ecx;"
  20.                         "jmp Petla;"
  21.                 "setbegin:"
  22.                         "mov eax,%0;"
  23.                         "jmp zdejmij;"
  24.                 "zdejmij:"
  25.                         "pop [eax];"
  26.                         "ecx,1;"
  27.                         "je koniec;"
  28.                         "inc eax;"
  29.                         "dec ecx;"
  30.                         "jmp zdejmij;"
  31.                 "koniec:"
  32.                 ".att_syntax prefix;"
  33.                 :              
  34.                 :"r"(s)
  35.                 :"eax","ebx","ecx","al"
  36.                 );
  37.         printf("%s \n",s);
  38.         return 0;
  39. }
  40. ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement