I am trying to write a trivial toUpper procedure in MASM for ASCII only. It works, however, whenever it encounters a whitespace character, it wont continue changing the case of that character and the ones following it. I can't figure out the reason why this is happening. So what I did is put a conditional statement to test if a character is a space ' ' (32) and thus jump beyond it. Is this enough or should I test for any value that is not between 97 and 122 also?
; EDX - INPUT - The offset to the BYTE Array
; ECX - INPUT - The Size of the BYTE Array
; EDX - OUTPUT- The offset to the new BYTE Array toUpper PROC
PUSH ECX ; we will modify this so push it to the stack
DEC ECX ; we don't want the null terminating char
loopMe:
MOV AL, [EDX] ; otherwise move what the EDX points to to AL
CMP AL, 32
JNE goodChar
INC EDX ; increment the pointer by one byte since this is a space
loop loopMe ; go to the next char
goodChar:
AND AL , 11011111b ; make AL capital
MOV [EDX], AL
INC EDX ; increment the pointer by one byte
LOOP loopMe
done:
POP ECX ; return it back to its original value
RET toUpper ENDP