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 4,294 of 4,675   
   wolfgang kern to All   
   Re: pusha and popa changes to sp registe   
   21 Jan 21 11:37:08   
   
   From: nowhere@nospicedham.never.at   
      
   On 21.01.2021 08:23, bilsch01 wrote:   
   > I read the x86 instruction reference. It is clear to me that pusha   
   > will decrement sp by 16. But it sounds like popa will increment sp by   
   > only 14. Is that correct?   
   >   
   > The text of the reference for popa says:   
   >   
   > Pops doublewords (POPAD) or words (POPA) from the stack into the   
   > general-purpose registers. The registers are loaded in the following   
   > order: EDI, ESI, EBP, EBX, EDX, ECX, and EAX (if the operand-size   
   > attribute is 32) and DI, SI, BP, BX, DX, CX, and AX (if the operand-size   
   > attribute is 16). (These instructions reverse the operation of the   
   > PUSHA/PUSHAD instructions.) The value on the stack for the ESP or SP   
   > register is ignored.   
   > Instead, the ESP or SP register is incremented   
   > after each register is loaded.   
      
   this last sentence is just nonsense, both PUSHA(d) and POPA(d)   
   add/sub 16(32) bytes after all moves done.   
   But POPA wont alter (e)SP, coz this wouldn't make any sense.   
      
   So this two instructions pair just fine :)   
   __   
   wolfgang   
      
   --- 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