1 30 points Consider the following code segment 1 include ms
1. (30 points) Consider the following code segment. 1 include \"msp430.h\" Edefine controlled include file NAME main module name PUBLIC main make the main label visible outside this module ORG 0FFFEh DO 16 init set reset vector to \'init\' label RSEG CSTACK pre-declaration of segment RSEG CODE i place program in CODE Segment 10 init MOV ESFE (CSTACK), SP i set up stack 11 main NOP main program 12 MOV. #WDTPW WDTHOLD, WDTCTL Stop watchdog timer sub 8 stuck SUB SP 14 wowe sp into Ruo SP R6 move input into R4 i t RLH mow into R5 15 MOV W imy input R4 16 gnext Mov. R4+, R5 CMP B #0, R5 campane to RS 18 lend JZ if zero, juwwoup to lend CMP. com a to R5 20 lcopy it less, junp to 1copy CMP. B \'z\'+1, R5 22 conv JMP lcopy if less, jump to 1Conv 24 lconv SUB B \'a\', R5 unconditional p to 1coey colo value opa from 25 25 ADD. B \'A\', R5 add valus of A to RS 26 lcopy Mov. R5 0 (R6 moue into R. R6 27 gnext 3 uncondition jump to gnent 29 move R5 into Ruo 30 lend. Mov. R5 0 (R6) JMP jump to current location (endless loop) 32 33 my input DB cpe 323z\" 34 END
Solution
Execution time in assemble is calculate by
Execution time = Total number of cycles * Clock cycle time
the clock frequency is 8 Mhz
so here the execution time comes around 0.0125 seconds.
