![]() |
modified by Russ Webb on 2004-04-22 21:11:48 Author - Jann Scheuer Email: scheuer@coco.ihi.ku.dk Webpage: Summary: Manipulates stack and saves up to 21 stack items in memory Instructions: The application manipulates the rpn stack and saves an rpn stack of up to 21 items in memory. Dn, Up - scrolls stack items back and forth between saved stack and rpn stack. (Items are deleted from rpn and saved stack respectively.) Ld - puts (loads) rpn stack on top of saved stack. Sh - puts saved stack on top of rpn stack. Items are not deleted from saved stack. This allows you to keep a copy of a stack of up to 21 items in memory. R+ - rotates rpn stack. R- - rotates rpn stack backwards. Srt - sorts rpn stack in ascending order. (slow) Rev - reverses order of items in rpn stack. Gt - gets value of tos'th rpn stack item. Pt - puts nos in tos'th rpn stack item. Sp - swaps nos'th and tos'th stack item. Mn - Menu: Hs - shows heigth of rpn stack. # - shows heigth of saved stack. Cls - clears rpn stack. Clm - clears saved stack. Ran - puts tos randomized items between +nos and -nos on top of rpn stack. Stack indexes for Gt, Pt and Sp refer to the rpn stack before(!) function values are put on the stack. Some functions do not work for rpn stacks of more than 37 items. Code: RPN.1.z+1 "Stack" "Dn: Tos to memory" h(xv#'21'<(xv1+XvxvX@)); "Up: Memory to tos" xv(xvx@xv1-Xv); "Ld: Load stack into memory" {xv#'21'<(xv1+XvxvX@:B)h!(B)}; "Sh: Show memory" xv!(.)xvV{vx@v1-Vv1<(B)}; ~ "R-: Rotate backwards"hk@; "R+: Rotate"hr@; "Srt: Sort stack" {1Xz0Xwh1-V{_vxw1+Xw xwg@Xxxw1+g@Xyxxxy> (0Xzxyxw1+p@xxxw2+p@)}xz(B)}; "Rev: Reverse stack" h2<(.)hXw2V{vr@v1+Vvxw>(B)}; ~ "Gt: Get (tos)"g@; "Pt: Put nos in (tos)"1+p@; "Sp: Swap (tos) and (nos)" XyXzxyg@Xwxzg@Xx xwxz1+p@xxxy1+p@; "Mn: Misc."D'Height of stack, # saved, clear \stack, clear memory, random |Hs|#|Cls|Clm|Ran|-|'c(h:xv:hV{_vd1}:0Xv:VXwv#'39'>(#'39'V){_v#''xw%1+}:;); |