Home » Programming Languages » Assembly Language » Assembly program to Add two numbers

Assembly program to Add two numbers

In this post, we will show a simple program which adds two numbers from two registers and save it into third register. So this program does following,

  • Copy first number (ex. decimal 6) to register R0
  • Copy second number (ex. decimal 3) to register R1
  • Add those two numbers from register R0 and R1 (6+3) and save the addition to register R2 (ex. decimal 9)

So, the final program would look as,

MOVS R0, #6
MOVS R1, #3
ADDS R2, R1, R0

Note: This instructions works for ARM.

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment