C Program to Write inline assembly language code in C Program


Add Two Numbers Using Inline Assembly Language ???

  1. Assembly Language can be Written in C .
  2. C Supports Assembly as well as Higher Language Features so called “Middle Level Language”.
  3. As shown in above Program , “asm” Keyword is written to indicate that “next followed instruction is from Assembly Language”.

  1. Opening Curly brace after “asm” keyword tells that it is the “Start of Multiple Line Assembly Statements” i.e “We want to Write Multiple Instructions”
  2. Above Program Without “Opening and Closing Brace” can be written as - [“asm” keyword before every Instruction ]


What above Program Actually Does ?

  1. In 8086 Assembly Program for Storing Values AX,BX,CX,DX registers are used called General Purpose Registers .

  1. Move Instruction Copies content of Variable “a” into Register “AX”
  2. Add Instruction adds Content of two specified Registers and Stores Result in “ax” in above example.
  3. Copy Result into Variable “c”