home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,555 of 4,675   
   Rick C. Hodgin to R.Wieser   
   Re: EXE program stack setup questions   
   07 Oct 18 07:50:40   
   
   From: rick.c.hodgin@gmail.com   
      
   On 10/07/2018 06:59 AM, R.Wieser wrote:   
   > ...To be honest, I have absolutily *no* idea why you   
   > would want to allocate (much, but unknown) more than what the program   
   > actually needs.   It only serves to cause problems when you would want to   
   > allcoate some memory later on (no memory available anymore, its all in use   
   > by the program)   
      
   It was/is a common practice for .COM files to resize their memory   
   block after startup to just the size their app actually needs, and   
   then to attempt to allocate a larger block than is available so it   
   will fail, and then they learn how much is available.   
      
   You can then do some manual setup for your application, moving the   
   stack to another segment if you like, allocating the memory you   
   just resized so you now know how big it is, etc.   
      
   > I want a TINY model, with *all* segments overlapping (SS=ES=DS=CS), for easy   
   > access to stack-based data structures.   
      
   IIRC, in such a model, typically the stack is initialized to the   
   top of the indicated segment, and everything else is done below   
   that.   
      
   Such a design allows all of your pointers to be 16-bit, and you   
   gain some speed by not having to deal with 20-bit pointer math.   
   It should be handled for you automatically by the program loader.   
      
   Load debug.  Load your program in debug.  Add an INT 3 breakpoint   
   at the start of your code, and then display registers to see what   
   they are actually set to.  You can also do this with Microsoft's   
   CodeView debugger if you can find a copy of MASM 6.x to download   
   online.  CodeView 3 was smaller / faster.  CodeView 4 was bigger,   
   but had some better capabilities.  Both were nice.   
      
   --   
   Rick C. Hodgin   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca