Quote:
|
Originally Posted by Benoit
To convert an ASCII character to uppercase, simply subtract 32 (The difference between a and A on the ascii table).
|
You're making the assumption that the character is lowercase to begin with; you'll need to test for that. Also, though you qualified it by specifying ASCII, the OP didn't say that (though if he's writing x86 assembly, it's most likely the case).
Assuming that he's using ASCII, one way of doing it faster would be to populate a 256-byte table, point DS:(E)BX at this table, and use
XLATB. This eliminates checks for range, so you can quickly map one character to another. If you want strict ASCII with no support for the so-called 'high ASCII', you can cut the table by half, and mask against 07Fh before the lookup; this'll save a whopping 128 bytes. Just loop through the string, doing a lookup for each byte until you hit the end. Presumably, your string is null-terminated, but if it's not, you'll have a length count that you can load into (E)CX before you start.