Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- segment .data
- komunikat db "Podaj łańcuch znaków: ", 0
- format db "%s", 0
- znak db "%c", 0
- spacja db " ", 0
- nl db 10, 0
- tekst times 4096 db 0
- segment .text
- global main
- extern printf
- extern scanf
- main:
- push ebp
- mov ebp, esp
- push komunikat
- call printf
- add esp, 4
- push tekst
- push format
- call scanf
- add esp, 8
- call wypisz_pierwsze
- push spacja
- call printf
- add esp, 4
- call wypisz_ostatnie
- push nl
- call printf
- add esp, 4
- pop ebp
- ret
- wypisz_pierwsze:
- push ebp
- mov ebp, esp
- mov eax, tekst
- .petla:
- cmp byte [eax], 0
- je .petla_koniec
- push eax
- push dword [eax]
- push znak
- call printf
- add esp, 8
- pop eax
- inc eax
- jmp .petla
- .petla_koniec:
- pop ebp
- ret
- wypisz_ostatnie:
- push ebp
- mov ebp, esp
- mov eax, tekst
- xor ebx, ebx
- xor ecx, ecx
- .petla1:
- cmp byte [eax], 0
- je .petla1_koniec
- cmp byte [eax], ' '
- je .spacja
- jmp .spacja_koniec
- .spacja:
- mov ecx, ebx
- .spacja_koniec:
- inc eax
- inc ebx
- jmp .petla1
- .petla1_koniec:
- break:
- mov eax, tekst
- add eax, ecx
- .petla2:
- cmp byte [eax], 0
- je .petla2_koniec
- push eax
- push dword [eax]
- push znak
- call printf
- add esp, 8
- pop eax
- inc eax
- jmp .petla2
- .petla2_koniec:
- pop ebp
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement