AnatolKarlinski

zad2_2016

Jan 21st, 2017
215
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 policz
  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.         policz:
  18.                 mov ebp, [esp + 4];
  19.                 mov ecx, 1;
  20.                 jmp petla;
  21.         petla:
  22.                 inc ebp;
  23.                 mov bl, [ebp];
  24.                 cmp bl, ' ';
  25.                 je jestSpacja;
  26.                 cmp bl, 0;
  27.                 je jestKoniec;
  28.                 jmp petla;
  29.         jestSpacja:
  30.                 inc ebp;
  31.                 mov bl, [ebp];
  32.                 cmp bl, ' ';
  33.                 je jestSpacja;
  34.                 cmp bl, 0;
  35.                 je jestKoniec;
  36.                 inc ecx;
  37.                 jmp petla;
  38.         jestKoniec:
  39.                 mov eax, ecx;
  40.                 ret;
  41. .data
  42.  messg:
  43.         .asciz "Przykladowe zdanie lol aaa"
  44.  printf_arg1:
  45.         .asciz "%i\n"
Add Comment
Please, Sign In to add comment