Hi all,
I've wrote this piece of code. It replaces char "a" with "#". It goes from end of string to begin. I exptect that code will go through string but it stop on first char. I've watched how code runs in Olly and repne scasb even not moves EDI to next char. What i'm doing wrong?
this is code:
include \masm32\include\masm32rt.inc
.586
.data?
.data
TestStr db "This is a test string",13,10,0
.code
start:
mov edi, [offset TestStr + 21]
std
mov al, "a"
repne scasb
cld
mov byte ptr [edi + 1], "#"
invoke StdOut, addr TestStr
inkey
invoke ExitProcess, 0
end start
thanks in advance
A rep needs ECX with the count, sounds like (lucky for you) that ECX is zero.
Thanks, that is really stupid bug. I forgot about it.