Re: STACK IMPLEMENTATION
- From: mojaveg@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx (Everett M. Greene)
- Date: Tue, 31 Jul 2007 11:10:55 PST
bastian42@xxxxxxxxx (42Bastian Schick) writes:
Tim Wescott <tim@xxxxxxxxxxxxxxxx> wrote:
Tom Lucas wrote:
"Paul Burke" <paul@xxxxxxxxxx> wrote
dk wrote:
I am trying to understand if i implement something like this in my
micro what would happen. My understanding is that i will lose the the
value of 'A'
CALL PUSH_A
.
.
.
CALL POP_A
PUSH_A : PUSH A
RET
POP_A: POP A
RET
Note that on some processors the call stack is separate from the data
stack (I believe this is the case on the PIC18 and the 6805, but I
haven't picked through either of them in detail). For these processors,
pushing a register onto the data stack then returning from a subroutine
wouldn't lose you your program counter, although it could certainly mess
up your data stack if you weren't planning on that behavior.
Just let me add, that many RISCs (PPC, ARM) do not push the return
address on the stack automatically, so calling will
not directly interfere with the stack (I do above things in my own
code a lot :-)
And there are some processors, AVR for instance, where all the
direct stack operations are to/from the hardware stack but many
code implementations use a separate "software" stack.
.
- References:
- STACK IMPLEMENTATION
- From: dk
- Re: STACK IMPLEMENTATION
- From: Paul Burke
- Re: STACK IMPLEMENTATION
- From: Tom Lucas
- Re: STACK IMPLEMENTATION
- From: Tim Wescott
- Re: STACK IMPLEMENTATION
- From: 42Bastian Schick
- STACK IMPLEMENTATION
- Prev by Date: Re: Estimation techniques used in embedded porting projects
- Next by Date: Re: Estimation techniques used in embedded porting projects
- Previous by thread: Re: STACK IMPLEMENTATION
- Next by thread: Rabbit 4k and ethernet
- Index(es):
Relevant Pages
|