Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 4.3 Please provide the program and the answer (total obtained) For prob

ID: 3806081 • Letter: Q

Question

Question 4.3

Please provide the program and the answer (total obtained)

For problems that require development of a program test the solutions with data values selected to cover the widest possible range of situations. For problems which require the development of only part of a program devise a test program with additional instructions to enable the partial program to be fully tested. When ADD r3, r5, r12 is executed what happens to the value that was in r3? What is the effect (result) of executing ADD r3, r5, r5? What is the effect (result) of executing ADD r3, r3, r3 ? When MOV r11, r2 is executed what happens to the value that was in r11? What is the effect (result) of executing MOV r4, #28? What is the effect (result) of executing MOV r3, r3 ? Prepare a program to add together the numbers 127 decimal, 0xe45ad hexadecimal and 2_10101110010 binary (ARM assembly language uses prefix 2_ to indicate a number in base 2). Using a development system, assemble your program, repeatedly correct it and assemble again until there are no errors. Test that the program behaves correctly. What is the total obtained? Assume that register r2 holds the value 0x0f45, what is the value in register r5 after the execution of the instruction SUB r5, r2, #209 ? Assume that register r2 holds the value 0x045, what is the value in register r5 after the execution of the instruction RSB r5, r2, #209? What problems arise when register r2 holds 0x0f45 and the instruction RSB r5, r2, #209 is executed? What will be the value in register r5 after the execution of this instruction? What is the value in register r8 after the execution of the instruction MVN r8, #0xf4 ? Assume that register r3 holds the value 0x045 and r10 holds; what is the value in register r3 after the execution of the instruction ADD r3, r3, r10? Describe the form of the value that will be in register r6 after the execution of the instruction ADD r6, r6, #1?

Explanation / Answer

4.1a   when the instruction ADD r3,r5,r12 is executed, the operation is r3= r5+r12.
   That is the values in r5 and r12 are unchanged, the result is stored in r3 register. And no Flags are updated.

4.1b   After executing ADD r3,r5,r5 the value in r5 is unchanged, the result i.e., 2*r5 is stored in r3. And no Flags are updated.

4.1c   Here r3 becomes r3*2.

4.2a   MOV r11, r2 ---> This instrution copies the value from r2 (source) to r11 (destination).
   Whereas the source remains unchanged.

4.2b   MOV r4,#28 ---> This instruction simply writes the immediate data (28 which is succeded by #) to the register r4.

4.2c   MOV r3,r3 ----> This instruction does nothing, But still it can used for some time delay functions.

4.3   MOV r1,#127
   MOV32 r2,#0xe45ad
   MOV r3, #2_10101110010
   ADD r4,r1,r2
   ADD r4,r4,r3
   Program to add the 3 distinct values

4.4a   SUB r5,r2,#209 ---> This instruction subtracts 209 from the value stored in r2 i.e., 0x0f45.
   The result 0x0E74 is stored in R5.

4.4b   RSB r5,r2,#209 ---> This instruction subtracts the value stored in r2 i.e., 0x0f45 from 209.
   This gives the negative results which updates the status of N, Z, C and V flags.
   The result 0x0E74 is stored in R5. N flag is high.

4.4c    The problem will be negative result and R5 stores the result, but N flag is high.

4.5a   MVN instruction operates on a bit reversal order So the value stored in r8 is 0x0B (which is the bit reversal of 0xf4

4.5b   After the execution of this instruction the value in r3 is 0x045 with C flag gets high.

4.5c    After the execution of the instruction ADD r6,r6,#1 The value in R6 is incremented by 1.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote