Question: 1 ) The factorial program is given as follows: AREA Prog 2 , CODE, READONLY ENTRY MOV r 6 , # 1 0 ; load

1) The factorial program is given as follows:
AREA Prog2, CODE, READONLY
ENTRY
MOV r6, #10 ; load 10 into r6
MOV r4, r6 ; copy n into a temp register
loop SUBS r4, r4, #1 ; decrement next multiplier
MULNE r6, r4, r6 ; perform multiply
BNE loop ; go again if not complete
stop B stop
END
a) Using the Disassembly window (Keil \mu Vision4), write out the first six machine codes (32-bit
instructions) for the above program in hex format.
b) Change the value in register r6 at the start of the program to 12. What value is in the register r6 when
the code terminates? Verify that this hex number is correct.

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!