markz@microsoft.UUCP (Mark Zbikowski) (08/05/85)
> From: hhoeksma@watmath.UUCP (Henry Hoeksma) > The Lattice 2.15C that I just bought has a library function called > movmem() that doesn't seem to work. Programs which use it tend to > crash randomly. (This is for the S-model, but probably applies to > the other models as well.) I disassembled movmem() and discovered > that it used the instruction REPZ MOVSB, when it should have been > REP MOVSB. I then wrote my own movmem() with the correct REP prefix, > and to my surprise, when I disassembled the resulting object file > it contained the REPZ prefix! It seems that MASM 3.0 (from MicroSoft) > generates the wrong opcode for the REP - namely a REPZ. > Assembler and C programmers beware! I believe that you misunderstand the *86 instructions. The opcode for REP, REPE and REPZ are identical. The condition-testing part of this prefix only occurs during the execution of the CMPS (compare string) and SCAS (scan string) instructions.