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

(25 points) Analyze assembly program onsider the following code segment. 1 RESET

ID: 3749228 • Letter: #

Question

(25 points) Analyze assembly program onsider the following code segment. 1 RESET: 2 StopWDT: mov.w #WDTPWIWDTHOLD,&WDTCTL 4. 6 gnext: mov.w #-,STACK-END,SP ; Initialize stack pointer ; Stop watchdog timer sub.w mov.w mov.w mov.b .b jz #10, sp; allocates 10 bytes for local variables SP, R6; Ro points on bottom of stack #myinput, R4,load starting address of string into R4 @R4+, R5 , get new char #0,R5 ; is it null? lend Sump if z set 7 9 Jl lcopy: Sump iF less 12 13 14 lconv: 15 16 lcopy 17 18 19 lend: 20 21 myinput: .cstring "CPE325Lab Iconv: Somp i less j1 jmp lcopy Sump sub .b #"A",RS-, tokes awog oppercase A from R5 add.b #"a', R5, adds lowercase a to R5 mov.b R5, (R6) store result (e +o) inc.w R6%fges, increment counter jmp gnext, Somp to gnext (ine b) mov.b R5, 0(R6)istore resut ( Re +0 jmp i sump forever jump to current location '$ (endless loop)

Explanation / Answer

2.

When line 20 is executed, all the characters of the string have been processed.

Address M[15..8] M[7..0] 0x0600 0x0602 0x0604 0x0606 xx xx 0x0608 00 00 0x0610 05 F9