220k views
4 votes
3. (18 pts) (a) Write a macro MinusOrPlus that will operate on two registers as follows, where both registers contain unsigned integers. If the first register is more than the second register, then subtract the second register from the first register; otherwise, add the second register to the first register. In both cases, place the result in the first register without changing the second register. (b) Write an ARM instruction sequence that will use macro MinusOrPlus on registers r4 and r5, then use MinusOrPlus on registers r9 and r3, and then add the results in r4 and r9 with the sum going to r4.

1 Answer

5 votes

3. (18 pts) (a) Write a macro MinusOrPlus that will operate on two registers as follows, where both registers contain unsigned integers. If the first register is more than the second register, then subtract the second register from the first register; otherwise, add the second register to the first register. In both cases, place the result in the first register without changing the second register. (b) Write an ARM instruction sequence that will use macro MinusOrPlus on registers r4 and r5, then use MinusOrPlus on registers r9 and r3, and then add the results in r4 and r9 with the sum going to r4.

User Srinivasu
by
7.9k points