Question: Please convert this Assembly code into CCS. ; Subroutine to give delay of R12 0.1s Parameter is passed in R12 and destroyed ;R4 used for
Please convert this Assembly code into CCS.

; Subroutine to give delay of R12 0.1s Parameter is passed in R12 and destroyed ;R4 used for loop counter, stacked and restored DelayTenths: ; Stack R4: will be overwritten ; Start with test in case R120 push. R4 jmp mov.w #DELAYLOOPS , R4 dec.w R4 LoopTest OuterLoop: ; Initialize loop counter DelayLoop: [clock cycles in brackets] ; Decrement loop counter [11 ; Repeat loop if not zero [21 ;Decrement number of 0.1s delays DelayLoop nz dec.w R12 LoopTest: ; Finished number of 0.1s delays? #0,R12 OuterLoop R4 cmp.w No: go around delay loop again nz pop.w ret Yes: restore R4 before returning Return to caller ; Subroutine to give delay of R12 0.1s Parameter is passed in R12 and destroyed ;R4 used for loop counter, stacked and restored DelayTenths: ; Stack R4: will be overwritten ; Start with test in case R120 push. R4 jmp mov.w #DELAYLOOPS , R4 dec.w R4 LoopTest OuterLoop: ; Initialize loop counter DelayLoop: [clock cycles in brackets] ; Decrement loop counter [11 ; Repeat loop if not zero [21 ;Decrement number of 0.1s delays DelayLoop nz dec.w R12 LoopTest: ; Finished number of 0.1s delays? #0,R12 OuterLoop R4 cmp.w No: go around delay loop again nz pop.w ret Yes: restore R4 before returning Return to caller
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
