Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Advice on code

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Looking for advice on assembly language code. Want to know what code be needed to change a character (bet a-z, whether in upper or lowercase when typed in) into uppercase and then display it on the screen.

Any help much appreciated.
 
It is pretty easy. If I remember correctly, the ASCII Codes for capitol or uppercase letters differ by one bit (The shift key on the keyboard makes this bit a 1 to give a capitol) so all you'd have to do is figure out which bit it is, or the corresponding bit with a 1. That is, figure out which bit you need to change to get a capitol, and make it 1. For example -> This is made up, you'll have to find the ASCII Codes:

a -> 10011001
A -> 10011011

b-> 10011101
B-> 10011111

So, bit # 7 == on means a capitol letter, so to make a -> A, just do a or 00000010, which will result in A

Hope That Helps!

Mike B.
 
OK, I looked up the symol table on

and, for example

Hex ASCII Char binary representation
46 F 01000110
66 f 01100110
45 E 01000101
65 e 01100101

So, if you have a letter, and you take the 3rd bit (From the right) and set it to 0, you guarantee that it is a valid upper case letter if you started with a lower case. You still need to check if it's in the range of lower and uper case letters, tho!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top