0

i am new to assembly i am writing a program to add two numbers and then move the answer to the the memory veritable i toked and displaying it on screen in emu8086

this is my code

org 100h

 ans dw ?,"$"

 mov ax,23
 mov bx,23
 add ax,bx   
 mov ans,ax
 mov ah,09h
 mov dx,offset ans 
   int 21h
 ret

what should i do please tell

 org 100h

 ans dw ?,"$"

 mov ax,23
 mov bx,23
 add ax,bx   
 mov ans,ax
 mov ah,09h
 mov dx,offset ans 
   int 21h
 ret
Cœur
  • 37,241
  • 25
  • 195
  • 267
Danny Rock
  • 89
  • 1
  • 2
  • 12
  • 1
    `int 21h` with `ah = 09h` outputs a *string*. To be a *string* (as described in the `int 21h` documentation) you need a sequence of ASCII bytes ending in `$`. You need a *byte for every digit* since each digit is an ASCII character when you want to display it. So you must convert your number to ASCII digits first. Rather than show you how to display a number, do a stackoverflow.com search on `[assembly] display number` or `[assembly] display integer`, etc, as there have been numerous answers given on the topic. – lurker Jun 20 '15 at 12:52
  • 1
    possible duplicate of [Print integer to console in x86 assembly](http://stackoverflow.com/questions/4244624/print-integer-to-console-in-x86-assembly) – lurker Jun 20 '15 at 12:57

0 Answers0