This document explains the approach taken to solve the problem of converting a string to uppercase and lowercase in assembly language.
The task was to write assembly code that iterates over a string and converts all lowercase letters (a-z) to uppercase (A-Z) and vice versa. The modified string must be saved back to memory.
The solution is divided into two main functions:
to_upper: Converts lowercase letters to uppercase.to_lower: Converts uppercase letters to lowercase.
Both functions follow a similar structure:
- Load the address of the string into a register.
- Iterate over each character in the string.
- Check if the character is within the range of lowercase or uppercase letters.
- Convert the character by adding or subtracting 32 (the difference between lowercase and uppercase in ASCII).
- Store the modified character back to memory.
- Repeat until the end of the string is reached.
- Character Range Check: The ASCII values for lowercase letters (
a-z) are 97-122, and for uppercase letters (A-Z) are 65-90. The difference between them is 32. - Loop Termination: The loop terminates when a null character (
\0) is encountered, indicating the end of the string. - Memory Management: The modified characters are stored back into memory using the
strbinstruction.
The program was tested using the provided test_case_1 string. Screenshots of the output are included below.
The solution successfully converts strings to uppercase and lowercase. The code is well-commented and adheres to best practices in assembly programming.

