About PUSH and POP in microprocessor/controller

  • Thread starter Thread starter reddvoid
  • Start date Start date
  • Tags Tags
    Push
Click For Summary

Discussion Overview

The discussion revolves around the behavior of the PUSH and POP operations in microprocessors and controllers, specifically whether these operations move or copy data from registers to the stack and the implications for the contents of the registers involved.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants question whether the PUSH operation moves or copies data from a register to the top of the stack, and what happens to the contents of the register after the operation.
  • One participant asserts that the contents of the register remain unchanged after a PUSH operation, stating that it places a copy of the data onto the stack and adjusts the stack pointer register.
  • Another participant agrees that the content of the register is unchanged, emphasizing that moving operations do not alter the source register.
  • There is a suggestion that unless newer processors have changed this behavior, the PUSH operation does not affect the content of the register.

Areas of Agreement / Disagreement

Participants generally agree that the contents of the register remain unchanged after a PUSH operation, but there is some uncertainty regarding whether this behavior may vary with newer processors.

Contextual Notes

Some assumptions about processor behavior may depend on specific architectures or implementations, and there is no consensus on potential changes in newer processors.

reddvoid
Messages
118
Reaction score
1
Does PUSH operation moves or copies data from register to top of stack ;
I mean, what happens to the contents of the register from which the data is pushed ?
 
Engineering news on Phys.org
Does PUSH operation moves or copies data from register to top of stack ;
I mean, what happens to the contents of the register from which the data is pushed ?
 
nothing, its still there. push just places a copy of the data onto the stack and adjusts the stack pointer register.

pop does the opposite grabbing the top stack data copying to the register and changing the stack pointer register to the next value in the stack.
 
The content of the register is unchanged. Moving operations don't change the source register.
 
Unless the new processors changed, push or move the content of the register on stack don't change the content of the register.
 
Thank you :)
 

Similar threads

  • · Replies 25 ·
Replies
25
Views
5K
  • · Replies 36 ·
2
Replies
36
Views
6K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
Replies
1
Views
3K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 33 ·
2
Replies
33
Views
5K