AnatolKarlinski

zad1_2016

Jan 21st, 2017
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .intel_syntax noprefix
  2. .globl main
  3. .text
  4.         main:
  5.                 mov eax, offset messg
  6.                 push eax
  7.                 call znajdz
  8.                 push eax
  9.                 mov eax, offset printf_arg1
  10.                 push eax
  11.                 call printf
  12.                 add esp, 12
  13.                 ret
  14.         exit:
  15.                 mov eax, 0
  16.                 ret
  17.         znajdz:
  18.                 xor ecx, ecx;
  19.                 mov ebp, [esp + 4];
  20.                 dec ebp;
  21.                 jmp petla;
  22.         petla:
  23.                 inc ebp;
  24.                 mov bl, [ebp];
  25.                 cmp bl, '*';
  26.                 je jestZnak;
  27.                 cmp bl, 0;
  28.                 je koniecPetli;
  29.                 jmp petla;
  30.         jestZnak:
  31.                 inc ecx;
  32.                 jmp petla;
  33.         koniecPetli:
  34.                 cmp ecx, 0;
  35.                 je znakNieWystapil;
  36.                 mov eax, ecx;
  37.                 ret;
  38.         znakNieWystapil:
  39.                 mov eax, -1;
  40.                 ret;
  41. .data
  42.  messg:
  43.         .asciz "*testerino *uuer*"
  44.  printf_arg1:
  45.         .asciz "%i\n"
Advertisement
Add Comment
Please, Sign In to add comment