From: james.harris.1@nospicedham.gmail.com   
      
   On 04/01/2019 22:58, Rod Pemberton wrote:   
   > On Fri, 4 Jan 2019 14:45:24 +0000   
   > James Harris wrote:   
      
   ...   
      
   >> Insofar as there were broader issues I received some interesting and   
   >> useful answers such as having a fixed block, stable ESP and indexing   
   >> off ESP.   
   >   
   > Weren't you attracted to "RET imm16" instruction which pops items off   
   > of the stack?   
      
   Yes, though with a caveat. RET imm16 is ideal when a callee knows how   
   much stack space is taken up by parameters but it doesn't work with   
   C-style varargs. Then the caller has to clean up the stack.   
      
   In some of my code, including what I am working on just now, it is   
   easiest to have the caller consistently remove what it adds. So each   
   call sequence which pushes parameters includes   
      
    lea esp, [esp + N]   
      
   to remove them.   
      
   >   
   > Weren't you attracted to omitting the frame pointer? I.e., ESP only.   
      
   Yes, a good time ago. I've not written stuff like this for so long I had   
   forgotten about it. Besides, the current code is meant to be   
   sacrificial, i.e. just to bootstrap something else. So performance is   
   unimportant and I find the number of registers I need is very small -   
   normally just EAX and EBX for everything. The only exceptions I can   
   remember coming across are CL for shifts and EDX for multiply and divide.   
      
      
   --   
   James Harris   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|