The number of elements on the stack is only limited by the available memory.
The program works both in NSTK and 4STK mode.
Usage
- XEQ "Push": Topmost element is removed from the stack and stored on the newstack, LASTX is preserved
- XEQ "Pop": Toṕmost element is removed from the new stack and stored on the normal stack. If there is no element left on the stack the POP routine returns "NONEXISTENT" error 6.
- XEQ "PushAll": The complete stack is saved on the newstack.
- XEQ "PopAll": Every element on new stack is popped.
I replaced my original source code of PUSH with Thomas Okkens version because it is better than my first version. The POP routine has been changed not to return NO but the error NONEXISTENT if the stack is empty.
Source Code
Code: Select all
00 { 104-Byte Prgm }
01▸LBL "Push"
02 FUNC 10
03 NEWLIST
04 X<>Y
05 APPEND
06 SF 25
07 RCL "μ"
08 FS?C 25
09 EXTEND
10 STO "μ"
11 RTN
12▸LBL "PushAll"
13 LNSTK
14 DEPTH
15 LSTO "c"
16 DROP
17▸LBL 02
18 XEQ "Push"
19 DSE "c"
20 GTO 02
21 RTN
22▸LBL "Pop"
23 FUNC 01
24 SF 25
25 HEAD "μ"
26 RTN
27 RTNERR 6
28▸LBL "PopAll"
29 SF 25
30▸LBL 00
31 XEQ "Pop"
32 FS? 25
33 GTO 00
34 CF 25
35 END
Here you can download the PUSHPOP.raw file.