Tp assembleur i3 pour la FST

babbiverus Messages postés 1 Date d'inscription vendredi 14 novembre 2008 Statut Membre Dernière intervention 14 novembre 2008 - 14 nov. 2008 à 16:58
cs_phlyper Messages postés 8 Date d'inscription mercredi 30 janvier 2008 Statut Membre Dernière intervention 21 janvier 2016 - 25 nov. 2010 à 12:58
main proc
mov ax,@Data
mov ds, ax
mov si,offset tab
mov cx, 16
mov bx,0
saisie:  
mov dx,offset commande;afficher "saisir un nombre"
mov ah,9
int 21h
mov ah, 1;saisie d'un élément
int 21h
mov BYTE PTR[si], al
cmp al,35;comparaison avec le caractère"#"
JE affiche;jump si égalisation
add si,type word ;incrémeter 'indice'
inc bx
loop saisie
Jmp affiche;appeller l'étiquette 'affiche'
affiche:mov dx,offset msg
    mov ah,9
    int 21h
    mov ax,bx ;instructions de l'étiquette 'affiche'
    mov dl, al
    Add dl, 48;instructions utilisés pour faire l'affichage de l'indice
    mov ah, 2;
    int 21h;l'affichage de la taille
    
etap1:  mov si,offset tab
    mov cx,bx
    
parcours:mov ax,word PTR [si]
     cmp ax,48
     je Nul
       shr ax,1
     Ja paire        
         Jb  impaire
         
Nul:      mov al,BYTE PTR [ax]
    mov dl,al  ;affichage de l'indice de l'élément null
    Add dl, 48
    mov ah, 2
    int 21h
    mov dx,offset nb_nul
    mov ah,9
    int 21h
    mov ax,bx
    sub ax,cx
    mov dl,al
    mov ah,2
    int 21h
    add si,2
    loop parcours
jmp Fin
paire: mov s,ax
    mov dx,offset pair
    mov ah,9
    int  21h
    mov ax,s
    shl ax,1
    mul word PTR[si]
    mov dl,al
    Add dl, 48
    mov ah, 2
    int 21h
    add si,2
    inc nb_pair
    loop parcours
jmp Fin

impaire: mov ax,[si]
    Add ax, 1
    mov s,ax
    mov dx,offset impair
    mov ah,9
    int 21h
    mov ax,s
    mov dl,al
    add dl,48
    mov ah, 2
    int 21h
    inc nb_imp
    add si,2
    loop parcours

fin:
mov ah, 4ch
int 21h

main endp

end main;fin du programme

3 réponses

BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
15 nov. 2008 à 19:15
ET ALORS ???

ciao...
BruNews, MVP VC++
0
Forthman Messages postés 23 Date d'inscription samedi 25 décembre 2004 Statut Membre Dernière intervention 9 janvier 2014
17 nov. 2008 à 06:24
C'est incroyable la quantité d'étudiants qui ont cet exercice à faire...
Et c'est encore plus incroyable qu'aucun ne sache le résoudre !

a+ François (qui aimerai bien lire de vraies questions intéressantes )
0
cs_phlyper Messages postés 8 Date d'inscription mercredi 30 janvier 2008 Statut Membre Dernière intervention 21 janvier 2016
25 nov. 2010 à 12:58
jamais trouve une solution
0
Rejoignez-nous