Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/3/84; site sesame.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!harvard!talcott!sesame!slerner From: slerner@sesame.UUCP (Simcha-Yitzchak Lerner) Newsgroups: net.micro.pc Subject: Re: Bug in MASM 3.0 and therefore Lattice 2.15. Message-ID: <247@sesame.UUCP> Date: Sun, 4-Aug-85 19:35:48 EDT Article-I.D.: sesame.247 Posted: Sun Aug 4 19:35:48 1985 Date-Received: Wed, 7-Aug-85 00:23:52 EDT References: <15959@watmath.UUCP> Distribution: net Organization: Lotus Development Corp Lines: 33 > 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 don't have my reference library at hand, but if memory serves me correctly this is not an error. I believe that there is not a seperate REP opcode at the machine level. Rather, for non-comparative string operations (MOVS vs CMPS) the sign (Z vs NZ) is ignored. Similarly, you may code JZ and disassemble JE. In truth they are the same opcode. What you are seeing here is an artifact of your disassembler. Some (most?) use a simple minded one to one mapping, while a few look at content to gain a little clarity (doesn't help with the JE JZ problem, but fixes up REP confusion.) PS- I verified this with several debuggers. They all assemble REP as REPZ. (One won't even recognize REP as a valid opcode, you have to be smart enought to know to use REPZ...) -- Opinions expressed are public domain, and do not belong to Lotus Development Corp. ---------------------------------------------------------------- Simcha-Yitzchak Lerner {genrad|ihnp4|ima}!wjh12!talcott!sesame!slerner {cbosgd|harvard}!talcott!sesame!slerner slerner%sesame@harvard.ARPA