Article View: net.micro.pc
Article #5441Re: Microsoft Assembler (Bug?)
From: Frank Whaley
Date: Wed, 29 Jan 1986 01:17
Date: Wed, 29 Jan 1986 01:17
43 lines
2218 bytes
2218 bytes
In article <231@argon.kcl-cs.UUCP> phil@kcl-cs.UUCP writes:
>I think that the following should assemble without problems:
>PUBLIC foo
>foo PROC NEAR
> mov [si],OFFSET bar
>foo ENDP
>
>bar PROC NEAR
>bar ENDP
>All of this being in the code segment of course. The error message from MASM
>is:
> error 35: Operand must have size
>This happens with both V3.0 and V4.0 of MASM. Is this a bug and how do I get
>around it?
The assembler first converts the "OFFSET bar" into a (relative)
constant, thus forgetting its type (size). This confuses the opcode
generator, which doesn't know if SI is pointing to a byte- or
word-sized data. Thus MASM complains.
The only work-around I found was:
mov [si],Word Ptr (OFFSET bar)
which looks funny, but assembles correctly. The parentheses are
necessary, as:
mov [si],Word Ptr OFFSET bar
again confuses the assembler. The fact that the compiler outputs this
code is probably a case of premature optimization (the coder missed one
of the cases). I usually see compilers output something like:
mov ax,OFFSET bar
mov [si],ax
which is one more byte but one less clock (on an 8088).
--
...Frank Whaley, MicroPro Product Development
UUCP: {decvax!decwrl | ucbvax}!dual!
{hplabs | glacier}!well!
seismo!lll-crg!
ihnp4!ptsfa!
pyramid!micropro!sagan!frank
ARPA: micropro!sagan!frank@lll-crg.ARPA
"I'm told there are better programs [than WordStar],
but I'm also told there are better alphabets."
--William F. Buckley Jr.
Technical Details
Message-ID:
<194@sagan.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!amdcad!lll-crg!well!micropro!sagan!frankReferences:
<231@argon.kcl-cs.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 Unisoft-Cosmos; site sagan.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!amdcad!lll-crg!well!micropro!sagan!frank From: frank@sagan.UUCP (Frank Whaley) Newsgroups: net.micro.pc,net.micro Subject: Re: Microsoft Assembler (Bug?) Message-ID: <194@sagan.UUCP> Date: Tue, 28-Jan-86 20:17:07 EST Article-I.D.: sagan.194 Posted: Tue Jan 28 20:17:07 1986 Date-Received: Sat, 1-Feb-86 02:36:04 EST References: <231@argon.kcl-cs.UUCP> Reply-To: frank@sagan.UUCP (Frank Whaley) Organization: MicroPro Int'l Corp., San Rafael, CA Lines: 43