Re: Dual Stack Design Question Message #6 Posted by Vassilis Prevelakis on 7 Feb 2006, 8:48 p.m., in response to message #1 by Namir
I think we have been through this discussion before.
If you want compatibility with existing programs you cannot change the stack size (will break assumptions of how the stack will look like after RDN, R^ and stack drop).
So how about a pointer into a "large" register bank that tells
you where your 4+1 stack is located. You can have a command (say STACK nnn) that sets the stack pointer.
Default is STACK 000. If you want to create a new stack use STACK 005.
OR
You may even have a PUSHST and POPST that "push" and "pop" your entire stack into a stack-of-stacks. But why stop at that? Why not save additional processor state (e.g. flags), program file, etc so that you can push you entire HP41 CPU state into the stack, carry out your task and then pop it. Note that you will need some way of accessing data from that stack so that you can retrieve arguments and return results. In this way you can implement a "native" HP-41 command that retains stack contents, LASTx, ALPHA, flags etc, that is not part of the spec of the command.
**vp
BTW the first technique is used in RISC processors like the MIPS.
|