Re: A83: Re: Stackpointer (sp)


[Prev][Next][Index][Thread]

Re: A83: Re: Stackpointer (sp)




Hi James

The stack is a LIFO structure - Last In First Out, like the plate
chingus in the
cafeteria... Most architectures use a stack to store return addresses
for called routines. Common for OS's to have multiple stacks.

Per TI's docs the 83 stack lives at the top of memory. The Z80 stack
grows downward, in increments of two bytes, presumably from FFFFh. The
size of the stack 
can be inferred from the value contained in the Stack Pointer
(SP)register, which  contains the address of the "top" of the stack -
The most recent entry. 

Since stack entries are in RAM they can be manipulated like any other
data - The 
SP can be diddled as well - This is a great way to get debugging
experience. :)

Regards, Jack

James Matthews wrote:
 
> > It's very simple..  it's just always containing the pointer to
> > (memoryaddress of) the top of the stack.
> > //Olle
 
> What kind of uses does it have?  Ah, I suppose you could read all the stuff
> in the stack etc.  Is there an address anywhere that holds the size of the
> Stack?
> James.


References: