Question: Write the required embedded (_asm) assembler code for each section in the corresponding inline assembler blocks denoted by the _asm keyword. See the example displayed
Write the required embedded (_asm) assembler code for each section in the corresponding inline assembler blocks denoted by the _asm keyword.
See the example displayed output at the end of this assignment for guidance.
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.
output
like
Sample Test Run Output:
Byte 0 is 11
Byte 1 is 22
Byte 2 is 33
Byte 3 is 44
The placement result is 11223344
In Memory little endian storage for 44332211(LSB on right side)
The lowest address byte is 11
The next up address byte is 22
The next up address byte is 33
The next up address byte is 44
Enter an integer > = 0 for multiplicand : 5
Enter an integer > = 0 to be an exponent for base 2 multiplier : 3
Multiplicand 5 x 2 to the power of 3 = 40
Enter an integer > = 0 for dividend : 16
Enter an integer > = 0 to be an exponent for base 2 divisor : 3
Dividend 16 / 2 to the power of 3 = 2
Press any key to continue . . .
const uint8_t byte0 (0x11), byte1 (0x22), byte2(0x33), byte3 (0x44); uint32_t resultUInt32(0); cout
Step by Step Solution
There are 3 Steps involved in it
To address the requirements in the given C code using inline assembly heres how you can write the as... View full answer
Get step-by-step solutions from verified subject matter experts
