Accueil > > > CALCULETTE À DEUX OPÉRANDES
CALCULETTE À DEUX OPÉRANDES
Information sur la source
Description
Addition, Soustraction, Multiplication et division de deux entiers
Source
- dosseg
- .model small
- .stack 100h
- .data
- x_out db 8 dup (0)
- invite db 13,10," Operation > $"
- espace db " $"
- result db 13,10," Resultat > $"
- depas db 13,10," Resultat > 1$"
-
- titre db 13," ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»",13,10
- db 13," º CALCULATRICE º",13,10
- db 13," º PROGRAMMEES PAR º",13,10
- db 13," ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹",13,10
- db 13," º Thameur BELGHITH º Fahima HAMDI º",13,10
- db 13," ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ",13,10
- db 13,"ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ",13,10,"$"
-
-
- tab1 db 8 dup (1)
- tab3 db 8 dup (0)
- ct db (0)
- x db (0)
- y db (0)
- nbr1 dw ?
- nbr3 dw 2 dup (0)
- reste db 13,10," ==> Reste = $"
- quot db 13,10," ==> Quotient = $",10,13
- revoir db " Au revoir ... ",13,10
- db 13,"ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ",13,10,10,"$"
- n db 5 dup (0)
- m db 5 dup (0)
- l db 5 dup (0)
- k db 5 dup (0)
- c1 db (0)
-
- .code
-
-
- ;**************************
- ;Procedure pour l'affichage
- ;**************************
-
- affichage proc far
- affich:
- mov dl,x_out[si]
- add dl,48
- cmp dl,48 ;non affichage de zero
- jne bou1
- jmp o
- bou1: mov ah,6
- int 21h
- mov c1,5
- jmp bou2
- o: cmp c1,5
- je bou1
- bou2: inc si
- inc cx
- cmp cx,4
- pushf
- jne w
- cmp c1,0
- jne w
- mov dl,48
- mov ah,6
- int 21h
- w: popf
- js affich
- ret
- affichage endp
-
-
- ;**************************
- ;Procedure pour la division
- ;**************************
- division proc far
- mov cx,0
- mov cl,x_out[7]
- push cx
- mov al,x_out[6]
- mov bl,10
- mul bl
- pop cx
- add cx,ax
- push cx
- mov al,x_out[5]
- mov bl,100
- mul bl
- pop cx
- add cx,ax
- push cx
- mov ah,0
- mov al,x_out[4]
- mov bx,1000
- mul bx
- pop cx
- add cx,ax
- mov nbr1,cx
- mov cx,0
- mov cl,x_out[3]
- push cx
- mov al,x_out[2]
- mov bl,10
- mul bl
- pop cx
- add cx,ax
- push cx
- mov al,x_out[1]
- mov bl,100
- mul bl
- pop cx
- add cx,ax
- push cx
- mov ah,0
- mov al,x_out[0]
- mov bx,1000
- mul bx
- pop cx
- add ax,cx
- mov dx,0
- div nbr1
- mov nbr3[0],ax
- mov nbr3[2],dx
- ;******************************
- ;conversion du quotient en hexa
- ;******************************
- mov dx,0
- mov ax,nbr3[0]
- mov bx,1000
- div bx
- mov m[0],al
- mov ax,dx
- mov bl,100
- div bl
- mov m[1],al
- mov al,ah
- mov ah,0
- mov bl,10
- div bl
- mov m[2],al
- mov m[3],ah
- ;*******************
- ;conversion du reste
- ;*******************
- mov dx,0
- mov ax,nbr3[2]
- mov bx,1000
- div bx
- mov k[0],al
- mov ax,dx
- mov bl,100
- div bl
- mov k[1],al
- mov al,ah
- mov ah,0
- mov bl,10
- div bl
- mov k[2],al
- mov k[3],ah
- mov dx,offset result
- mov ah,09
- int 21h
- mov dx,offset quot
- mov ah,9
- int 21h
- mov si,0
- mov cx,0
- mov c1,0
- ;******************
- ;affichage du reste
- ;******************
-
- affich0:mov dl,m[si]
- add dl,48
-
- cmp dl,48
- jne aff
- jmp affic
- mov dl,10 ;retour a la ligne
- mov ah,6
- int 21h
- mov dl,13 ; debut de la ligne
- mov ah,6
- int 21h
-
- aff: mov ah,6
- int 21h
- mov ct,5
- jmp j0
- affic: cmp ct,5
- je aff
- j0: inc si
- inc cx
- cmp cx,4
- pushf
- jne jo10
- cmp ct,0
- jne jo10
- mov dl,48
- mov ah,6
- int 21h
- jmp t
- jo10: popf
- js affich0
- t: mov dl,10
- mov ah,6
- int 21h
- mov dl,13
- mov ah,6
- int 21h
- mov dx,offset reste
- mov ah,09
- int 21h
-
- mov si,0 ;affichage du reste
- mov cx,0
- mov ct,0
- affich1:mov dl,k[si]
- add dl,48
-
- cmp dl,48
- jne af00
- jmp af100
-
- af00: mov ah,6
- int 21h
- mov ct,5
- jmp j00
- af100: cmp ct,5
- je af00
- j00: inc si
- inc cx
- cmp cx,4
- pushf
- jne jo100
- cmp ct,0
- jne jo100
- mov dl,48
- mov ah,6
- int 21h
- jo100: popf
- js affich1
- jmp fin
- division endp
-
-
-
-
-
- ;**********************
- ;procedure soustraction
- ;**********************
- soustraction proc far
-
- mov al,x_out[0]
- cmp al,x_out[4]
- ja positif
- jb negatif
- mov al,x_out[1]
- cmp al,x_out[5]
- ja positif
- jb negatif
- mov al,x_out[2]
- cmp al,x_out[6]
- ja positif
- jb negatif
- mov al,x_out[3]
- cmp al,x_out[7]
- jae positif
- negatif:
- mov x,10
- mov si,0
- mov di,4
- mov cx,4
- boucle:
- mov bl,x_out[si]
- mov al,x_out[di]
- mov m[si],al
- mov m[di],bl
- inc si
- inc di
- loop boucle
- positif:
- mov al,x_out[7]
- sub x_out[3],al
- pushf
- jnc change0
- not x_out[3]
- add x_out[3],1
- mov al,10
- sub al,x_out[3]
- mov x_out[3],al
- change0:
- mov al,x_out[6]
- popf
- sbb x_out[2],al
- pushf
- jnc change1
- not x_out[2]
- add x_out[2],1
- mov al,10
- sub al,m[2]
- mov x_out[2],al
- change1:
- mov al,x_out[5]
- popf
- sbb x_out[1],al
- pushf
- jnc change2
- not x_out[1]
- add x_out[1],1
- mov al,10
- sub al,x_out[1]
- mov x_out[1],al
- change2:
- mov al,x_out[4]
- popf
- sbb x_out[0],al
- pushf
- jnc change3
- not x_out[0]
- add x_out[0],1
- mov al,10
- sub al,x_out[0]
- mov x_out[0],al
- change3:
- mov si,0
- mov cx,0
- popf
- jnc change4
- change4:
- cmp x,10
- jne change5
- mov dx, offset result
- mov ah,09
- int 21h
- mov dl,45
- mov ah,6
- int 21h
- call affichage
- jmp fin
- change5:
- mov dx,offset result
- mov ah,09
- int 21h
- mov c1,0
- call affichage
- jmp fin
- soustraction endp
-
- ;*************************
- ;Procedure pour l'addition
- ;*************************
- addition proc far
- mov al,x_out[7]
- add x_out[3],al
- mov al,x_out[3]
- mov ah,0
- mov cl,10
- div cl
- mov x_out[3],ah
- add x_out[2],al
-
- mov al,x_out[6]
- add x_out[2],al
- mov al,x_out[2]
- mov ah,0
- mov cl,10
- div cl
- mov x_out[2],ah
- add x_out[1],al
-
- mov al,x_out[5]
- add x_out[1],al
- mov al,x_out[1]
- mov ah,0
- mov cl,10
- div cl
- mov x_out[1],ah
- add x_out[0],al
-
- mov al,x_out[4]
- add x_out[0],al
- mov al,x_out[0]
- mov ah,0
- mov cl,10
- div cl
- mov x_out[0],ah
- cmp al,1
- je dep
- jne resl
- dep: mov dx,offset depas
- mov ah,09
- int 21h
- mov si,0
- mov cx,0
- mov c1,0
- call affichage
- jmp fin
-
- resl:
- mov dx,offset result
- mov ah,09
- int 21h
-
- mov si,0
- mov cx,0
- mov c1,0
- call affichage
- jmp fin
- addition endp
-
-
-
-
- ;******************************
- ;Procedure de la multiplication
- ;******************************
- multiplication proc far
- mov si,4
- a:
- mov al,x_out[7]
- mov bl,x_out[si-1]
- mul bl
- mov cl,10
- div cl
- add n[si],ah
- add n[si-1],al
- dec si
- cmp si,0
- jne a
- mov si,4
- b:
- mov al,x_out[6]
- mov bl,x_out[si-1]
- mul bl
- mov cl,10
- div cl
- add m[si],ah
- add m[si-1],al
- dec si
- cmp si,0
- jne b
-
- mov si,4
- c:
- mov al,x_out[5]
- mov bl,x_out[si-1]
- mul bl
- mov cl,10
- div cl
- add l[si],ah
- add l[si-1],al
- dec si
- cmp si,0
- jne c
-
- mov si,4
- d:
- mov al,x_out[4]
- mov bl,x_out[si-1]
- mul bl
- mov cl,10
- div cl
- add k[si],ah
- add k[si-1],al
- dec si
- cmp si,0
- jne d
-
- mov al,n[4]
- add tab3[7],al
-
- mov al,0
- add al,n[3]
- add al,m[4]
- mov ah,0
- mov cl,10
- div cl
- mov tab3[6],ah
-
- add al,n[2]
- add al,m[3]
- add al,l[4]
- mov ah,0
- mov cl,10
- div cl
- mov tab3[5],ah
-
- add al,n[1]
- add al,m[2]
- add al,l[3]
- add al,k[4]
- mov ah,0
- mov cl,10
- div cl
- mov tab3[4],ah
-
- add al,n[0]
- add al,m[1]
- add al,l[2]
- add al,k[3]
- mov cl,10
- mov ah,0
- div cl
- mov tab3[3],ah
-
- add al,m[0]
- add al,l[1]
- add al,k[2]
- mov cl,10
- mov ah,0
- div cl
- mov tab3[2],ah
-
- add al,l[0]
- add al,k[1]
- mov cl,10
- mov ah,0
- div cl
- mov tab3[1],ah
-
- add al,k[0]
- mov tab3[0],al
-
- mov dx,offset result
- mov ah,09
- int 21h
-
- mov si,0
- mov cx,0
- affichage1:
- mov dl,tab3[si]
- add dl,48
- cmp dl,48 ;pour eliminer les zeros
- jne e
- jmp f
- e: mov y,5
- mov ah,6
- int 21h
- jmp comp
- f: cmp y,5
- je e
- comp: inc si
- inc cx
- cmp cx,8
- pushf
- jne g
- cmp y,0
- jne g
- mov dl,48
- mov ah,6
- int 21h
- g: popf
- js affichage1
- jmp fin
- multiplication endp
-
- ;****************************
- ;debut de programme principal
- ;****************************
-
-
- start: mov ax,@data
- mov ds,ax
- mov cx,5
- bouc1:
- mov dl,13 ; debut de la ligne
- loop bouc1
- mov dx,offset titre
- mov ah,9
- int 21h
-
- mov dx,offset invite
- mov ah,9
- int 21h
- lea bx,tab1
- call lire_4 ;saisie de 1er nbre
- cmp tab1[3],1
- jne suite1
- cmp tab1[2],1
- jne suite2
- cmp tab1[1],1
- jne suite3
- mov al,tab1[0]
- mov tab1[3],al
- mov tab1[0],30h
- mov tab1[1],30h
- mov tab1[2],30h
- jmp suite1
- suite3:
- mov al,tab1[1]
- mov tab1[3],al
- mov al,tab1[0]
- mov tab1[2],al
- mov tab1[0],30h
- mov tab1[1],30h
- jmp suite1
- suite2:
- mov al,tab1[2]
- mov tab1[3],al
- mov al,tab1[1]
- mov tab1[2],al
- mov al,tab1[0]
- mov tab1[1],al
- mov tab1[0],48
- suite1:
- mov dx,offset espace
- mov ah,09
- int 21h
- debut1:
- mov dl,255
- mov ah,6
- int 21h
- cmp al,45
- je soust
- cmp al,43
- je addit
- cmp al,47
- je divvv
- cmp al,42
- je multi
- jmp debut1
- soust:
- mov dl,45 ;affichage de '-'
- mov ah,6
- int 21h
- mov x,45
- jmp application
- addit:
- mov dl,43 ;affichage de '+'
- mov ah,6
- int 21h
- mov x,43
- jmp application
- divvv: ;affichage de '/'
- mov dl,47
- mov ah,6
- int 21h
- mov x,47
- jmp application
- multi: ;affichage de '*'
- mov dl,42
- mov ah,6
- int 21h
- mov x,42
- jmp application
-
- mov dx,offset espace
- mov ah,09
- int 21h
- application:
-
- mov dx,offset espace
- mov ah,09
- int 21h
- lea bx,tab1
- add bx,4
- call lire_4 ; saisie du nombre 2
- cmp tab1[7],1
- jne suite4
- cmp tab1[6],1
- jne suite5
- cmp tab1[5],1
- jne suite6
- mov al,tab1[4]
- mov tab1[7],al
- mov tab1[4],48
- mov tab1[5],48
- mov tab1[6],48
- jmp suite4
- suite6:
- mov al,tab1[5]
- mov tab1[7],al
- mov al,tab1[4]
- mov tab1[6],al
- mov tab1[4],48
- mov tab1[5],48
- jmp suite4
- suite5:
- mov al,tab1[6]
- mov tab1[7],al
- mov al,tab1[5]
- mov tab1[6],al
- mov al,tab1[4]
- mov tab1[5],al
- mov tab1[4],48
- suite4:
- mov dl,10
- mov ah,6
- int 21h
- mov dl,13
- mov ah,6
- int 21h
- mov si,0 ; convertion de code ascii en decimal
- mov cx,8
- bouc2: sub tab1[si],48
- mov al,tab1[si]
- mov x_out[si],al
- inc si
- loop bouc2
- cmp x,45
- je sous
- cmp x,43
- je addi
- cmp x,47
- je divn
- cmp x,42
- je multip
-
- addi: call addition
-
- sous: call soustraction
-
- divn: call division
-
- multip: call multiplication
-
-
- ;**********************
- ;Procedure de la saisie
- ;**********************
-
- lire_4 proc
- push cx
- push ax
- push dx
- mov cx,0
- debut:
- mov dl,255
- mov ah,6
- int 21h
- jz debut
- cmp al,13
- je fin1
- cmp al,30h
- js debut
- cmp al,3ah
- jns debut
- mov [bx],al
- inc bx
- inc cx
- cmp cx,5
- jns debut
- mov dl,al
- mov ah,6
- int 21h
- jmp debut
-
- fin1: pop dx
- pop ax
- pop cx
-
- ret
- lire_4 endp
-
- fin:
- mov dl,10 ;retour . la ligne
- mov ah,6
- int 21h
- mov dl,10 ;retour . la ligne
- mov ah,6
- int 21h
- mov dl,13 ; debut de la ligne
- mov ah,6
- int 21h
- mov dl,10 ;retour . la ligne
- mov ah,6
- int 21h
- mov dl,13 ; debut de la ligne
- mov ah,6
- int 21h
- mov dx,offset revoir
- mov ah,9
- int 21h
- mov dl,10 ;retour . la ligne
- mov ah,6
- int 21h
- mov dl,13 ; debut de la ligne
- mov ah,6
- int 21h
- mov ah,4ch
- int 21h
-
-
-
- end start
dosseg
.model small
.stack 100h
.data
x_out db 8 dup (0)
invite db 13,10," Operation > $"
espace db " $"
result db 13,10," Resultat > $"
depas db 13,10," Resultat > 1$"
titre db 13," ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»",13,10
db 13," º CALCULATRICE º",13,10
db 13," º PROGRAMMEES PAR º",13,10
db 13," ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹",13,10
db 13," º Thameur BELGHITH º Fahima HAMDI º",13,10
db 13," ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ",13,10
db 13,"ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ",13,10,"$"
tab1 db 8 dup (1)
tab3 db 8 dup (0)
ct db (0)
x db (0)
y db (0)
nbr1 dw ?
nbr3 dw 2 dup (0)
reste db 13,10," ==> Reste = $"
quot db 13,10," ==> Quotient = $",10,13
revoir db " Au revoir ... ",13,10
db 13,"ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ",13,10,10,"$"
n db 5 dup (0)
m db 5 dup (0)
l db 5 dup (0)
k db 5 dup (0)
c1 db (0)
.code
;**************************
;Procedure pour l'affichage
;**************************
affichage proc far
affich:
mov dl,x_out[si]
add dl,48
cmp dl,48 ;non affichage de zero
jne bou1
jmp o
bou1: mov ah,6
int 21h
mov c1,5
jmp bou2
o: cmp c1,5
je bou1
bou2: inc si
inc cx
cmp cx,4
pushf
jne w
cmp c1,0
jne w
mov dl,48
mov ah,6
int 21h
w: popf
js affich
ret
affichage endp
;**************************
;Procedure pour la division
;**************************
division proc far
mov cx,0
mov cl,x_out[7]
push cx
mov al,x_out[6]
mov bl,10
mul bl
pop cx
add cx,ax
push cx
mov al,x_out[5]
mov bl,100
mul bl
pop cx
add cx,ax
push cx
mov ah,0
mov al,x_out[4]
mov bx,1000
mul bx
pop cx
add cx,ax
mov nbr1,cx
mov cx,0
mov cl,x_out[3]
push cx
mov al,x_out[2]
mov bl,10
mul bl
pop cx
add cx,ax
push cx
mov al,x_out[1]
mov bl,100
mul bl
pop cx
add cx,ax
push cx
mov ah,0
mov al,x_out[0]
mov bx,1000
mul bx
pop cx
add ax,cx
mov dx,0
div nbr1
mov nbr3[0],ax
mov nbr3[2],dx
;******************************
;conversion du quotient en hexa
;******************************
mov dx,0
mov ax,nbr3[0]
mov bx,1000
div bx
mov m[0],al
mov ax,dx
mov bl,100
div bl
mov m[1],al
mov al,ah
mov ah,0
mov bl,10
div bl
mov m[2],al
mov m[3],ah
;*******************
;conversion du reste
;*******************
mov dx,0
mov ax,nbr3[2]
mov bx,1000
div bx
mov k[0],al
mov ax,dx
mov bl,100
div bl
mov k[1],al
mov al,ah
mov ah,0
mov bl,10
div bl
mov k[2],al
mov k[3],ah
mov dx,offset result
mov ah,09
int 21h
mov dx,offset quot
mov ah,9
int 21h
mov si,0
mov cx,0
mov c1,0
;******************
;affichage du reste
;******************
affich0:mov dl,m[si]
add dl,48
cmp dl,48
jne aff
jmp affic
mov dl,10 ;retour a la ligne
mov ah,6
int 21h
mov dl,13 ; debut de la ligne
mov ah,6
int 21h
aff: mov ah,6
int 21h
mov ct,5
jmp j0
affic: cmp ct,5
je aff
j0: inc si
inc cx
cmp cx,4
pushf
jne jo10
cmp ct,0
jne jo10
mov dl,48
mov ah,6
int 21h
jmp t
jo10: popf
js affich0
t: mov dl,10
mov ah,6
int 21h
mov dl,13
mov ah,6
int 21h
mov dx,offset reste
mov ah,09
int 21h
mov si,0 ;affichage du reste
mov cx,0
mov ct,0
affich1:mov dl,k[si]
add dl,48
cmp dl,48
jne af00
jmp af100
af00: mov ah,6
int 21h
mov ct,5
jmp j00
af100: cmp ct,5
je af00
j00: inc si
inc cx
cmp cx,4
pushf
jne jo100
cmp ct,0
jne jo100
mov dl,48
mov ah,6
int 21h
jo100: popf
js affich1
jmp fin
division endp
;**********************
;procedure soustraction
;**********************
soustraction proc far
mov al,x_out[0]
cmp al,x_out[4]
ja positif
jb negatif
mov al,x_out[1]
cmp al,x_out[5]
ja positif
jb negatif
mov al,x_out[2]
cmp al,x_out[6]
ja positif
jb negatif
mov al,x_out[3]
cmp al,x_out[7]
jae positif
negatif:
mov x,10
mov si,0
mov di,4
mov cx,4
boucle:
mov bl,x_out[si]
mov al,x_out[di]
mov m[si],al
mov m[di],bl
inc si
inc di
loop boucle
positif:
mov al,x_out[7]
sub x_out[3],al
pushf
jnc change0
not x_out[3]
add x_out[3],1
mov al,10
sub al,x_out[3]
mov x_out[3],al
change0:
mov al,x_out[6]
popf
sbb x_out[2],al
pushf
jnc change1
not x_out[2]
add x_out[2],1
mov al,10
sub al,m[2]
mov x_out[2],al
change1:
mov al,x_out[5]
popf
sbb x_out[1],al
pushf
jnc change2
not x_out[1]
add x_out[1],1
mov al,10
sub al,x_out[1]
mov x_out[1],al
change2:
mov al,x_out[4]
popf
sbb x_out[0],al
pushf
jnc change3
not x_out[0]
add x_out[0],1
mov al,10
sub al,x_out[0]
mov x_out[0],al
change3:
mov si,0
mov cx,0
popf
jnc change4
change4:
cmp x,10
jne change5
mov dx, offset result
mov ah,09
int 21h
mov dl,45
mov ah,6
int 21h
call affichage
jmp fin
change5:
mov dx,offset result
mov ah,09
int 21h
mov c1,0
call affichage
jmp fin
soustraction endp
;*************************
;Procedure pour l'addition
;*************************
addition proc far
mov al,x_out[7]
add x_out[3],al
mov al,x_out[3]
mov ah,0
mov cl,10
div cl
mov x_out[3],ah
add x_out[2],al
mov al,x_out[6]
add x_out[2],al
mov al,x_out[2]
mov ah,0
mov cl,10
div cl
mov x_out[2],ah
add x_out[1],al
mov al,x_out[5]
add x_out[1],al
mov al,x_out[1]
mov ah,0
mov cl,10
div cl
mov x_out[1],ah
add x_out[0],al
mov al,x_out[4]
add x_out[0],al
mov al,x_out[0]
mov ah,0
mov cl,10
div cl
mov x_out[0],ah
cmp al,1
je dep
jne resl
dep: mov dx,offset depas
mov ah,09
int 21h
mov si,0
mov cx,0
mov c1,0
call affichage
jmp fin
resl:
mov dx,offset result
mov ah,09
int 21h
mov si,0
mov cx,0
mov c1,0
call affichage
jmp fin
addition endp
;******************************
;Procedure de la multiplication
;******************************
multiplication proc far
mov si,4
a:
mov al,x_out[7]
mov bl,x_out[si-1]
mul bl
mov cl,10
div cl
add n[si],ah
add n[si-1],al
dec si
cmp si,0
jne a
mov si,4
b:
mov al,x_out[6]
mov bl,x_out[si-1]
mul bl
mov cl,10
div cl
add m[si],ah
add m[si-1],al
dec si
cmp si,0
jne b
mov si,4
c:
mov al,x_out[5]
mov bl,x_out[si-1]
mul bl
mov cl,10
div cl
add l[si],ah
add l[si-1],al
dec si
cmp si,0
jne c
mov si,4
d:
mov al,x_out[4]
mov bl,x_out[si-1]
mul bl
mov cl,10
div cl
add k[si],ah
add k[si-1],al
dec si
cmp si,0
jne d
mov al,n[4]
add tab3[7],al
mov al,0
add al,n[3]
add al,m[4]
mov ah,0
mov cl,10
div cl
mov tab3[6],ah
add al,n[2]
add al,m[3]
add al,l[4]
mov ah,0
mov cl,10
div cl
mov tab3[5],ah
add al,n[1]
add al,m[2]
add al,l[3]
add al,k[4]
mov ah,0
mov cl,10
div cl
mov tab3[4],ah
add al,n[0]
add al,m[1]
add al,l[2]
add al,k[3]
mov cl,10
mov ah,0
div cl
mov tab3[3],ah
add al,m[0]
add al,l[1]
add al,k[2]
mov cl,10
mov ah,0
div cl
mov tab3[2],ah
add al,l[0]
add al,k[1]
mov cl,10
mov ah,0
div cl
mov tab3[1],ah
add al,k[0]
mov tab3[0],al
mov dx,offset result
mov ah,09
int 21h
mov si,0
mov cx,0
affichage1:
mov dl,tab3[si]
add dl,48
cmp dl,48 ;pour eliminer les zeros
jne e
jmp f
e: mov y,5
mov ah,6
int 21h
jmp comp
f: cmp y,5
je e
comp: inc si
inc cx
cmp cx,8
pushf
jne g
cmp y,0
jne g
mov dl,48
mov ah,6
int 21h
g: popf
js affichage1
jmp fin
multiplication endp
;****************************
;debut de programme principal
;****************************
start: mov ax,@data
mov ds,ax
mov cx,5
bouc1:
mov dl,13 ; debut de la ligne
loop bouc1
mov dx,offset titre
mov ah,9
int 21h
mov dx,offset invite
mov ah,9
int 21h
lea bx,tab1
call lire_4 ;saisie de 1er nbre
cmp tab1[3],1
jne suite1
cmp tab1[2],1
jne suite2
cmp tab1[1],1
jne suite3
mov al,tab1[0]
mov tab1[3],al
mov tab1[0],30h
mov tab1[1],30h
mov tab1[2],30h
jmp suite1
suite3:
mov al,tab1[1]
mov tab1[3],al
mov al,tab1[0]
mov tab1[2],al
mov tab1[0],30h
mov tab1[1],30h
jmp suite1
suite2:
mov al,tab1[2]
mov tab1[3],al
mov al,tab1[1]
mov tab1[2],al
mov al,tab1[0]
mov tab1[1],al
mov tab1[0],48
suite1:
mov dx,offset espace
mov ah,09
int 21h
debut1:
mov dl,255
mov ah,6
int 21h
cmp al,45
je soust
cmp al,43
je addit
cmp al,47
je divvv
cmp al,42
je multi
jmp debut1
soust:
mov dl,45 ;affichage de '-'
mov ah,6
int 21h
mov x,45
jmp application
addit:
mov dl,43 ;affichage de '+'
mov ah,6
int 21h
mov x,43
jmp application
divvv: ;affichage de '/'
mov dl,47
mov ah,6
int 21h
mov x,47
jmp application
multi: ;affichage de '*'
mov dl,42
mov ah,6
int 21h
mov x,42
jmp application
mov dx,offset espace
mov ah,09
int 21h
application:
mov dx,offset espace
mov ah,09
int 21h
lea bx,tab1
add bx,4
call lire_4 ; saisie du nombre 2
cmp tab1[7],1
jne suite4
cmp tab1[6],1
jne suite5
cmp tab1[5],1
jne suite6
mov al,tab1[4]
mov tab1[7],al
mov tab1[4],48
mov tab1[5],48
mov tab1[6],48
jmp suite4
suite6:
mov al,tab1[5]
mov tab1[7],al
mov al,tab1[4]
mov tab1[6],al
mov tab1[4],48
mov tab1[5],48
jmp suite4
suite5:
mov al,tab1[6]
mov tab1[7],al
mov al,tab1[5]
mov tab1[6],al
mov al,tab1[4]
mov tab1[5],al
mov tab1[4],48
suite4:
mov dl,10
mov ah,6
int 21h
mov dl,13
mov ah,6
int 21h
mov si,0 ; convertion de code ascii en decimal
mov cx,8
bouc2: sub tab1[si],48
mov al,tab1[si]
mov x_out[si],al
inc si
loop bouc2
cmp x,45
je sous
cmp x,43
je addi
cmp x,47
je divn
cmp x,42
je multip
addi: call addition
sous: call soustraction
divn: call division
multip: call multiplication
;**********************
;Procedure de la saisie
;**********************
lire_4 proc
push cx
push ax
push dx
mov cx,0
debut:
mov dl,255
mov ah,6
int 21h
jz debut
cmp al,13
je fin1
cmp al,30h
js debut
cmp al,3ah
jns debut
mov [bx],al
inc bx
inc cx
cmp cx,5
jns debut
mov dl,al
mov ah,6
int 21h
jmp debut
fin1: pop dx
pop ax
pop cx
ret
lire_4 endp
fin:
mov dl,10 ;retour . la ligne
mov ah,6
int 21h
mov dl,10 ;retour . la ligne
mov ah,6
int 21h
mov dl,13 ; debut de la ligne
mov ah,6
int 21h
mov dl,10 ;retour . la ligne
mov ah,6
int 21h
mov dl,13 ; debut de la ligne
mov ah,6
int 21h
mov dx,offset revoir
mov ah,9
int 21h
mov dl,10 ;retour . la ligne
mov ah,6
int 21h
mov dl,13 ; debut de la ligne
mov ah,6
int 21h
mov ah,4ch
int 21h
end start
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
IMAGINE CUP 2012, MAKE A SIGN EN FINALEIMAGINE CUP 2012, MAKE A SIGN EN FINALE par junarnoalg
Voilà qui est fait, la nouvelle est officielle ! L'équipe belge "Make a Sign" va au pays des kangourous défendre son projet dans la catégorie Software Design. http://www.imaginecup.com/CompetitionsContent/Competition/WorldwideFinalists.aspx V...
Cliquez pour lire la suite de l'article par junarnoalg KINECT 1.5 IS OUT !KINECT 1.5 IS OUT ! par Vko
La version 1.5 du Kinect For Microsoft vient tout juste de sortir ! Plein de nouveautés: Tracking de squelette en Near Mode Détection en position assise Détection faciale avec un SDK dédié Documentation et des guideline (enfin) Un out...
Cliquez pour lire la suite de l'article par Vko LES ACTUALITéS DE LA SEMAINE SUR C2I.FR (14 MAI - 20 MAI) LES ACTUALITéS DE LA SEMAINE SUR C2I.FR (14 MAI - 20 MAI) par richardc
Mise à jour des Web API du 14 Mai
Réservez dès maintenant votre journée du 20 juin pour le Windows Azure Dev Camp 2012 à Paris
Mise à jour de Team Foundation Service
MechCommander 2 sur Windows 8
Entity Framework 5 Release Candidate e...
Cliquez pour lire la suite de l'article par richardc REACTIVE EXTENSIONS : CONSOMMER DES SERVICES AVEC RX PARTIE 3, LES PIèGES à éVITERREACTIVE EXTENSIONS : CONSOMMER DES SERVICES AVEC RX PARTIE 3, LES PIèGES à éVITER par Groc
Une mauvaise utilisation de rx lors de l'écriture d'une couche d'accès à des services peut conduire à des cas embarassants avec des erreurs mal gérées, des appels qui ne partent lorsqu'ils le devraient, et même des résultats incorrects . le tout nuis...
Cliquez pour lire la suite de l'article par Groc SHAREPOINT BLOG SITE, PROBLèME D'ARCHIVESSHAREPOINT BLOG SITE, PROBLèME D'ARCHIVES par junarnoalg
Dernièrement, nous avons migré le site
myTIC
vers un nouveau serveur SharePoint 2010. Dans les contenus que nous vouloins récupérer, nous avions un certain nombre de blogs.
Nous avons utilisé les commandes Power...
Cliquez pour lire la suite de l'article par junarnoalg
Logiciels
974 Application Server (12.2.4.0)974 APPLICATION SERVER (12.2.4.0)Développez de puissantes applications dans un environnement de 'cloud computing', clusterisé, séc... Cliquez pour télécharger 974 Application Server vPicture (1.4.2.1)VPICTURE (1.4.2.1)Avec vPicture, hébergez vos images facilement et rapidement.
vPicture est un utilitaire simple, ... Cliquez pour télécharger vPicture Easy-Planning (2.2.1.6)EASY-PLANNING (2.2.1.6)Easy-Planning permet de créer des plannings sous la représentation de diagrammes et est adapté au... Cliquez pour télécharger Easy-Planning COM-BACKUP (2.0)COM-BACKUP (2.0)
COM-BACKUP est un logiciel de sauvegarde qui permet de planifier les sauvegardes de vos dossiers ...
Cliquez pour télécharger COM-BACKUP mySongBook Player (1.0.0)MYSONGBOOK PLAYER (1.0.0)mySongBook Player est un logiciel gratuit permettant l'accès à une archive de tablatures/partitio... Cliquez pour télécharger mySongBook Player
|