| ??? 08/31/02 22:24 Read: times |
#28330 - RE: stack pointer question... |
Every PUSH will add one to SP, and every POP will subtract one. Likewise, every CALL will add two to SP and every RET (or RETI) will subtract two.
Your PUSHs and POPs should always be balanced, as should your CALLs and RETs. As long as your PUSH/POPs and CALLS/RETs are balanced--and as long as you don't have too many of them--SP should never overflow. If they aren't balanced, however, or you do too many PUSHs without POPs or too many CALLs without RETs, SP will increase to FFh and then overflow back to 00h. At that point, everything will tend to break. You should generally only need to set SP one time at the initialization phase of a program--not in the MAIN loop. Craig Steiner |
| Topic | Author | Date |
| stack pointer question... | 01/01/70 00:00 | |
| RE: stack pointer question... | 01/01/70 00:00 | |
| RE: stack pointer question... | 01/01/70 00:00 | |
RE: stack pointer question... | 01/01/70 00:00 |



