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