Saturday, 12 December 2015

Addition of two numbers

Write an assembly Language Programming for addition of two numbers.

Prepared By Hitesh Vataliya

Basic Assembly Language Program code to add two numbers

Program Code


data segment
ends
stack segment
    dw   128  dup(0)
ends
code segment
start:
mov ax,1001h
mov bx,2001h
add bx,ax
mov dx,bx   
mov ax, 4c00h
int 21h 
ends
end start

Some Useful Tips for Understanding the Assembly Program Code.

data segment and stack segment are used creating variables for the program.
code segment is used for stores code inside it which is written in assembly language. we must have to follow the above structure.
Start : starting of Program Execution of Assembly Language code
Mov ax,1001h this instruction moves data 1001h into the ax resister.
add ax,bx performs addition of ax and bx and stores it's answer to ax resister.

No comments:

Post a Comment