[net.micro.pc] Bug in MASM 3.0 and therefore Lattice

lotto@talcott.UUCP (Jerry Lotto) (08/09/85)

> REP, REPE, and REPZ are three different mnemonics for the *same* opcode (F3h)
> Similarly, REPNE and REPNZ are both mnemonics for opcode F2h.  The assembler
> works just fine; the debugger always disassembles F3h into REPZ, I would
> assume, since it's the most definitive form of the three (tells you exactly
> what flag is checked).
> 
> bill frolik
> hp-pcd!bill

	Yes, they are the same opcode. NO, they do not do the same thing.
REPE or REPZ are valid with the CMPS or SCAS series of operands and do in
fact check the zero flag on each iteration as well as the contents of the
CX register. This is how they can abort before running out of count.

	MOV, STO (and IN and OUT on the 286) when prefixed by REP do NOT
check the zero flag. If they did, since none of these operations affect
the status of any flags, entry with ZF would abort after 1 iteration. Sure
they share opcode F3, but they are not valid instructions without an
argument. There is nothing functionally wrong with the original code,
but assemblers should spew warning messages for invalid combinations and
disassemblers should at least try to distinguish between REP and REPE/Z.
-- 

Gerald Lotto - Harvard Chemistry Dept.

 UUCP:  {seismo,harpo,ihnp4,linus,allegra,ut-sally}!harvard!lhasa!lotto
 ARPA:  lotto@harvard.ARPA
 CSNET: lotto%harvard@csnet-relay