The program is supposed to take a string and return it in lowercase format. For example: "HEllO" would return as "hello."
Here's the code now, but it works in the opposite way (lower is turned upper):
.586
.MODEL FLAT
INCLUDE io.h ; header file for input/output
.STACK 4096
.DATA
prompt1 BYTE "Enter string", 0
string BYTE 40 DUP (?)
resultLbl BYTE "The string is", 0
.CODE
_MainProc PROC
input prompt1, string, 40 ; read ASCII characters
lea ebx, string
L2: cmp byte ptr[ebx], 0
je end1
cmp byte ptr[ebx], 'a'
jl L1
cmp byte ptr[ebx], 'z'
jg L1
sub byte ptr[ebx], 20h
L1:
inc ebx
jmp L2
end1:
output resultLbl, string
mov eax, 0 ; exit with return code 0
ret
_MainProc ENDP
END ; end of source code
Nevermind find out myself. Just change 'a' and 'z' to 'A' and 'Z' and tell the program to add instead of subtract 'byte ptr[ebx], 20h'.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.