3,881
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
int main()
{
char string[128];
char format[] = "%s";
_asm{
push 7fH
lea eax,[string] ;
push eax ;
lea eax,[format] ;
push eax ;
call dword ptr scanf_s ;
add esp,8 ;
jmp entry
isletter1:
cmp al, 'a'
jl nex
cmp al, 'z'
jg nex
mov ecx, 1
ret
isletter2:
cmp al, 'A'
jl nex
cmp al, 'Z'
jg nex
mov ecx, 1
ret
nex:
mov ecx, 0
ret
entry:
lea edx, [string]
loopStart:
mov al, byte ptr ds:[edx]
test al, al
jz end
call isletter1
test ecx, ecx
jz test2
sub byte ptr ds:[edx], 'a'-'A'
jmp nextChar
test2:
call isletter2
test ecx, ecx
jz nextChar
add byte ptr ds:[edx], 'a'-'A'
nextChar:
inc edx
jmp loopStart
end:
lea eax,[string] ;
push eax ;
lea eax,[format];
push eax;
call dword ptr printf;
add esp,4;
}
return 0;
}