Question: 3. (25 points) Analyze assembly program Consider the following code segment. mystr : .cstring 325Lab. data .text Assemble into program memory - ; Initialize stackpointer
3. (25 points) Analyze assembly program Consider the following code segment. mystr : .cstring "325Lab. data .text Assemble into program memory - ; Initialize stackpointer #-STACK END, SP #NDTPWINDTHOLD, &MDTCTL #mystr, R4 RESET: mov.w mov.w mov.w StopiDT: ; Stop watchdog timer gnext: mov.b RA, R5 #0, RS lend cmp.b jz .b j1 #'a", lnext RS lconv j1 jmp icopy sub.b add.b #'a", #'A', RS RS Iconv : lcopy: mov.b R5, 0(R4) lnext: inc.w R4 jmp gnext nop jmp s lend: ; jump to current location ' (endless loop) A. (20 points) What does this program do? Add code comments. B. (5 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 infinite loop)? 3. (25 points) Analyze assembly program Consider the following code segment. mystr : .cstring "325Lab. data .text Assemble into program memory - ; Initialize stackpointer #-STACK END, SP #NDTPWINDTHOLD, &MDTCTL #mystr, R4 RESET: mov.w mov.w mov.w StopiDT: ; Stop watchdog timer gnext: mov.b RA, R5 #0, RS lend cmp.b jz .b j1 #'a", lnext RS lconv j1 jmp icopy sub.b add.b #'a", #'A', RS RS Iconv : lcopy: mov.b R5, 0(R4) lnext: inc.w R4 jmp gnext nop jmp s lend: ; jump to current location ' (endless loop) A. (20 points) What does this program do? Add code comments. B. (5 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 infinite loop)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
