I am trying to reverse the string but simultaneously change each character to its next corresponding letter in the alphabet but must be the opposite capitalization as well. For instance, when the user enters "Test" the output should be "UTFu".
How can I modify my code to achieve this?
INCLUDE Irvine32.inc
INCLUDELIB Irvine32.lib
.data
buffer byte 128 dup(0)
msg1 byte "Enter a string of at most 128 characters:", 0dh, 0ah, 0
msg2 byte " Here it is in LOWERCASE and in reverse order: ", 0dh, 0ah, 0
msg3 byte 0dh, 0ah, " There are ",0
msg4 byte " lower-case characters ", 0dh, 0ah, 0
countLower byte 0
.code
main PROC
mov ecx, 0
mov eax, 0
mov edx,OFFSET msg1
call WriteString
read_again:
cmp ecx, 128
ja endread
call ReadChar
cmp al, 0Dh
je display
cmp al, 61h
jae test_lower
cmp al, 41h
jb store
cmp al, 5Ah
ja store
add al, 20h
inc countLower
ja store
test_lower :
cmp al, 7Ah
ja store
sub al, 20h
store:
push eax
inc ecx
jmp read_again
endread:
lea esi, buffer
display :
jecxz quit
mov edx, OFFSET msg2
call WriteString
again:
pop eax
call WriteChar
loop again
mov edx, OFFSET msg3
call WriteString
movzx eax,countLower
call WriteDec
mov edx, OFFSET msg4
call WriteString
quit:
exit
main ENDP
END main