convert decimal to number

hdkim used Ask the Experts™
This code is to to this task: Result = A + B and print the sum..
It is programmed in MASM assembly, but I am using NASM.
Would you please comment on me what I must modify on this code to run NASM assembly ?

; THIS program calculates result Result: = A + B when A = 3 and B = 4
; programmed in MASM




A db 3
B db 4

Result db ?


Start: mov ax, @data
       mov ds, ax

       mov al, a
       add al, B
       mov Result, al

      mov ah, 02
      mov dl, Result
      add dl, 30H
      int 21H

      mov ax, 4c00H
      int 21H

      END Start
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

I suggest posting in the TA for assembly language. At least for me it has been all too long since doing any. What you should be able to do, is run a couple test programs, such as for merely outputting a single character, and compiling to achieve some error flags.

From one compiler to another, one thing that can happen is order of operands, "<=" vs "=>", use of separator, (space, comma, semicolon) and possibly spelling of register, command (mov). Possibly, the only thing you need do is to change the use of numbering. This can be achieved by first finding a global command, such as to default to hex rather than decimal, or to identify the symbol(s) used for each, such as &30 for a hex thirty.  Some languages, btw, require a leading zero to indicaste number, such a 04c00 rather than variable name. Try to find sample code if no one else responds here.

you can also try using decimal numbers instead of hex, and/or other conversions. See charts such as in this link for conversions from one to another.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial