PLEASE HELP ME TO SOLVE THIS PROBLEM ASSEMBLY LANGUAGE Use M

PLEASE HELP ME TO SOLVE THIS PROBLEM

ASSEMBLY LANGUAGE

Use Microsoft C/C++ Inline Assembler;

1) Count the number of positive values

2) Calculate the total of positive values

Please try to apply IA-32 instructions and use the following template as a base for the solution. * If the required value does not exist, then you must return -1.

// For each task level variant implement own function, e.g.:

int solution_for_grade_X(const int arr[], size_t arr_size)

{

    int result = 0;

    __asm

    {

        // Your Inline Assembler instructions for grade X level go here

        // :::

        mov   [result], eax        ; save the result

    }

    return result;

}

// :::

int main()

{

    int test_result;

    // Change the element count and values according to your algorithm:

    int test_arr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

    test_result = solution_for_task_X(test_arr1, sizeof(test_arr1)/sizeof(test_arr1[0]));

    // You can use assert() function to test for correctness:

    assert(expected_result == test_result);

    // Or print the results to console:

    printf(\"task 1 result = %d\ \", test_result);

    // For the same grade level function you might use different input arrays,

    // e.g. to test for side cases:

    int test_arr2[] = { 0, -1, 2, -3, 4, -5, 6, -7, 8, -9 };

    test_result = solution_for_task_X(test_arr2, sizeof(test_arr2)/sizeof(test_arr2[0]));

    assert(another_expected_result == test_result);

    // Or print the results to console:

    printf(\" task 2 result = %d\ \", test_result);

    // :::

    return 0;

Solution

2) to find total of postive values

PLEASE HELP ME TO SOLVE THIS PROBLEM ASSEMBLY LANGUAGE Use Microsoft C/C++ Inline Assembler; 1) Count the number of positive values 2) Calculate the total of po
PLEASE HELP ME TO SOLVE THIS PROBLEM ASSEMBLY LANGUAGE Use Microsoft C/C++ Inline Assembler; 1) Count the number of positive values 2) Calculate the total of po

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site