News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Problem with SCASB

Started by flipflop, February 27, 2013, 09:17:56 PM

Previous topic - Next topic

flipflop

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

sinsi

A rep needs ECX with the count, sounds like (lucky for you) that ECX is zero.

flipflop

Thanks, that is really stupid bug. I forgot about it.