FindChar function to find characters inside strings :
.386
.model flat,stdcall
option casemap:none
ExitProcess PROTO :DWORD
printf PROTO C :DWORD,:VARARG
.data
mystr db 'This is a test.',0
f1 db 'Address of the string = %X',13,10
db 'Address of the character a = %X',0
.code
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
FindChar PROC src:DWORD,char:DWORD
mov eax,DWORD PTR [esp+4]
mov ecx,DWORD PTR [esp+8]
dec eax
@@:
inc eax
mov dl,BYTE PTR [eax]
mov dh,dl
xor dl,cl
dec dl
dec dh
or dl,dh
cmp dl,255
jnz @b
retn 8
FindChar ENDP
OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef
start:
invoke FindChar,ADDR mystr,'a'
invoke printf,ADDR f1,ADDR mystr,eax
invoke ExitProcess,0
END start