Question: 3. (25 points) Analyze assembly program Consider the following code segment. 1 RESET: 2 StopWDT : #-STACK-END, SP #kDTPHIWDTHOLD,&MDTCTL Initialize stack pointer Stop mov .w
3. (25 points) Analyze assembly program Consider the following code segment. 1 RESET: 2 StopWDT : #-STACK-END, SP #kDTPHIWDTHOLD,&MDTCTL Initialize stack pointer Stop mov .w mov.w sub.w #10, SP mov.W SP, R6 mov.w #myinput, R4 mov.b ER4+, RS cmp . b #0, R5 ; watchdog timer 6 gnext: lend . b jl #"A", lcopy RS 18 12 14 1conv: 15 16 lcopy: 17 18 19 lend: 20 21 myinput: .cstring "CPE325Lab" j1 jmp sub . b add "b mov.b inc.w jmp mov.b jmp conv lcopy #"A", R5 #'a', RS R5,0(R6) R6 gnext RS, e(R6) jump to current location '(endless loop) A. (12 points) What does this program do? Add code comments (lines 1-19). B. (10 points) Sketch the content of the stack at the moment when the program executes the instruction at line 20. Assume that the original value of R1-0x0600 (initialized in line 1). ascii('A)-0x41, asciZ)-0x5A, ascii('0)-0x30. Address MI15 MI7.0] C. (3 points) Calculate the total execution time in seconds (time it takes for the program to reach statement in line 20). Assume the clock frequency is 8 MHz. How many instructions are executed in this program (before reaching the statement at line 20)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
