4. (25 points) Write a subroutine Design and write an MSP430 assembly language subroutine iza_s(char*a, int myl) that converts a 16-bit integer, myl, into a character array with elements corresponding to the hexadecimal representation of the integer. For example, an integer myl=13,486=0x34AE is converted into an array with 4 elements as follows: a[O]="E', a[1]='A', a[2]="4', a[3]='3'. The main program that calls the subroutine is shown below. Ascii('A')=0x41, ascii('0')=0x30. RESET: StopWDT: mov.W #_STACK_END, SP ; Initialize stack pointer mov.w #WDTPWI WDTHOLD,&WDTCTL ; Stop watchdog timer ; Main code here sub.W #4, SP mov.W SP, R14 mov.W myI, R4 push.w R14 call #i2a_s add.w #2, SP ; allocate space for ascii chars ; R14 points to the allocated area integer is passed through R4 push the starting address on the stack call subroutine free space on the stack lend: jmp $ myr: .word ex34AE ; Stack Pointer definition global .sect STACK END .stack ; Interrupt Vectors .sect ".reset" short RESET ; MSP430 RESET Vector i2a_s: 4. (25 points) Write a subroutine Design and write an MSP430 assembly language subroutine iza_s(char*a, int myl) that converts a 16-bit integer, myl, into a character array with elements corresponding to the hexadecimal representation of the integer. For example, an integer myl=13,486=0x34AE is converted into an array with 4 elements as follows: a[O]="E', a[1]='A', a[2]="4', a[3]='3'. The main program that calls the subroutine is shown below. Ascii('A')=0x41, ascii('0')=0x30. RESET: StopWDT: mov.W #_STACK_END, SP ; Initialize stack pointer mov.w #WDTPWI WDTHOLD,&WDTCTL ; Stop watchdog timer ; Main code here sub.W #4, SP mov.W SP, R14 mov.W myI, R4 push.w R14 call #i2a_s add.w #2, SP ; allocate space for ascii chars ; R14 points to the allocated area integer is passed through R4 push the starting address on the stack call subroutine free space on the stack lend: jmp $ myr: .word ex34AE ; Stack Pointer definition global .sect STACK END .stack ; Interrupt Vectors .sect ".reset" short RESET ; MSP430 RESET Vector i2a_s