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,570 of 4,675    |
|    R.Wieser to Remember that I    |
|    Re: EXE program stack setup questions    |
|    10 Oct 18 20:00:43    |
   
   From: address@nospicedham.not.available   
      
   Alexei,   
      
   > Somehow yours doesn't allocate space on the stack   
   > for the local variables and expects BP to have a   
   > meaningful value. Yours doesn't preserve BX, SI, DI   
   > on the stack either.   
      
   Yeah, that is what you get when you do not tell it certain things (like that   
   you want to have local variables). Remember that I said I am using Borlands   
   Tasm ?   
      
   > Did you alter the code in my tiny0.asm?   
      
   I made the mistake once to assume you wanted something else than your code   
   to run, and I was not going to repeat it. So no. I copied-and-pasted that   
   code into an empty file and ran the assembler and linker.   
      
   > It's only now that you start telling us about the   
   > structure of your code. Better later than never, eh? :)   
      
   Actually, I gave multiple "hints" to it in my intial message. Like the   
   usage of ".stack {size}". But yes, I could possibly have been more   
   explicit to it.   
      
   > Um, I'm not sure this combination (of model and stack   
   > directive) is something that was ever intended to work   
   > in an .EXE.   
      
   I don't think so either, and was therefore a bit surprised to see you post   
   that code. I had no idea what it was for.   
      
   By the way, does your assembler recognise those "@@" prefixes as meaning   
   "this is a local variable" too ? Or where they still globally usable   
   (would do rather funny stuff ofcourse, but thats another problem).   
      
   > However, .stack isn't necessary as its main function   
   > can be achieved by other means (see the code above).   
      
   I know. I described *two* methods, remember ? One without, and one with   
   that directive. Its just that both have their own problems.   
      
   > What's left now? You want the precious .code, .data,   
   > .data? directives back?   
      
   No need, as *I* never lost them. :-)   
      
   But yes. I was-and-still-am looking for for a(nother) directive which   
   creates a stack, but conforms to/works together with the ".model"   
   directive - which, in this case, is tiny. In other words, will keep SS   
   equal to CS and only changes SP. That would be the absolute best solution.   
      
   > Anything else?   
      
   Well, if you know about a directive which tells Tasm/Tlink to limit the   
   ammount of allocated memory to what the program actually needs (instead of   
   it taking hold of *all* the available memory) than that would be grand too.   
   :-)   
      
   Although I mentioned I already fixed that using another program, but the   
   less additional junk the better.   
      
   Regards,   
   Rudy Wieser   
      
   P.s.   
   Rick came with a simple idea to fix the stack in the program itself, without   
   getting bothered by the main procedure having a SP and BP altering   
   stack-setup. But not even needing to use that (and being able to just   
   straight-up use the values as provided by the EXE header) would be even   
   better.   
      
   --- 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