Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

psh/pul

Status
Not open for further replies.

007NTO

Technical User
Apr 22, 2006
1
CA
Why would one need to use the PSH/PUL instruction in MAIN?

Isn't the PSH/PUL instruction for 'saving the main's register
contents', thus wouldn't we only need to PSH/PUL when a register is
used in main (not the register used for passing)???

 
Sometimes push and puls in a main routine is used if you
are not sure that the routines you call will save the
registers in use that you want to use again for a next call.
Also it is possible that the routine you are calling expects the values it uses are on the stack.

In some operating systems you can only return with all
registers holding the same information when your program
was started.

But in all other cases, you don't have to but you can
save the registers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top