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.


lynxbee_ezoic

Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )

   


Leave a Comment

Android Android Applications Android Build system Android Commands Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded