Convert numbers to decimal in assembly8086

Asked

Viewed 28 times

1

Guys I’m trying to develop a adding calculator in assembly8086 only I’m not able to convert the numbers into sums above 10, if adding 4+5=9 works perfect now if I add 8+2=10 it didn’t display the result 10 instead displayed only two point ":".

org 100h     

.MODEL small

.STACK 512d

.DATE

mensagem1 db "Digite o primeiro numero: $"
mensagem2 db " Digite o segunndo numero: $"

mensagem3 db " A Soma e: $"

valor1 db ? ; message valor2 db ? ; message

.CODE

  lea dx, mensagem1
  mov ah, 09h
  int 21h

    mov ah, 01h
    int 21h

    mov bl, al

    mov valor1, bl

  lea dx, mensagem2
  mov ah, 09h
  int 21h 

    mov ah, 01h
    int 21h
      mov bl, al
    mov valor2, bl

  mov dx, offset mensagem3
  mov ah, 9
  int 21h

  mov dh, valor1
  add dh, valor2

aam             ;
                ; Convertendo para decimal o resultado
sub dh, 30h   ; 



mov dl,dh
mov ah, 02h
int 21h

ret

Somebody give me a hand I appreciate.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.