Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help completing this computer assembly program: Shift to load Bytes: Write assembler code to put the values of the C++ constants byte0, byte1, byte2,

Need help completing this computer assembly program:

Shift to load Bytes: Write assembler code to put the values of the C++ constants byte0, byte1, byte2, and byte3 into the C++ memory variable uint32_t resultUInt32. The bytes have to be in the following order in resultUInt32 that is displayed in hex by the C++ part of the program: 11223344

Endianess: Step through the C++ memory constant uint32_t source32Bit (0x44332211) in a byte wise manner from the lowest to the highest byte address and put the byte results into the following C++ variables: uint8_t lowestAddressByte0Up, lowestAddressByte1Up, lowestAddressByte2Up, lowestAddressByte3Up;

Powers of 2 Multiply and Divide: The C++ code will prompt the user to enter a multiplier 1, then prompt for an exponent for a base 2 multiplier. Write the required assembler code in the _asm code block to put the results to the C++ variable product that gets displayed by the C++ code. The C++ code will prompt the user to enter a dividend, then then prompt for an exponent for a base 2 divisor. Write the required assembler code in the _asm code block to put the results to the C++ variable quotient that gets displayed by the C++ code. Use logical shifts to execute the operations for the base 2 multiply and base 2 divide.

As usual, do not modify the C++ part of the program that is s used to do the program.

THE FILE IS BELOW:

#include "stdafx.h"

#include #include

using namespace std;

int main() {

uint32_t i_uint32, j_uint32, result_uint32; int32_t i__int32, j__int32, result__int32;

do { cout << endl << endl; cout << "Input an integer i_uint32 >= 0 : "; cin >> i_uint32; cout << "Input an integer j_uint32 >= 0 : "; cin >> j_uint32;

_asm { ; i_uint32 + j_uint32 into result_uint32

}

cout << endl << "i_uint32 + j_uint32 = " << result_uint32 << endl << endl;

//---------------

cout << "Input an integer i_uint32 < 0 : "; cin >> i_uint32; cout << "Input an integer j_uint32 < 0 : "; cin >> j_uint32;

_asm { ; i_uint32 + j_uint32 into result_uint32

}

cout << endl << "i_uint32 + j_uint32 = " << result_uint32 << endl << endl;

//---------------

cout << "Input an integer i__int32 : "; cin >> i__int32; cout << "Input an integer j__int32 : "; cin >> j__int32;

_asm { ; i__int32 + j__int32 into result__int32

}

cout << endl << "i__int32 + j__int32 = " << result__int32 << endl << endl;

//---------------

cout << "Input an integer i__int32 : "; cin >> i__int32; cout << "Input an integer j__int32 : "; cin >> j__int32;

_asm { ; i__int32 - j__int32 into result__int32

}

cout << endl << "i__int32 - j__int32 = " << result__int32 << endl << endl << endl;

cout << "Enter 0 to leave, 1 to continue... "; cin >> i_uint32;

} while (i_uint32 == 1);

return (0); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions