Probleme de programmation en assembleur 8086

lovelygirl88 Messages postés 2 Date d'inscription jeudi 12 février 2009 Statut Membre Dernière intervention 13 février 2009 - 12 févr. 2009 à 22:17
42wawa42 Messages postés 143 Date d'inscription dimanche 28 septembre 2003 Statut Membre Dernière intervention 6 septembre 2011 - 14 févr. 2009 à 18:21
slt tous le monde,
je suis debutante en assembleur 8086 et j'ai besoin d'un programme qui fait l'addition de deux nombres,
est ce que qulequ'un peut m'aider svp ?!
et merci d'avance !
sarah;

4 réponses

42wawa42 Messages postés 143 Date d'inscription dimanche 28 septembre 2003 Statut Membre Dernière intervention 6 septembre 2011
13 févr. 2009 à 00:39
Hello
bin voila
d'un programme qui fait l'addition de deux nombres
.data
var1 DWORD 1000h
var2 DWORD 2000h
.code
mov eax,var1
add eax,var2            ;eax = 3000h

pour info:
"add"> Add two numbers
  Syntax: add dest, src 
  dest: register or memory
  src: register, memory, or immediate
  Action: dest = dest + src
  Flags Affected: OF, SF, ZF, AF, PF, CF
  Notes: Works for both signed and unsigned numbers.

A plus
42wawa42
0
lovelygirl88 Messages postés 2 Date d'inscription jeudi 12 février 2009 Statut Membre Dernière intervention 13 février 2009
13 févr. 2009 à 09:37
merci mais ca marche pas chez moi,  
en+ les deux nombres seront entrés par l'utilisateur
voilà mon code mais ca marche pas pour les nombres > 10

mov ah,01
int 21h
mov a,al



printn



mov ah,01
int 21h


add al,a
sub al,048
printn

mov dl,al
mov ah,02
int 21h
0
42wawa42 Messages postés 143 Date d'inscription dimanche 28 septembre 2003 Statut Membre Dernière intervention 6 septembre 2011
14 févr. 2009 à 18:07
;Prog avec MASM 6.XX

Name add_com.asm
; Masm produit un fichier add_com.com avec /Fl tu as un fichier add_com.lst
; Ml /Fl add_com.asm

; Pour debug les commandes sont dans la ligne pour debug help "?"

; add de valeur comme 5 + 9 = 14

_Test Segment
Assume CS:_Test,DS:_Test,SS:_Test,ES:_Test
ORG 100h
;Debug add_com.com

_Prog: JMP Debut ;T
Var1 db 0h
Var2 db 0h
Dollar db 24h
Espace db 20H
Plus db 2BH
Egal db 3DH


Debut:
mov ah,01H ;T
int 21h ;P introduir nombre

sub al,30H ;T
mov Var1,al ;T

mov dl,Espace ;T
call Printn ;T

mov dl,Plus ;T
call Printn ;P

mov dl,Espace ;T
call Printn ;P

mov ah,01H ;T
int 21h ;P introduir nombre

sub al,30H ;T
mov Var2,al ;T

mov dl,Espace ;T
call Printn ;P

mov dl,Egal ;T
call Printn ;P

mov dl,Espace ;T
call Printn ;P

mov al,Var1 ;T
add al,Var2 ;T

mov ah,00h ;T
aaa ;T
or ax,3030h ;T
mov var1,ah ;T
mov var2,al ;T

mov dx,offset Var1 ;T
mov ah,09H ;T
int 21H ;T


Exit: mov ax,4C00H ;T
int 21H ;P


Printn:
mov ah,02h ;T
int 21H ;P
ret ;T

_Test ENDS
END _Prog



Voila une solution a la question.
A plus
42wawa42
0
42wawa42 Messages postés 143 Date d'inscription dimanche 28 septembre 2003 Statut Membre Dernière intervention 6 septembre 2011
14 févr. 2009 à 18:21
La présentation du texte est moins que zéro. Editeur du site n'est pas fais pour envoyer des bouts de programme mais seulement du bla a bla.

Mille excuse pour leurs problème.

42wawa42
0
Rejoignez-nous