Question: PLEASE EXPLAIN EACH LINE OF CODE ONLY. USE COMMENTS NEXT TO EACH LINE TO EXPLAIN WHAT EACH IS CODE IS DOING THANKS. PLEASE COPY PASTE
PLEASE EXPLAIN EACH LINE OF CODE ONLY. USE COMMENTS NEXT TO EACH LINE TO EXPLAIN WHAT EACH IS CODE IS DOING THANKS. PLEASE COPY PASTE AFTER YOURE DONE NOT SCREENSHOT BECAUSE I NEED TO BE ABLE TO EDIT IT THANKS. // MODULE B: Method 2: Embedding an in-line asssembly language module in a C progrmming #include "stdafx.h" #include "stdio.h" #includeint main () { printf(" Lab_No_01_Getting_Stated_into_x86_Assembly_from_a_C++_program "); // Lab number and title here printf(" Module B: Embedding an in-line asssembly language module in a C progrmming "); printf(" James Rodriguez, ID#12345678 "); // Student's name here printf(" CET3510-E205 "); // Student's Class here printf(" Submission date: January 20, 2019 "); // Date of the Student's program when submitted here printf(" Due date: January 28, 2019 "); // Date of the Student's program due date printf(" Example 1.2 SimpleMathASM.cpp "); // Student's file name for the program here printf(" file name: SimpleMathASM.cpp "); // Student's file name for the program here printf("----------------------------------------- "); printf("Hello "); printf("Using EAX, EBX, and ECX 32-bits Registers "); int x, y, sum, diff; //A. Find the sum of two integers (sum = x + y) printf("Enter two integers from a keynoard to add "); scanf_s("%d%d", &x,&y); _asm { MOV EAX, 0; // To initilized register in zeros MOV EBX, 0; // To initilized register in zeros MOV ECX, 0; // To initilized register in zeros MOV EAX, x; // Load EAX with the value x MOV EBX, y; // Load EBX with the value y MOV ECX, EAX; ADD ECX, EBX; //Add EBX to ECX MOV sum, ECX; // sum = x + y this operation is substituted using 32-bit registers; } printf("Addition result = %d ", sum); getchar(); // Hold the consult for result printf("******************************************************************************* "); //B. Find the difference of two integers (sub = x - y) printf("Enter two integers from a keynoard to minus "); scanf_s("%d%d", &x,&y); _asm { MOV EAX, 0; // To initilized register in zeros MOV EBX, 0; // To initilized register in zeros MOV ECX, 0; // To initilized register in zeros MOV EAX, x; // Load EAX with the value x MOV EBX, y; // Load EBX with the value y MOV ECX, EAX; SUB ECX, EBX; //Substract EBX from ECX MOV diff, ECX; // sub = x - y; this operation is substituted using registers; } printf("Subtraction result = %d ", diff); system ("pause"); // Hold the consult for result return(0); }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
