Tasm

yosrasouaifi Messages postés 16 Date d'inscription lundi 3 octobre 2011 Statut Membre Dernière intervention 28 décembre 2011 - 8 nov. 2011 à 21:18
yosrasouaifi Messages postés 16 Date d'inscription lundi 3 octobre 2011 Statut Membre Dernière intervention 28 décembre 2011 - 8 nov. 2011 à 21:26
DOSSEG ;Modele de segmentation DOS
.MODEL SMALL ;Fixe le modele de segmentation :petit modele


.STACK 100h

.DATA
message DB 13,10,"Entrez une chaine de caracteres : $"
chaine DB 255,256 Dup(32)\tab \tab \tab \tab ; chaîne de 14 caractères maximum
new_line DB 13,10,"$"\tab \tab \tab \tab ; chaîne permettant le retour à la ligne
S2 db’ enter the string’,‘$’
S3 db’ Length of the string’,’$’

.CODE
;Initialisation du registre DS
MOV AX, @DATA
MOV DS,AX
;****************ICI COMMENCE VOTRE TRAITEMENT****************


MOV AH,09H\tab \tab \tab \tab \tab ; affichage de la chaîne message
MOV DX,OFFSET Message
INT 21H

MOV AH,0CH\tab \tab \tab \tab \tab ; saisie de la chaîne
MOV AL,0AH
MOV DX,OFFSET chaine
INT 21H

MOV AL,chaine+1\tab \tab \tab \tab ; ajout du caractère
MOV AH,0\tab \tab \tab \tab \tab ; \lquote $\rquote en fin de
MOV SI,AX\tab \tab \tab \tab \tab ; la chaîne
ADD SI,2\tab \tab \tab \tab \tab ; pour
MOV BYTE PTR [chaine+SI],'$'\tab \tab ; l\rquote affichage

MOV CX,0
MOV CL,chaine+1

MOV BX,0
MOV SI,2

MOV AH,09\tab \tab \tab \tab \tab ; affichage de la chaîne new_line
MOV DX,OFFSET new_line
INT 21H

DEBUT:
MOV BL,[chaine+SI]
SI_1:
CMP BL,'a'\tab \tab \tab \tab \tab ; contrôle si le caractère est >= \lquote a\rquote
JB FSI_1
ETSI_1:
CMP BL,'z'\tab \tab \tab \tab \tab ; contrôle si le caractère est <= \lquote z\rquote
JA FSI_1
ALORS_1:
SUB BL,32\tab \tab \tab \tab \tab ; on soustrait 32 au caractère
MOV [chaine+SI],BL\tab \tab ; on range le caractère obtenu dans la chaîne
FSI_1:

INC SI
LOOP DEBUT
;******* affiche majuscule *********

MOV AH,09H\tab \tab \tab \tab \tab ; affichage de la chaîne modifiée
MOV DX,OFFSET chaine+2
INT 21H
;*********affiche dans le sens inverse*******
MOV BX,0
MOV BL,OFFSET chaine\tab \tab ; range dans BX l\rquote adresse de la chaîne

DEBUT1:
MOV DL,[BX]\tab \tab \tab \tab ; affiche le caractère courant
MOV AH,02H
INT 21H
INC BX
LOOP DEBUT1
;************taille de chaine ***********


Mov ah, 09H
Lea dx, S2
Int 21h
Mov ah, 0ah
Lea dx, S3
Int 21h
Mov ah, 02h
Mov dl, chaine
Or dl, 30h
Int 21h
; *********************calcul nbr mot*************************???
;**********************calcul nbr espace *********************???
;**********************ICI IL FINIT***************************


MOV AX,4C00H
INT 21H

END

1 réponse

yosrasouaifi Messages postés 16 Date d'inscription lundi 3 octobre 2011 Statut Membre Dernière intervention 28 décembre 2011
8 nov. 2011 à 21:26
affiche majuscule <=
.;****** affiche inverse chaine***
0
Rejoignez-nous