Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bits 32
- global start
- extern exit, printf, scanf
- import exit msvcrt.dll
- import printf msvcrt.dll
- import scanf msvcrt.dll
- segment data use32 class=data
- ; ...
- sir db "cojoc ana are un cojoc frumos si un capac z b tanat iei barba iearbaabraei ", 0
- lsir equ $-sir-1
- sirDest times lsir db 0
- pozSirDest dd 0
- pozSir dd 0
- aux db 0
- formatSir1 db "Sirul contine: %s", 0
- formatSir2 db `\nCuvintele palindroame sunt: %s`, 0
- ; segmentul de cod
- segment code use32 class=code
- start:
- ; ...
- mov ecx, lsir
- mov esi, sir
- mov edi, sir
- jecxz finalCautare
- repeta:
- lodsb
- cmp al, 20h
- jz foundSpace
- loop repeta
- foundSpace:
- push ecx
- mov [pozSir], esi
- sub esi, 2
- mov ecx, esi
- sub ecx, edi
- mov edx, ecx
- comparaCarac:
- cmpsb
- jnz afara
- sub esi, 2
- loop comparaCarac
- mov ecx, edx
- inc ecx
- push edi
- mov edi, sirDest
- add edi, [pozSirDest]
- putCarac:
- movsb
- loop putCarac
- mov al, 20h
- push esi
- mov esi, edi
- stosb
- pop esi
- add [pozSirDest], edx
- add [pozSirDest], dword 2
- pop edi
- afara:
- pop ecx
- mov edi, [pozSir]
- mov esi, [pozSir]
- loop repeta
- finalCautare:
- push sir
- push formatSir1
- call [printf]
- add esp, 4*2
- push sirDest
- push formatSir2
- call [printf]
- add esp, 4*2
- finalPr:
- ; exit(0)
- push dword 0 ; push the parameter for exit onto the stack
- call [exit] ; call exit to terminate the program
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement