www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/04/23:06:06

Message-Id: <199701060350.EAA06726@math.amu.edu.pl>
Comments: Authenticated sender is <grendel AT ananke DOT amu DOT edu DOT pl>
From: "Mark Habersack" <grendel AT ananke DOT amu DOT edu DOT pl>
Organization: Home, sweet home (Poznan, Poland)
To: "Nikita Proskourine" <nproskou AT goucher DOT edu>
Date: Sun, 5 Jan 1997 04:48:27 +0100
MIME-Version: 1.0
Subject: Re: NASM
Reply-to: grendel AT ananke DOT amu DOT edu DOT pl
CC: djgpp AT delorie DOT com

Once upon a time (on  4 Jan 97 at 20:42) Nikita Proskourine said:

> Thanks, I already got NASM from one of SimTel mirrors. It seems like
> a really good way to use old .asm code with djgpp, but I got a
> problem: it doesn't seem to recognize "mov byte ptr". What am I
> doing wrong? Oh, another thing, how do I define stack size in my asm
To reference memory in NASM you use the following syntax

    mov     ax, [your_var] ; Moves ax to the address contained in 
                                         ;your_var

therefore there's no need for the 'ptr' keyword
NASM usually uses your operand names to determine argument size (in 
the above example it will assume 'your_var' to point to a word). NASM 
is able to specify other argument size by means of 'word' and 'dword' 
keywords:

   mov      ax, [word es:di]

However these two are the only ones to modify operand size (there are 
others as A16, A32, O16, O32 - read about them in section "Writing 
Programs with NASM" of the nasm.doc, make sure to read the section 
entitled "Unusual Instruction Sizes"). So the conclusion is: don't 
bother with the operand sizes - NASM is good enough to deduce it for 
you.


> program (I am used to .STACK <size>)
Hmm... the only target that supports stack allocating is Micro$oft 
OMF. You declare the stack segment like this:

[SEGMENT STCK STACK] ; or [SECTION STCK STACK]

TIMES 4096 db 0

which defines a 4KB stack. The other formats cannot define stacks.

###########################################################
We're terminal cases that keep taking medicine pretending
the end isn't quite that near. We make futile gestures,
act to the cameras with our made up faces and a PR smiles.
And when the angel comes down to deliver us, we'll find out
after all we're only men of straw.
----
Visit http://ananke.amu.edu.pl/~grendel

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019