Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnews!shurr From: shurr@cbnews.att.com (Larry A. Shurr) Newsgroups: comp.os.msdos.programmer Subject: Re: MASM generating extra nops in second pass Summary: MASM ungraceful with forward references Message-ID: <1990Nov30.165652.9381@cbnews.att.com> Date: 30 Nov 90 16:56:52 GMT References: <1990Nov28.220900.5921@polyof.poly.edu> Organization: AT&T Bell Laboratories, Columbus, OH (actually an AGS consultant) Lines: 37 In article <1990Nov28.220900.5921@polyof.poly.edu>, ted@polyof.poly.edu (Theodore S. Kapela, Staff) writes: } I am having a little problem with Microsoft Macro Assembler v4.00. } I have an instruction such as the following: } mov dl,(80-lentr)/2 } where lentr is a constant (eg: lentr equ 8). } After the first pass, the assembler generates the hex bytes B2 xx, } (where xx is dependant on the value of lentr). On the second pass, } it generates the hex bytes B2 xx 90. This causes a phase error. I don't } need the extra nop instruction, nor do I want it. I know MASM 4.00... This may not apply to your situation, but MASM is very ungraceful about forward references (i.e., references to symbols defined later in the file). 'Course I can't tell if this is a forward reference to "lentr" and, to my knowledge, the problem I'm referring to has only manifested itself in instances where an instruction maay have either an eight or sixteen bit operands. Since your problem involves a "mov dl," instruction no such ambiguity should exist- though MASM may act as though the operand can be 8 or 16 bits and not look at the instruction until later, who knows? You mentioned MASM 4.0. Are you using 4.0 or a later version? I have 5.1 which is less buggy and faster, though I know use TASM. } I was wondering if anyone knows of some way to keep MASM from inserting the } nop instruction. I didn't put it in the assembler source, so I don't want } it in the resulting executable. I know that you should avoid forward references whenever possible, but, like I said, I don't know if that applies to you. Larry -- Larry A. Shurr (cbnmva!las@att.ATT.COM or att!cbnmva!las) The end of the world has been delayed due to a shortage of trumpet players. (The above reflects my opinions, not those of AGS or AT&T, but you knew that.)