Question: Analyze assembly program Consider the follwing code segment. Consider the following code segment. ; Initialize stack pointer mov.w # STACK END , SP mov .

Analyze assembly program

Consider the follwing code segment.

Analyze assembly program Consider the follwing code segment. Consider the following codesegment. ; Initialize stack pointer mov.w # STACK END , SP mov

Consider the following code segment. ; Initialize stack pointer mov.w # STACK END , SP mov . w sub.w #10, SP mov.w SP, R6 mov.w #myinput, R4 mov.b @R4+, R!5 cmp.1end eo5 jz 1 RESET: 2 StopWDT: #WDTPWI WDTHOLD,&MDTCTL ; Stop watchdog timer 4 6 gnext: b #0, R5 10 jl lcopy lconv lcopy 12 13 14 1conv: 15 16 1copy: 17 18 19 lend: 20 21 myinput: .cstring "CPE325Lab" jl jmp sub.b #'A', R5 add.b #'a', R5 mov.b R5, 0(R6) inc.W R6 mp mov.b R5, 0(R6) jmp gnext 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, ascii("Z')=0x5A, ascii('0')-0x30 Address 0x0600 Consider the following code segment. ; Initialize stack pointer mov.w # STACK END , SP mov . w sub.w #10, SP mov.w SP, R6 mov.w #myinput, R4 mov.b @R4+, R!5 cmp.1end eo5 jz 1 RESET: 2 StopWDT: #WDTPWI WDTHOLD,&MDTCTL ; Stop watchdog timer 4 6 gnext: b #0, R5 10 jl lcopy lconv lcopy 12 13 14 1conv: 15 16 1copy: 17 18 19 lend: 20 21 myinput: .cstring "CPE325Lab" jl jmp sub.b #'A', R5 add.b #'a', R5 mov.b R5, 0(R6) inc.W R6 mp mov.b R5, 0(R6) jmp gnext 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, ascii("Z')=0x5A, ascii('0')-0x30 Address 0x0600

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 Databases Questions!