2017-01-30 1 views
0
  1. Si vous tapez sur le clavier 3, il sera 3 + et tapez un autre numéro 3, il sera 3 = 3 + 3 = 6 Je suis nouveau dans ce sujet et il est très difficile pour moi de comprendre cela s'il vous plaît aidez-moi et merci à l'avance

21H/0AH données -> AL 1er registre
2ème registre Alprogramme emu8086- ajouter deux nombres et la sortie affiche

Ajouter 1er registre, 2e registre registre Al Imprimer

Répondre

1
mov ah, 09h 
mov dx, enterfnstr 
int 21h 
mov ah, 01h 
int 21h 
mov bl, al 
sub bl, 30h 
mov ah, 09h 
mov dx, entersnstr 
int 21h 
mov ah,01h 
int 21h 
sub al, 30h 
add al, bl 
aaa 
dec ah 
mov bh, ah 
add bh, 30h 
add al, 30h 
mov bl, al 
mov ah, 09h 
mov dx, sum 
int 21h 
mov ah, 02h 
mov dl, bh 
int 21h 
mov ah, 02h 
mov dl, bl 
int 21h 
mov ah, 0 
int 16h 
+0

S'il vous plaît corriger cette petite erreur: 'mov dh, bh' Vous voulez déplacer' bh' dans 'DL'. – Fifoernik

+0

Merci pour l'édition. +1 – Fifoernik

+0

+ Fifoernik, vous êtes les bienvenus –

0

; Vous pouvez personnaliser ceci et d'autres modèles de démarrage; ; L'emplacement de ce modèle est c: \ EMU8086 \ inc \ 0_com_template.txt

org 100h

mov ah,1h     ;read the character ,input stored in al 
int 21h 

len equ 32   
mov bl,al     ;bl stores first input 

mov al,'+'     ;print the character 
mov ah,0eh 
int 10h 

mov ah,1h     ;read the character ,input stored in al 
int 21h 

mov cl,al     ;cl another reg 

mov dl,bl     ;moving the value of bl to dl 
mov ah,2h 

mov dl,cl     ;moving the value of cl to dl 
mov ah,2h 

mov al,'='     ;print the character 
mov ah,0eh 
int 10h 

sub bl,30h     ;converted first to decimal 
sub cl,30h 

add bl,cl 

add bl,30h 

mov dl,bl     ;print the character 
mov ah,2h 
int 21h 

ret

+0

Pourquoi les 2 instructions 'mov ah, 2h' au milieu de votre code (lignes 17 et 20)? Ils ne font rien d'utile! – Fifoernik