From: Martin Stromberg Message-Id: <200110021059.MAA19543@lws256.lu.erisoft.se> Subject: Re: in-line assembly syntax for GNU ASM/DJGPP To: Tony_Cappellini AT maxtor DOT com (Cappellini, Tony) Date: Tue, 2 Oct 2001 12:59:05 +0200 (MET DST) Cc: djgpp AT delorie DOT com In-Reply-To: <09D1E9BD9C30D311919200A0C9DD5C2C03E08A65@mcaexc01.msj.maxtor.com> from "Cappellini, Tony" at Aug 30, 2001 02:19:57 PM X-Mailer: ELM [version 2.5 PL3] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Don't forget to CC djgpp so others can help as well and so I can answer by news which is how I prefer to read the djgpp list. > : Would someone help me with the correct asm syntax for DJGPP for the > : following Intel format instructions > > : mov AX, OFFSET count > > >>movw $count, %%ax > > How can you be sure the offset is being moved into ax, and not the value in > count ?? I'm not. Or rather was not. I just tried it and it works as expected. I think the answer to your question is "$" means a literal value, i. e. it might do something strange but of all things it possibly could do, it will _not_ move the contents of "count" into ax. Actually here's one case where the AT&T syntax shines in comparision with Intel: "mov , ax" will move something into ax. If you want something literal moved into ax you specify it as literal. In Intel syntax "mov ax, " will do different things if something is a literal or a variable. If "mov ax, 1" moves 1 into ax then I'd expect "mov ax, my_var" to move what my_var is (an offset) into ax, not the contents at the offset of my_var into ax - what a mess! And still Intel do have a "take the contents" operator: [ ]. So if they had had their brains connected while designing their syntax, we could have had it like this: if you wanted the variables value you'd use "mov ax, [ my_var ]" exactly as when you do "mov ax, [ bx ]" Nasm, which claims it doesn't think for you, has the same misfeature, I think. Right, MartinS