Assembleur 8086
Résolu/Fermé
karim66
Messages postés
24
Date d'inscription
jeudi 8 mai 2008
Statut
Membre
Dernière intervention
8 mai 2009
-
8 mai 2008 à 13:07
nom - 27 déc. 2017 à 14:56
nom - 27 déc. 2017 à 14:56
8 réponses
karim66
Messages postés
24
Date d'inscription
jeudi 8 mai 2008
Statut
Membre
Dernière intervention
8 mai 2009
5
11 mai 2008 à 18:43
11 mai 2008 à 18:43
cé bon les amateurs jé pu trouvé mn programme. le voila pour celui ki ont aura besoin.
TITLE conversion de nombres
org 100h
jmp debut
result db 16 dup('?'),'b'
msg1 db "Veuillez saisir un nombre,SVP : $", 0Dh,0Ah
msg2 db 0Dh,0Ah, "Le nombre en binaire est: $"
msg3 db 0Dh,0Ah, "Le nombre en hexadecimal est : $"
msg4 db 0Dh,0Ah, "Le nombre en octal est: $"
debut:
;conversion binaire.
mov dx, offset msg1
mov ah, 9
int 21h
call scan_num
mov bx, cx
call convert_to_bin
mov dx, offset msg2
mov ah, 9
int 21h
mov si, offset result
mov ah, 0eh
mov cx, 17
print_me:
mov al, [si]
int 10h
inc si
loop print_me
;conversion hexadecimal
mov dx, offset msg3
mov ah, 9
int 21h
debut1: mov ax,bx
call affichHexa
int 20h
;conversion octal.
debut2: mov dx, offset msg4
mov ah, 9
int 21h
mov ax,bx
call affichOcta
int 20h
; procedure de conversion au binaire.
convert_to_bin proc near
pusha
lea di, result
mov cx, 16
print: mov ah, 2
mov [di], '0'
test bx, 1000_0000_0000_0000b
jz zero
mov [di], '1'
zero: shl bx, 1
inc di
loop print
popa
ret
convert_to_bin endp
putc macro char
push ax
mov al, char
mov ah, 0eh
int 10h
pop ax
endm
scan_num proc near
push dx
push ax
push si
mov cx, 0
mov cs:make_minus, 0
next_digit:
mov ah, 00h
int 16h
mov ah, 0eh
int 10h
cmp al, '-'
je set_minus
cmp al, 13
jne not_cr
jmp stop_input
not_cr:
cmp al, 8
jne backspace_checked
mov dx, 0
mov ax, cx
div cs:ten
mov cx, ax
putc ' '
putc 8
jmp next_digit
backspace_checked:
cmp al, '0'
jae ok_ae_0
jmp remove_not_digit
ok_ae_0:
cmp al, '9'
jbe ok_digit
remove_not_digit:
putc 8
putc ' '
putc 8
jmp next_digit
ok_digit:
push ax
mov ax, cx
mul cs:ten
mov cx, ax
pop ax
cmp dx, 0
jne too_big
sub al, 30h
mov ah, 0
mov dx, cx
add cx, ax
jc too_big2
jmp next_digit
set_minus:
mov cs:make_minus, 1
jmp next_digit
too_big2:
mov cx, dx
mov dx, 0
too_big:
mov ax, cx
div cs:ten
mov cx, ax
putc 8
putc ' '
putc 8
jmp next_digit
stop_input:
cmp cs:make_minus, 0
je not_minus
neg cx
not_minus:
pop si
pop ax
pop dx
ret
make_minus db ?
ten dw 10
scan_num endp
;fin de la conversion decimal binaire.
;procedure de conversion au hexadecimal.
start1: jmp debut1
affich1 proc near
push ax
push dx
cmp al,10
jb w4chiffre
add al,"a"-10
jmp w4affiche
w4chiffre: add al,"0"
w4affiche: mov dl,al
mov ah,2
int 21h
pop dx
pop ax
ret
affich1 endp
affichHexa proc near
push ax
push bx
push cx
mov bx,ax
and ax,0F000h
mov cl,12
shr ax,cl
call affich1
mov ax,bx
and ax,0F00h
mov cl,8
shr ax,cl
call affich1
mov ax,bx
and ax,00F0h
mov cl,4
shr ax,cl
call affich1
mov ax,bx
and ax,000Fh
call affich1
pop cx
pop bx
pop ax
mov al, 'h'
mov ah, 0eh
int 10h
affichHexa endp
; fin de la conversion decimal hexadecimal.
; conversion de nombre au octal.
start2: jmp debut2
affich2 proc near
push ax
push dx
add al,"0"
mov dl,al
mov ah,2
int 21h
pop dx
pop ax
ret
affich2 endp
affichOcta proc near
push ax
push bx
push cx
mov bx,ax
and ax,8000h
mov cl,15
shr ax,cl
call affich2
mov ax,bx
and ax,7000h
mov cl,12
shr ax,cl
call affich2
mov ax,bx
and ax,0E00h
mov cl,9
shr ax,cl
call affich2
mov ax,bx
and ax,01C0h
mov cl,6
shr ax,cl
call affich2
mov ax,bx
and ax,0038h
mov cl,3
shr ax,cl
call affich2
mov ax,bx
and ax,0007h
call affich2
pop cx
pop bx
pop ax
;attent de sorti ou dos
mov al, 'o'
mov ah, 0eh
int 10h
mov ah, 0
int 16h
ret
affichOcta endp
;fin de la procedure de conversion en octal.
;fin de programme
TITLE conversion de nombres
org 100h
jmp debut
result db 16 dup('?'),'b'
msg1 db "Veuillez saisir un nombre,SVP : $", 0Dh,0Ah
msg2 db 0Dh,0Ah, "Le nombre en binaire est: $"
msg3 db 0Dh,0Ah, "Le nombre en hexadecimal est : $"
msg4 db 0Dh,0Ah, "Le nombre en octal est: $"
debut:
;conversion binaire.
mov dx, offset msg1
mov ah, 9
int 21h
call scan_num
mov bx, cx
call convert_to_bin
mov dx, offset msg2
mov ah, 9
int 21h
mov si, offset result
mov ah, 0eh
mov cx, 17
print_me:
mov al, [si]
int 10h
inc si
loop print_me
;conversion hexadecimal
mov dx, offset msg3
mov ah, 9
int 21h
debut1: mov ax,bx
call affichHexa
int 20h
;conversion octal.
debut2: mov dx, offset msg4
mov ah, 9
int 21h
mov ax,bx
call affichOcta
int 20h
; procedure de conversion au binaire.
convert_to_bin proc near
pusha
lea di, result
mov cx, 16
print: mov ah, 2
mov [di], '0'
test bx, 1000_0000_0000_0000b
jz zero
mov [di], '1'
zero: shl bx, 1
inc di
loop print
popa
ret
convert_to_bin endp
putc macro char
push ax
mov al, char
mov ah, 0eh
int 10h
pop ax
endm
scan_num proc near
push dx
push ax
push si
mov cx, 0
mov cs:make_minus, 0
next_digit:
mov ah, 00h
int 16h
mov ah, 0eh
int 10h
cmp al, '-'
je set_minus
cmp al, 13
jne not_cr
jmp stop_input
not_cr:
cmp al, 8
jne backspace_checked
mov dx, 0
mov ax, cx
div cs:ten
mov cx, ax
putc ' '
putc 8
jmp next_digit
backspace_checked:
cmp al, '0'
jae ok_ae_0
jmp remove_not_digit
ok_ae_0:
cmp al, '9'
jbe ok_digit
remove_not_digit:
putc 8
putc ' '
putc 8
jmp next_digit
ok_digit:
push ax
mov ax, cx
mul cs:ten
mov cx, ax
pop ax
cmp dx, 0
jne too_big
sub al, 30h
mov ah, 0
mov dx, cx
add cx, ax
jc too_big2
jmp next_digit
set_minus:
mov cs:make_minus, 1
jmp next_digit
too_big2:
mov cx, dx
mov dx, 0
too_big:
mov ax, cx
div cs:ten
mov cx, ax
putc 8
putc ' '
putc 8
jmp next_digit
stop_input:
cmp cs:make_minus, 0
je not_minus
neg cx
not_minus:
pop si
pop ax
pop dx
ret
make_minus db ?
ten dw 10
scan_num endp
;fin de la conversion decimal binaire.
;procedure de conversion au hexadecimal.
start1: jmp debut1
affich1 proc near
push ax
push dx
cmp al,10
jb w4chiffre
add al,"a"-10
jmp w4affiche
w4chiffre: add al,"0"
w4affiche: mov dl,al
mov ah,2
int 21h
pop dx
pop ax
ret
affich1 endp
affichHexa proc near
push ax
push bx
push cx
mov bx,ax
and ax,0F000h
mov cl,12
shr ax,cl
call affich1
mov ax,bx
and ax,0F00h
mov cl,8
shr ax,cl
call affich1
mov ax,bx
and ax,00F0h
mov cl,4
shr ax,cl
call affich1
mov ax,bx
and ax,000Fh
call affich1
pop cx
pop bx
pop ax
mov al, 'h'
mov ah, 0eh
int 10h
affichHexa endp
; fin de la conversion decimal hexadecimal.
; conversion de nombre au octal.
start2: jmp debut2
affich2 proc near
push ax
push dx
add al,"0"
mov dl,al
mov ah,2
int 21h
pop dx
pop ax
ret
affich2 endp
affichOcta proc near
push ax
push bx
push cx
mov bx,ax
and ax,8000h
mov cl,15
shr ax,cl
call affich2
mov ax,bx
and ax,7000h
mov cl,12
shr ax,cl
call affich2
mov ax,bx
and ax,0E00h
mov cl,9
shr ax,cl
call affich2
mov ax,bx
and ax,01C0h
mov cl,6
shr ax,cl
call affich2
mov ax,bx
and ax,0038h
mov cl,3
shr ax,cl
call affich2
mov ax,bx
and ax,0007h
call affich2
pop cx
pop bx
pop ax
;attent de sorti ou dos
mov al, 'o'
mov ah, 0eh
int 10h
mov ah, 0
int 16h
ret
affichOcta endp
;fin de la procedure de conversion en octal.
;fin de programme
karim66
Messages postés
24
Date d'inscription
jeudi 8 mai 2008
Statut
Membre
Dernière intervention
8 mai 2009
5
8 mai 2008 à 13:34
8 mai 2008 à 13:34
l'assembleur est obligé oui.je voudré le programme écrit en assembleur.cé pour mon tp.
Salut,
Je ne pense pas qu'on doit la pour faire des devoirs lol
Si tu veux un cours de rattrapage sur l'assembleur, va voir ces cours gratuits en Français sur l'assembleur
Je ne pense pas qu'on doit la pour faire des devoirs lol
Si tu veux un cours de rattrapage sur l'assembleur, va voir ces cours gratuits en Français sur l'assembleur
karim66
Messages postés
24
Date d'inscription
jeudi 8 mai 2008
Statut
Membre
Dernière intervention
8 mai 2009
5
9 mai 2008 à 12:59
9 mai 2008 à 12:59
alor comme ça ya personne ki si conné en assembleur.?
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
karim66
Messages postés
24
Date d'inscription
jeudi 8 mai 2008
Statut
Membre
Dernière intervention
8 mai 2009
5
11 mai 2008 à 00:40
11 mai 2008 à 00:40
merci jenifer.
salut svp aider moi a resoudre ce probleme :
ecrire un programme assembleur(masm) qui realise :
etape 1 : saisie d'une suite de nbres a stocker dans un tableau . le nbre max de nbres que l'on peut saisir est de 16 (on peut saisir moins de 16 nbres) la saisie doit s'arreter a la rencontre du #
etape 2 :
afficher la taille du tableau
si un nbre du tableau est pair on calcule son carré puis on affiche le nbre et son carre
si un nbre du tableau est impair on lui rajoute la valeur 1 puis on affiche l'ancien et le nouveau nbre
si un nbre du tableau est nul on affiche l'indice du tableau contenant cette valeur nulle
afficher le nbre de pairs , impairs et nuls .
ecrire un programme assembleur(masm) qui realise :
etape 1 : saisie d'une suite de nbres a stocker dans un tableau . le nbre max de nbres que l'on peut saisir est de 16 (on peut saisir moins de 16 nbres) la saisie doit s'arreter a la rencontre du #
etape 2 :
afficher la taille du tableau
si un nbre du tableau est pair on calcule son carré puis on affiche le nbre et son carre
si un nbre du tableau est impair on lui rajoute la valeur 1 puis on affiche l'ancien et le nouveau nbre
si un nbre du tableau est nul on affiche l'indice du tableau contenant cette valeur nulle
afficher le nbre de pairs , impairs et nuls .
karim66
Messages postés
24
Date d'inscription
jeudi 8 mai 2008
Statut
Membre
Dernière intervention
8 mai 2009
5
7 nov. 2008 à 11:15
7 nov. 2008 à 11:15
cé pas gagné faut te cassé 1 peu la téte ma vielle.
jé eu le meme probléme et jé trouvé la solution tt seul en travaillant 1pe.lol.
jé eu le meme probléme et jé trouvé la solution tt seul en travaillant 1pe.lol.
27 déc. 2017 à 14:56