Question: PROGRAM 1 Write and execute a program that combines each element of ARRAY 1 with the corresponding element of ARRAY 2 and a constant, as

PROGRAM 1
Write and execute a program that combines each element of ARRAY1 with the corresponding element of
ARRAY2 and a constant, as shown in the example below, with the result written to the corresponding
element of ARRAY3. ARRAY1, ARRAY2 and ARRAY3 are 5-integer (32-bits each) arrays of signed
numbers in a data area. You may use a register for variable k. An equivalent C instruction sequence might
look like:
Use the "for loop" format demonstrated in Friday's class (slides are in Canvas folder Files > Class
Notes_slides). Use the "scaled index" addressing mode to access the arrays. Recall that this uses a
separate "base address" register to point to each array, plus an offset that is the scaled value of the index (in
the register you use for k ). Do not change the base registers.
Use the following test data:
ARRAY1={5,-7,8,-9,12}
ARRAY2={4,-3,-4,6,1}
ARRAY3={0,0,0,0,0}
Submit your assembly language source program with the Expressions view (with numbers in decimal
format), showing the three arrays at the end of the program.
PROGRAM 2
To exercise shift and add/subtract operators, perform the following calculation:
y=4a-b16-32c
The four variables are 32-bit signed integers stored in a data section. In this case, you may
not use multiply or divide instructions. All multiplication and division operations should be
performed by shift operators. (Note that the constants are all powers of 2.)
Use test values: a=23,b=-96,c=-12
Submit your source program and the Expressions view showing the final values of the four
variables. Hand-calculate the result and note that on the Expressions view next to the final
value of variable y.
PROGRAM 1 Write and execute a program that

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!