Ask Question
30 June, 22:01

5. Given that the ASCII codes for 'A' through 'Z' are x41 through x5A; and the codes for 'a' through 'z' are x61 through x7A: What are the bit-mask and the logic operation (NOT the LC3 instruction) that would force a character stored in R0 to lower case - i. e. convert an upper-case character stored in R0 into lower case, and leave a lower case unchanged (so 'A' would become 'a', and 'a' would remain 'a').

Note: the LC-3 stores ASCII characters in the lower ("right-hand") byte of a 16-bit word, with the upper byte set to zero

+1
Answers (1)
  1. 30 June, 22:21
    0
    The bit mask: x0020

    The logic gate: OR

    Explanation:

    ASCII codes for "A" and "a" in binary are 01000001 and 01100001

    ASCII codes for "Z" and "z" in binary are 01011010 and 01111010

    and so on ...

    On close observation, we can see that for all the numbers, the 3rd bit from the left is 0 for all upper cases and 1 for all lower cases.

    To convert an alphabet into lower case we have to convert the 3rd bit into 1 if not already 1. An OR operation on the 3rd bit can do so which would result from a bit mask 00100000 and x0020 in hexa.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “5. Given that the ASCII codes for 'A' through 'Z' are x41 through x5A; and the codes for 'a' through 'z' are x61 through x7A: What are the ...” in 📗 Engineering if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers