Question: Given the problem above, solve for part P(a) and P(b). This code is written in assembly( not MIPS or C,C++ ), used for cortex m4.

Given the problem above, solve for part P(a) and P(b). This code is written in assembly(not MIPS or C,C++), used for cortex m4. Use simple code instructions, such as, bpl,bmi, ldrsh,mov,add,push{lr}, pop{pc}(those are examples of the simple code instructions you would use). Read carefully and provide a clear code that can be used in ARM assembly.
P(a) An 8 byte variable called PackedHWords has been created and stored by the main program. This variable contains 4 signed half words. Write a subroutine that accepts a single argument (the pointer to PackedH Words) and returns the average of the 4 half words if the average is positive. If the average is negative it returns zero. You may not use any IT blocks in this subroutine. P(b) Rewrite the subroutine from P(a), but without using any conditional branches. You may use IT blocks and you may use a code snippet to just identify the code that changes (ie: you don't have to re-write the whole subroutine, just the part that changed). P(a) An 8 byte variable called PackedHWords has been created and stored by the main program. This variable contains 4 signed half words. Write a subroutine that accepts a single argument (the pointer to PackedH Words) and returns the average of the 4 half words if the average is positive. If the average is negative it returns zero. You may not use any IT blocks in this subroutine. P(b) Rewrite the subroutine from P(a), but without using any conditional branches. You may use IT blocks and you may use a code snippet to just identify the code that changes (ie: you don't have to re-write the whole subroutine, just the part that changed)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
