flat assembler
Message board for the users of flat assembler.
Index
> Main > [SOLVED] repnz movsb - problem |
Author |
|
baldr 01 Oct 2010, 17:18
killasmurf86,
Both manuals explicitly state that only rep prefix (which has the same opcode as repe/repz) can be used with movs. This is understandable: even if source isn't equal to destination before the instruction is executed, it will be after. |
|||
01 Oct 2010, 17:18 |
|
killasmurf86 01 Oct 2010, 17:51
Thanks for clearing my doubt's.... I finally fixed bug, after I posted.....
I just wanted to verify.... cause I was staring at the code for hours, and just couldn't understand why It doesn't work... |
|||
01 Oct 2010, 17:51 |
|
MazeGen 05 Oct 2010, 09:25
movs doesn't change flags and both REPE and REPNE is clever enough not to check for them.
Therefore repne movs works the same like rep movs. And rep movs is the same like repe movs in machine code. |
|||
05 Oct 2010, 09:25 |
|
ouadji 05 Oct 2010, 10:29
100% agree with MazeGen there is no comparison in "movs. "REPNE" has no meaning here. |
|||
05 Oct 2010, 10:29 |
|
revolution 05 Oct 2010, 10:34
MazeGen wrote: movs doesn't change flags and both REPE and REPNE is clever enough not to check for them. |
|||
05 Oct 2010, 10:34 |
|
ouadji 05 Oct 2010, 11:06
Quote:
not a matter of useless behavior of the processor. make a comparison after a "mov" is an absurdity, or then, it's not a "mov", but a "mov_and_cmp". Last edited by ouadji on 05 Oct 2010, 11:12; edited 1 time in total |
|||
05 Oct 2010, 11:06 |
|
revolution 05 Oct 2010, 11:12
ouadji wrote: it's a matter of logique (of the code), |
|||
05 Oct 2010, 11:12 |
|
ouadji 05 Oct 2010, 11:24
100% agree with you revolution that's what I tried to say ... ( , sorry for my bad english) the code should be logical, (reliability and dependability in one's code) and never use any useless behavior (unexpected) of the processor. |
|||
05 Oct 2010, 11:24 |
|
edfed 05 Oct 2010, 12:05
the best way to have a reliable code for X86 is to code with 386 instruction set only
the best way to have a fast code is to code with X86 RISC instructions, and better, code with single byte, parallelisable in Pentium, and low latency, instructions only. |
|||
05 Oct 2010, 12:05 |
|
MazeGen 05 Oct 2010, 12:38
It seems that I accidentally deleted the disclamer part: "undocumented, you should't rely on it".
However, the difference between REP and REPE is made by the repeated instruction: if the instruction changes flags, REP/REPE tests them, otherwise it doesn't test them at all. It is very likely that the same behaviour is hardwired in REPNE prefix. |
|||
05 Oct 2010, 12:38 |
|
edfed 05 Oct 2010, 18:38
from HELPPC:
REP repeat a string instruction unti CX=0 REPE/REPZ repeat until CX=0 and Zero flag is set REPNE/REPNZ repeat until CX=0 and Zero flag is clear http://docs.huihoo.com/help-pc/asm-rep.html |
|||
05 Oct 2010, 18:38 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.