Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-spam!ames!amdahl!bnrmtv!perkins From: perkins@bnrmtv.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: Please explain this MASM/LINK behavior... Message-ID: <2474@bnrmtv.UUCP> Date: Tue, 1-Sep-87 15:30:40 EDT Article-I.D.: bnrmtv.2474 Posted: Tue Sep 1 15:30:40 1987 Date-Received: Fri, 4-Sep-87 01:27:20 EDT References: <88@wjh12.HARVARD.EDU> Organization: BNR Inc., Mountain View, California Lines: 49 Keywords: MASM LINK bug? Summary: Problem is with MASM, not LINK In article <88@wjh12.HARVARD.EDU>, lotto@wjh12.HARVARD.EDU (Jerry Lotto) writes: > Code_Seg Segment Para 'CODE' > Assume CS:Code_Seg > Org 100H > Begin: mov ax, Code_Seg:[2ch] > Code_Seg Ends > End Begin > assembles fine, but generates a link error (invalid object module). > If you rewrite the Begin line > to read: > Begin: mov ax, [2ch] > everything works OK. I repeat that MASM generates NO warnings > or errors of any kind. The problem is with MASM not complaining about the mov ax, Code_Seg:[2ch] line. This SHOULD be written as mov ax, cs:[2ch] if you want to make use of the ASSUME directive and specify the code segment. There's no 8086 addressing mode that allows a segment to be specified as immediate data for a MOV instruction. Of course, since you're making a .COM file, you can make use of the fact that CS and DS both already point to your one and only segment, and omit the segment override, which then defaults to using DS. That's what you're doing in the example that works. If you had any data declarations in this segment, you'd also want to put in an Assume DS:Code_Seg In the several iterations of MASM, Microsoft has managed to make it fairly reliable in assembling correct instructions, but they're still woefully lacking in error handling capability. -- {hplabs,amdahl,ames}!bnrmtv!perkins --Henry Perkins It is better never to have been born. But who among us has such luck? One in a million, perhaps.