(Solved) : 4 25 Points Design Write Msp430 Assembly Language Subroutine I2as Char Int Myl Converts 16 Q44132046 . . .
4. (25 points) Design and write an MSP430 assembly language subroutine i2a_s(char*a, int myl) that converts a 16-bit BCD encoded integer, myl, into a character array with elements corresponding to the decimal representation of the integer. For example, an integer myl=9,246 (0x9246 in memory) is converted into an array with 4 elements as follows: a[0]=”6′, a[1]=’4′, a[2]=’2′, a[3]=’9. The main program that calls the subroutine is shown below. Ascii(‘A’)=0x41, ascii(‘0′)=0x30. RESET: Stopilot: mov.W mov. STACK END, SP Initialize stack pointer OTPOTHOLD, BHDTCTL; Stop watchdog timer Main code here sub. 14, SP mov.W SP R14 push.W R14 mov. I. R4 call sila s add. 2, SP Jmps allocate space for ascii chars : R14 points to the allocated area push the starting address on the stack ; integer is passed through R4 call subroutine free space on the stack lend: myI: .word x2C13 Stack Pointer definition .global .sect STACK END stack ; Interrupt Vectors ; MSP430 RESET Vector .sect .reset” Short RESET i2a_s: Show transcribed image text 4. (25 points) Design and write an MSP430 assembly language subroutine i2a_s(char*a, int myl) that converts a 16-bit BCD encoded integer, myl, into a character array with elements corresponding to the decimal representation of the integer. For example, an integer myl=9,246 (0x9246 in memory) is converted into an array with 4 elements as follows: a[0]=”6′, a[1]=’4′, a[2]=’2’, a[3]=’9. The main program that calls the subroutine is shown below. Ascii(‘A’)=0x41, ascii(‘0’)=0x30. RESET: Stopilot: mov.W mov. STACK END, SP Initialize stack pointer OTPOTHOLD, BHDTCTL; Stop watchdog timer Main code here sub. 14, SP mov.W SP R14 push.W R14 mov. I. R4 call sila s add. 2, SP Jmps allocate space for ascii chars : R14 points to the allocated area push the starting address on the stack ; integer is passed through R4 call subroutine free space on the stack lend: myI: .word x2C13 Stack Pointer definition .global .sect STACK END stack ; Interrupt Vectors ; MSP430 RESET Vector .sect .reset” Short RESET i2a_s:
Expert Answer
Answer to 4. (25 points) Design and write an MSP430 assembly language subroutine i2a_s(char*a, int myl) that converts a 16-bit BCD…
OR