Mix (C++ and Assembly) Program to Add Two 8 bit Numbers

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
short int a,b,c;
cout<<"Enter First Number:";
cin>>a;
cout<<"Enter Second Number:";
cin>>b;
asm mov ax,a
asm mov ah,00h
asm mov bx,b
asm mov bh,00h
asm add al,bl
asm mov c,ax
cout<<"Result:";
cout<<c;
getch();
}

/*

Enter First Number:12
Enter Second Number:51                                                          
Result:63

*/

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.