Advertisement
Guest User

Untitled

a guest
Jun 10th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. segment .data
  2.     komunikat db "Podaj łańcuch znaków: ", 0
  3.     format db "%s", 0
  4.     znak db "%c", 0
  5.     spacja db " ", 0
  6.     tekst times 4096 db 0
  7.  
  8. segment .text
  9.     global  main
  10.     extern printf
  11.     extern scanf
  12.  
  13. main:
  14.     push ebp
  15.     mov ebp, esp
  16.     push komunikat
  17.     call printf
  18.     add esp, 4
  19.     push tekst
  20.     push format
  21.     call scanf
  22.     add esp, 8
  23.     call wypisz_pierwsze
  24.     push spacja
  25.     call printf
  26.     add esp, 4
  27.     call wypisz_ostatnie
  28.     pop ebp
  29.     ret
  30.  
  31. wypisz_pierwsze:
  32.     push ebp
  33.     mov ebp, esp
  34.     mov eax, tekst
  35. .petla:
  36.     cmp byte [eax], 0
  37.     je .petla_koniec
  38.     push eax
  39.     push dword [eax]
  40.     push znak
  41.     call printf
  42.     add esp, 8
  43.     pop eax
  44.     inc eax
  45.     jmp .petla
  46. .petla_koniec:
  47.     pop ebp
  48.     ret
  49.  
  50. wypisz_ostatnie:
  51.     push ebp
  52.     mov ebp, esp
  53.  
  54.     pop ebp
  55.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement