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,557 of 4,675   
   R.Wieser to All   
   Re: EXE program stack setup questions   
   07 Oct 18 21:10:09   
   
   From: address@nospicedham.not.available   
      
   Rick,   
      
   >> should (ofcourse) have been   
   >>   
   >> ;uses [SS:BP+offset]   
   >   
   >   
   >Both BP and SP use SS: by default (without any explicit segment override   
   >prefix).   
      
   I know.  But it was crucial to the example I gave, and I forgot to make it   
   crystal clear. :-(   
      
   > It was/is a common practice for .COM files to resize their memory block   
   > after startup to just the size their app actually needs,   
      
   Thats what I've been doing too.  Because I found out that when I didn't I   
   could not allocate memory anymore.  Never had any need to just find out how   
   much there was still available though.   
      
   >> 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,   
      
   I take it that you mean SS when you say "indicated segment".   But if that   
   is so than SS gets also initialized to that segment, which (thus) isn't the   
   SS=CS situation.   At least, that is what happens under Borlands Tasm and   
   Tlink.   
      
   I described the problem(s) with that in situation #2.   
      
   > It should be handled for you automatically by the program loader.   
      
   It is.  Just not in a way that is usable for me: either with SS != CS -or-   
   with SP = zero.   
      
      
   In fact, that is what my question is all about: Do you, or anyone else, know   
   a way to set up the stack in such a way that SS will equal CS and SP will   
   point at the top of the defined stack space / end of the programs   
   uninitialized memory (either will work for me).   
      
      
   > 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.   
      
   I already know what they are in both situations, and included them in the   
   problem description.   Looking at them again won't do me any good I'm   
   afraid.   
      
   Regards,   
   Rudy Wieser   
      
   --- 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