0

I created this simple addition program in NASMIDE Assembly x86 Intel 8086. I don't really know how to change the code to be able to: ADD two numbers ( 0 - 255 ) from input and print them out. I've been searching for examples of this kind, but I can't find any.

org 100h
;program
mov ah,1 ; READ INTO AL
int 21h
mov dl,al ; DL = CURR AL

mov ah,1 ;READ INTO AL
int 21h


ADD dl,al ; DL = DL + AL
sub dl,48 ; ASCII TO NUMBER
mov ah,2 ; PRINT NUMBER
int 21h

;END
mov eax,4c00h
int 21h
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 1
    pretty much a duplicate of [NASM Assembly convert input to integer?](https://stackoverflow.com/q/19309749) plus [Displaying numbers with DOS](https://stackoverflow.com/q/45904075). 8-bit instead of 16-bit doesn't make anything fundamentally easier or harder; you're still going to want to loop over decimal digits. Or keep decimal digits separate and do extended-precision base 10 like [Adding 2 two-digit numbers that results to a 3-digit in assembly](https://stackoverflow.com/q/11575539), but I don't recommend that – Peter Cordes Mar 28 '20 at 15:16

0 Answers0