- Field: Computer Science
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:
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.