프로그래밍 언어/Assembly

어셈블리 - 대문자를 소문자로 변환

리그캣 2018. 1. 22. 15:30

대문자를 소문자로 변환


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
INCLUDE Irvine32.inc
.data
 
str1 BYTE 100 DUP(?),0
.code
main PROC
    mov ecx, LENGTHOF str1-1
    mov edx, OFFSET str1
    call ReadString
    mov esi,0
    mov ecx, LENGTHOF str1-1
 
L1:
    .if str1[esi]>=97 && str1[esi]<=122
    sub str1[esi],32
    movzx eax,str1[esi]
    call WriteChar
 
    .elseif str1[esi]>=65 && str1[esi]<=90
    add str1[esi],32
    movzx eax,str1[esi]
    call WriteChar
 
    .elseif str1[esi]==32
    movzx eax,str1[esi]
    call WriteChar
    jmp next
    
    .endif
    
    next:
    inc esi
 
Loop L1
 
exit
    
main ENDP
END main
cs