Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Calculatrice
- ;28/04/2017
- ;Verchain Hugo
- bits 32
- extern printf, scanf, exit
- segment .data
- msg db "Selectionner une operation",00h
- msg2 db "1 - Addition ",0AH,"2 - Soustraction",0AH,"3 - Multiplication ",0AH,"4 - Division",00h
- msg4 db "Entrer un nombre : ",00h
- msg5 db "Ce nombre n'est pas dans le menu",00h
- msgresult db "Le resultat est : ",00h
- msgaddi db "----Addition---",00h
- msgsous db "---Soustraction---",00h
- msgmulti db "---Multiplication---",00h
- msgdivi db "---Division---",00h
- format db "%d",0
- nl db 0AH,00h
- nbaddi db 1
- segment .bss
- nbmenu resd 1
- nb1 resd 1
- nb2 resd 1
- result resd 1
- segment .text
- global main
- demander:
- push ebp
- mov ebp,esp
- push msg
- call printf
- add esp,4
- push nl
- call printf
- add esp,4
- push msg2
- call printf
- add esp,4
- push nl
- call printf
- add esp,4
- push nbmenu
- push format
- call scanf
- add esp,8
- mov al, [nbmenu]
- cmp al, [nbaddi]
- je addition
- jmp inconnu
- mov esp,ebp
- pop ebp
- addition:
- push ebp
- mov ebp,esp
- push msgaddi
- call printf
- add esp,4
- push nl
- call printf
- add esp,4
- push msg4
- call printf
- add esp,4
- push nb1
- push format
- call scanf
- add esp,8
- push nl
- call printf
- add esp,4
- push msg4
- call printf
- add esp,4
- push nb2
- push format
- call scanf
- add esp,8
- mov eax, [nb1]
- add eax, [nb2]
- push msgresult
- call printf
- add esp,4
- jmp fin
- mov esp,ebp
- pop ebp
- Soustraction:
- push ebp
- mov ebp,esp
- push msgsous
- call printf
- add esp,4
- jmp fin
- mov esp,ebp
- pop ebp
- Division:
- push ebp
- mov ebp,esp
- push msgdivi
- call printf
- add esp,4
- jmp fin
- mov esp,ebp
- pop ebp
- Multiplication:
- push ebp
- mov ebp,esp
- push msgmulti
- call printf
- add esp,4
- jmp fin
- mov esp,ebp
- pop ebp
- inconnu:
- push ebp
- mov ebp,esp
- push msg5
- call printf
- add esp,4
- jmp fin
- ret
- mov esp,ebp
- pop ebp
- fin:
- push 0
- call exit
- main:
- call demander
- push 0
- call exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement