就是输入一行字符 把有小a的转化为A
.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
INCLUDE io.h ; header file for input/output
cr EQU 0dh ; carriage return character
Lf EQU 0ah ; line feed
.STACK 4096 ; reserve 4096-byte stack
.DATA ; reserve storage for data
prompt1 BYTE "String to search ?",0
prompy2 BYTE cr,Lf,0
target dword 80 DUP(?),0
key dword 61h
mark dword 41h
trgtLength DWORD ?
keyLength DWORD 1
number BYTE 80 DUP(?)
.CODE ; start of main program code
strlen PROC NEAR32
push ebp
mov ebp,esp
pushf
push ebx
sub eax,eax
mov ebx,[ebp+8]
whileChar: cmp BYTE PTR [ebx],0
je endWhileChar
inc eax
inc ebx
jmp whileChar
endWhileChar:
pop ebx
popf
pop ebp
ret 4
strlen ENDP
_start:
output prompt1
input target,80
lea eax,target
push eax
call strlen
mov trgtLength,eax
mov eax,1
lea ebx,target
whilePosn: cmp eax,trgtLength
jg endWhile
mov edx,key
cmp edx,[ebx]
je found
add ebx,4
inc eax
jmp whilePosn
found:
mov edx,mark
mov [ebx],edx
add ebx,4
inc eax
jmp whilePosn
endWhile:
lea ebx,target
mov ecx,trgtLength
loop1: output [ebx]
add ebx,4
loop loop1
INVOKE ExitProcess, 0 ; exit with return code 0
PUBLIC _start ; make entry point public
END ; end of source code