Pb tasm

Résolu
ramroume88 Messages postés 6 Date d'inscription   Statut Membre Dernière intervention   -  
ramroume88 Messages postés 6 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

pile segment stack
remplissage dw 256 dup(?)
pile ends
data segment
chaine dw 256 dub(?)
msg1 db "la taille de la chaine est:$"
msg2 db "le nombre de mots est:$"
msg3 db "la taille de mot la plus long est:$"
msg4 db "le nombre de séparateur est:$"
msg5 db "le nombre de repétion de caractére le plus reccurence est:$"
entre dw 10,13,'$'
tch dw ?
nr db ?
nbm dw ?
l dw ?
sep dw ?
cr db ?
data ends
code segment
assume cs:code,ds:data,ss:pile
debut:
affiche_msg macro
mov ah,09h
int 21h
affiche_msg endm
affiche_entier macro
local boucle1,boucle2,termine
mov dx,000beh
push dx
mov bx,10
boucle1:
xor dx,dx
div bx
push dx
or ax,ax
jnz boucle1
boucle2:
pop ax
cmp ax,000beh
je termine
add al,'0'
xchg al,dl
mov ah,02h
int 21h
xchg dl,al
jmp boucle2
termine:
affiche_entier endm
saisir_chaine macro chaine,entre
local lire_chaine,fin_chaine
mov si,offset chaine
lire_caractére:
xor ax,ax
mov ah,1
int 21h
cmp al,'!'
je fin_chaine
mov byte ptr[si],al
inc si
jmp lire_caractére
fin_chaine:
mov dl,offset entre
affiche_msg
saisir_chaine endm
longeur_chaine macro chaine,tch,msg1,entre
local etiquette1,fin_longeur
mov tch,0
mov si,offset chaine
xor ax,ax
etiquette1:
mov al,byte ptr[si]
cmp al,'!'
je fin_longeur
inc tch
inc si
jmp etiquette1
fin_longeur:
mov dl,offset msg1
affiche_msg
mov ax,tch
affiche_entier
mov dl,offset entre
affiche_msg
longeur_chaine endm
nombre_mots macro chaine,tch,nbm,msg2,entre
local condition1,condition2,condition3,condition4,condition5,etiquette2,repete1,manque,complet
mov si,offset chaine
mov nbm,0
xor ax,ax
mov ah,byte ptr[si]
mov al,byte ptr[si+1]
mov cx,tch
dec cx
repete1:
cmp al,' '
je condition1
cmp al,','
je condition1
cmp al,';'
je condition1
cmp al,'.'
je condition1
jmp etiquette2
condition1:
cmp ah,41h
jge condition2
jmp etiquette2
condition2:
cmp ah,5ah
jle condition3
jmp etiquette2
condition3:
cmp ah,61h
jge condition4:
jmp etiquette2
condition4:
cmp ah,7ah
jle condition5
jmp etiquette2
condition5:
inc nbm
etiquette2:
inc al
inc ah
loop repete1
cmp byte ptr[tch-1+si],','
jne manque
cmp byte ptr[tch-1+si],' '
jne manque
cmp byte ptr[tch-1+si],'.'
jne manque
cmp byte ptr[tch-1+si],';'
jne manque
jmp complet
manque:
inc nbm
complet:
xor ax,ax
mov dl,offset msg2
affiche_msg
mov ax,nbm
affiche_entier
mov dl,offset entre
affiche_msg
nombre_mots endm
mots_plus_long macro chaine,tch,l,msg3,entre
local repete12,condition12,condition22,condition32,condition42,condition52,condition62,etiquette3
mov si,offset chaine
xor ax,ax
xor dx,dx
mov al,byte ptr[si]
mov ah,byte ptr[si+1]
mov cx,tch
dec cx
mov l,0
repete12:
cmp al,' '
je condition12
jmp etiquette3
condition12:
cmp ah,41h
jge condition22
jmp etiquette3
condition22:
cmp ah,5ah
jle condition32
jmp etiquette3
condition32:
cmp ah,61h
jge condition42:
jmp etiquette3
condition42:
cmp ah,7ah
jle condition52
jmp etiquette3
condition52:
xor dx,dx
etiquette3:
inc al
inc ah
inc dx
cmp dx,l
jg condition62
loop repete12
condition62:
mov l,dx
loop repete12
xor dx,dx
mov dl,msg3
affiche_msg
mov ax,l
affiche_entier
mov dl,offset entre
affiche_msg
mots_plus_long endm
nombre_separateur macro chaine,tch,sep,msg4,entre
local repete13,condition13,incrementation
mov si,offset chaine
mov sep,0
xor ax,ax
mov cx,tch
repete13:
mov al,byte ptr[si]
cmp al,';'
je condition13
cmp al,' '
je condition13
cmp al,','
je condition13
cmp al,'.'
je condition13
jmp incrementation
condition13:
inc sep
incrementation:
inc si
loop repete13
mov dl,offset msg5
affiche_msg
mov ax,sep
affiche_entier
mov dl,offset entre
affiche_msg
nombre_separateur endm
caractére_réccurent macro chaine,tch,cr,nr,msg5,entre
local repete14,repete24,méme,défferent,affecter
mov si,offset chaine
xor bx,bx
mov nr,0
mov cx,tch
dec cx
mov dx,si
add dx,cx
repete14:
mov ax,si
mov bl,byte ptr[si]
mov bh,0
inc si
repete24:
cmp byte ptr[si],bl
je méme
jmp défferent
méme:
inc bh
défferent:
inc si
cmp si,dx
jg repete24
inc ax
cmp bh,nr
jg affecter
loop repete14
affecter:
mov nr,bh
mov cr,bl
loop repete14
xor ax,ax
mov dl,offset msg4
affiche_msg
xor dx,dx
mov dl,cr
mov ah,2
int 21h
mov dl,offset entre
affiche_msg
caractére_réccurent endm
mov ax,data
mov ds,ax
mov ax,pile
mov ss,ax
saisir_chaine chaine,entre
longeur_chaine chaine,tch,msg1,entre
nombre_mots chaine,tch,nbm,msg2,entre
mots_plus_long chaine,tch,l,msg3,entre
nombre_separateur chaine,tch,sep,msg4,entre
caractére_réccurent chaine,tch,cr,nr,msg5,entre
mov ax,4c00h
int 21h
code ends
end debut

3 réponses

choubaka Messages postés 39442 Date d'inscription   Statut Modérateur Dernière intervention   2 105
 
Salut

C'est quoi le problème ?
0
ramroume88 Messages postés 6 Date d'inscription   Statut Membre Dernière intervention  
 
le prog donne des fausse résulta pourtant j ai le réviser plusieur fois
0
ramroume88 Messages postés 6 Date d'inscription   Statut Membre Dernière intervention  
 
c'est la correction pour se sujet



pile segment stack
remplissage dw 256 dup(?)
pile ends
data segment
chaine dw 256 dup(?)
msg db " faite un ecart entre la chaine est les autres données $"
msg2 db "le nombre des mots est:$"
msg1 db "la taille de la chaine est:",'$'
msg3 db "la taille de mot le plus long est:$"
msg4 db "le nombre des separateurs est:$"
msg5 db "le nombre de repetion de caractere le plus recurrent est:$"
msg6 db "le mot le plus long est:$"
msg7 db "le nombre de répition de caractére est:$"
entre db 10,13,'$'
tch dw ?
nr dw ?
nbm dw ?
l dw ?
sep dw ?
cr db ?
data ends
code segment
assume cs:code,ds:data,ss:pile
debut:
affiche_msg macro
mov ah,09h
int 21h
affiche_msg endm
affiche_entier macro
local boucle1,boucle2,termine
mov dx,'a'
push dx
mov bx,10
boucle1:
xor dx,dx
div bx
push dx
or ax,ax
jnz boucle1
boucle2:
pop ax
cmp ax,'a'
je termine
add al,'0'
xchg al,dl
mov ah,02h
int 21h
xchg dl,al
jmp boucle2
termine:
affiche_entier endm
saisir_chaine macro chaine,entre
local lire_chaine,fin_chaine
mov si,offset chaine
lire_caractére:
xor ax,ax
mov ah,1
int 21h
cmp al,'!'
je fin_chaine
mov byte ptr[si],al
inc si
jmp lire_caractére
fin_chaine:
mov dx,offset entre
affiche_msg
saisir_chaine endm
longeur_chaine macro chaine,tch,msg1,entre
local etiquette1,fin_longeur
mov tch,si
mov dx,offset msg1
affiche_msg
mov ax,tch
affiche_entier
mov dx,offset entre
affiche_msg
longeur_chaine endm
nombre_mots macro chaine,tch,nbm,msg2,entre
local condition1,condition2,condition4,condition5,etiquette2,repete1,complet
mov si,offset chaine
mov nbm,0
mov cx,tch
dec cx
repete1:
mov al,byte ptr[si]
mov ah,byte ptr[si+1]
cmp al,' '
je condition1
cmp al,':'
je condition1
cmp al,','
je condition1
cmp al,';'
je condition1
cmp al,'.'
je condition1
jmp etiquette2
condition1:
cmp ah,'A'
jge condition2
jmp etiquette2
condition2:
cmp ah,'Z'
jle condition5
cmp ah,'a'
jge condition4:
jmp etiquette2
condition4:
cmp ah,'z'
jle condition5
jmp etiquette2
condition5:
inc nbm
etiquette2:
inc si
cmp si,cx
jl repete1
mov si,offset chaine
cmp byte ptr[si],':'
je complet
cmp byte ptr[si],','
je complet
cmp byte ptr[si],' '
je complet
cmp byte ptr[si],'.'
je complet
cmp byte ptr[si],';'
je complet
inc nbm
complet:
mov dx,offset msg2
affiche_msg
mov ax,nbm
affiche_entier
mov dx,offset entre
affiche_msg
nombre_mots endm
affiche_mots_plus_long macro chaine,tch,l,msg3,entre,msg6
local repete12,repete13,condition11,condition12,condition14,condition15,condition16,condition22,,etiquette3
mov si,offset chaine
xor dx,dx
mov l,0
repete12:
mov bh,byte ptr[si]
mov bl,byte ptr[si+1]
cmp bh,'A'
jge condition11
jmp etiquette3
condition11:
cmp bh,'Z'
jle condition22
cmp bh,'a'
jge condition12:
jmp etiquette3
condition12:
cmp bh,'z'
jle condition22
jmp etiquette3
condition22:
inc dx
cmp dx,l
jg condition14
jmp condition15
condition14:
mov l,dx
mov ax,si
condition15:
cmp bl,':'
je condition16
cmp bl,' '
je condition16
cmp bl,','
je condition16
cmp bl,';'
je condition16
cmp bl,'.'
je condition16
jmp etiquette3
condition16:
xor dx,dx
etiquette3:
inc si
cmp si,tch
jl repete12
mov si,ax
mov dx,offset msg3
affiche_msg
mov ax,l
affiche_entier
mov dx,offset entre
affiche_msg
mov dx,offset msg6
affiche_msg
mov cx,si
sub si,l
inc si
repete13:
mov dl,byte ptr[si]
mov ah,2
int 21h
inc si
cmp si,cx
jle repete13
mov dx,offset entre
affiche_msg
affiche_mots_plus_long endm
nombre_separateur macro chaine,tch,sep,msg4,entre
local repete33,conditionsp,incrementation
mov si,offset chaine
mov sep,0
xor ax,ax
mov cx,tch
dec cx
repete33:
mov al,byte ptr[si]
cmp al,';'
je conditionsp
cmp al,' '
je conditionsp
cmp al,','
je conditionsp
cmp al,'.'
je conditionsp
cmp al,':'
je conditionsp
jmp incrementation
conditionsp:
inc sep
incrementation:
inc si
cmp si,cx
jle repete33
mov dx,offset msg4
affiche_msg
mov ax,sep
affiche_entier
mov dx,offset entre
affiche_msg
nombre_separateur endm
caractére_réccurent macro chaine,tch,cr,nr,msg5,entre,msg7
local repete14,repete24,méme,défferent,affecter,cor
mov si,offset chaine
xor bx,bx
mov nr,0
mov ax,si
mov dx,si
add dx,tch
dec dx
repete14:
mov si,ax
mov bl,byte ptr[si]
mov cx,1
inc si
repete24:
cmp byte ptr[si],bl
je méme
jmp défferent
méme:
inc cx
défferent:
inc si
cmp si,dx
jle repete24
inc ax
cmp cx,nr
jg affecter
jmp cor
affecter:
mov nr,cx
mov cr,bl
cor:
cmp ax,dx
jle repete14
xor ax,ax
mov dx,offset msg5
affiche_msg
xor dx,dx
mov dl,cr
mov ah,2
int 21h
mov dx,offset entre
affiche_msg
mov dx,offset msg7
affiche_msg
mov ax,nr
affiche_entier
caractére_réccurent endm
mov ax,data
mov ds,ax
mov ax,pile
mov ss,ax
saisir_chaine chaine,entre
longeur_chaine chaine,tch,msg1,entre
nombre_mots chaine,tch,nbm,msg2,entre
affiche_mots_plus_long chaine,tch,l,msg3,entre,msg6
nombre_separateur chaine,tch,sep,msg4,entre
caractére_réccurent chaine,tch,cr,nr,msg5,entre,msg7
mov ax,4c00h
int 21h
code ends
end debut
0