ASSEMBLY LANGUAGE Win32 Console Application solution in the
ASSEMBLY LANGUAGE (Win32 Console Application solution in the Microsoft Visual Studio)
Step for the solution: Count the number of odd values (n mod 2 <> 0) for each row. Note: Please use template the following template below as a base for the solution.
Important: All calculations, conditions and jumps must be implemented only with Inline or full assembler!
#include \"stdafx.h\"
#include
#include
void solution_for_grade_7(const int * arr, size_t arr_rows, size_t arr_cols, int * result)
{
__asm
{
// Your Inline Assembler instructions for grade 7 level go here
// :::
}
}
const int ROWS = 2;
const int COLS = 3;
int main()
{
// Change the array definitions to be appropriate for your assignments:
int data1[ROWS][COLS] = { { 0, -1, 2 }, { 3, 4, -5 } };
int result1[ROWS]; // Note: for some assignments the result size will depend on the COLS!
// Change the parameters according to your assignment function, e.g.:
solution_for_grade_7((const int *)data1, ROWS, COLS, result1);
// Print the result one-dimensional array to the console:
for (size_t i = 0; i < ROWS; i++)
printf(\"%d \", res1[i]);
// :::
return 0;
}
Solution (Which I need but better also show me first step): Implement the same task \" Count the number of odd values (n mod 2 <> 0) for each row \" from previous step But place them in separate assembler module (in file with extension .ASM) and use the template below for assembler module. Important: Demonstrate assembler module by calling procedures from the C/C++ code.
.586
.model flat, C
.code
SolutionForGrade7 PROC PUBLIC USES ...
[LOCAL ...]
:::
ret
SolutionForGrade7 ENDP
:::
END
Solution
#include<stdio.h>
#include <iostream>
using namespace std;
int main(){
int nmbr;
int minn,maxx;
long cntt =0;
cout << \"Enter the minimum range: \";
cin >> minn;
cout << \"Enter the maximum range: \";
cin >> maxx;
for(nmbr = minn;nmbr <= maxx; nmbr++)
if(nmbr % 2 !=0)
cntt++;
cout << \"Number of odd numbers in given range is: \" << cntt;
return 0;
}

