Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!hp-pcd!hpcvra.cv.hp.com!everett From: everett@hpcvra.cv.hp.com.CV.HP.COM (Everett Kaser) Newsgroups: comp.os.msdos.programmer Subject: Re: Re: MASM generating extra nops in second pass Message-ID: <32430005@hpcvra.cv.hp.com.CV.HP.COM> Date: 3 Dec 90 22:30:08 GMT References: <1990Nov30.165652.9381@cbnews.att.com> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 31 shurr@cbnews.att.com (Larry A. Shurr) writes... > ted@polyof.poly.edu (Theodore S. Kapela, Staff) writes: >} I am having a little problem with Microsoft Macro Assembler v4.00. >} 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 >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? > Larry A. Shurr (cbnmva!las@att.ATT.COM or att!cbnmva!las) My hunch is that it IS a forward reference, and hence MASM doesn't know *WHAT* kind of reference 'lentr' is, a constant, a memory reference, a structure offset, etc. If a constant of some sort, it would require one byte. If a memory reference (yeah, I know, you'd be crazy to use an address in an express- ion like that, but MASM doesn't assume that you're crazy) it would require two bytes (for the address). Always put your equates at the beginning of the file. Everett Kaser Hewlett-Packard Company ...hplabs!hp-pcd!everett work: (503) 750-3569 Corvallis, Oregon everett%hpcvra@hplabs.hp.com home: (503) 928-5259 Albany, Oregon