Write an assembly program that counts the number of digits and uppercase characters in the given string. Write the number of digits and uppercase characters into P1OUT and P2OUT respectively. Assume that a string does not include more than one line. Assuming the input string is “Welcome MSP430 Assembly!”, then the correct results for testing purpose are shown below (in decimal):

Total Number of Uppercase Characters (P1OUT): 5

Total Number of Digits (P2OUT): 3

 

2. Write an assembly program that will update an input string. Each lowercase letter in the input string should be replaced by the corresponding uppercase letter. Assume that a string does not include more than one line. Count the number of changes and put the output in port P3 output register. Assume the input string is “Welcome to MSP430 Assembly!” then

the correct results for testing purpose are shown below:

Updated string: “WELCOME TO MSP430 ASSEMBLY!”

Total Number of Changes (P3OUT): 15

 

3. (Bonus) Write an assembly program that will create a new string by deleting the special characters from the original input string. Assume that a string does not include more than one line. Count the number of deleted special characters, and put this in the port P4 output register. Assuming the input string is “Welcome To MSP430 Assembly:)!”, then the correct

results for testing purpose are shown below:

New string: “WelcomeToMSP430Assembly”

Total Number of Deleted Special Characters (P4OUT): 6


Leave a Reply

Your email address will not be published. Required fields are marked *