Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main(){
- char s[]="Abcdefg";
- short int y;
- asm volatile(
- ".intel_syntax noprefix;"
- "mov ebx,%1;"
- "call zliczniki;"
- "mov %0,cx;"
- "jmp wyjscie;"
- // "mov ebx,%1;"
- "zliczniki:"
- "mov cx,0;"
- "petla:"
- "mov al,[ebx];"
- "sub al,0;"
- "jz koniec;"
- "inc cx;"
- "inc ebx;"
- "jmp petla;"
- "koniec:"
- "ret;"
- "wyjscie:"
- "mov %0, cx;"
- ".att_syntax noprefix;"
- :"=r" (y)
- :"r" (s)
- :"ebx","cx","al"
- );
- printf("s=%s, y=%hd \n",s,y);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement