1. C++ code embedded assembly
To embed assembly code in C++, you can use the keyword __asm{}. E.g:
#include<iostream>
void math(int a, int &b)
{
int ans = a;
__asm
{
mov ans,4
}
b = ans;
}
void main()
{
int a = 2;
int b;
math(a, b);
std::cout << b;
}
The output result is:
2. The cpp file calls the asm file
Reference link: https://blog.csdn.net/qq_33775402/article/details/78828235