Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------------------------------------------------------------------------------------------------
- .586
- .model flat
- .code
- ;int fattoriali(int *a, int *b, int lung)
- ;------------------------------------------------------------
- _fattoriali proc
- push ebp
- mov ebp,esp
- push esi
- push edi
- push ebx
- mov ebx,dword ptr[ebp+8] ;first of src
- mov ecx,dword ptr[ebp+12] ;first of dest
- mov edi,dword ptr[ebp+16] ;lung
- mov esi,0 ;counter
- ciclo:
- cmp esi,edi
- je fine
- mov eax,dword ptr[ebx+4*esi]
- call is_fatt
- mov dword ptr[ecx+4*esi],eax
- inc esi
- jmp ciclo
- fine:
- pop ebx
- pop edi
- pop esi
- mov esp,ebp
- pop ebp
- ret
- _fattoriali endp
- ;------------------------------------------------------------
- is_fatt proc
- ;in eax ho il numero
- push ebp
- mov ebp,esp
- push esi
- push edi
- push ebx
- mov ebx,eax
- mov esi,1
- moltiplica:
- cmp esi,ebx
- je finish
- mul esi
- inc esi
- jmp moltiplica
- finish:
- ;rirorna eax
- pop ebx
- pop edi
- pop esi
- mov esp,ebp
- pop ebp
- ret
- is_fatt endp
- ;------------------------------------------------------------
- End
- -----------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement