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,571 of 4,675   
   Rick C. Hodgin to R.Wieser   
   Re: EXE program stack setup questions   
   10 Oct 18 14:21:50   
   
   From: rick.c.hodgin@gmail.com   
      
   On 10/10/2018 12:57 PM, R.Wieser wrote:   
   > Rick,   
   >   
   >> The value there for SP is probably correct.  It will   
   >> wrap to 0xfffe on the first use, which will place it   
   >> at the top of the 64 KB block of memory in use.   
   >   
   > I think I also mentioned that, not sure anymore if it was to Alexei or you.   
   > And yes, it will work.  But no, it isn't acceptable.    I don't want a 64   
   > KByte block occupied when the full program uses (way) less than that.   That   
   > is why I got this thread started :-)   
      
   In that case, issue a:   
      
        MOV SP,OFFSET last_thing_in_asm_file + desired_stack_size   
      
   >> If you needed to adjust your stack manually you would re-define your main   
   >> function to be a tiny little bit of code that doesn't have local local   
   >> storage, but simply fixes up the stack, and then issues a JMP to your real   
   >> "main" program, which you could call "main2" or something.   
   >   
   > Shucks.  I have used that "trick" on other occasions, but I didn't think of   
   > it here.   Yes, that would do the job quite nicelyl.   
      
   Do that in your main proc, and then JMP main2 to begin your real   
   code.  That way it will not start at 0, wrapping to 0xfffe, but   
   it will start wherever you indicate, at the end of your true asm   
   code + data + whatever size you desire for your stack.   
      
   --   
   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