Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int a, b, c, d, res_c, res_asm = 0;
- cout << "This program calculates (2b + 5cd)/(a-1)" << endl;
- cout << "Input only 16bit numbers!" << endl;
- cout << "Input a: ";
- cin >> a;
- cout << "Input b: ";
- cin >> b;
- cout << "Input c: ";
- cin >> c;
- cout << "Input d: ";
- cin >> d;
- res_c = 2 * b + c * d * 5;
- res_c /= a - 1;
- __asm {
- mov eax, c
- mov ebx, d
- mul ebx
- mov ebx, 5
- imul ebx
- mov ebx, b
- shl ebx, 1
- add eax, ebx
- mov ebx, a
- sub ebx, 1
- idiv ebx
- mov res_asm, eax
- }
- printf("Result c++: %d\nResult asm: %d\n", res_c, res_asm);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement