diff options
Diffstat (limited to 'roms/openbios/forth/lib/rstack.fs')
-rw-r--r-- | roms/openbios/forth/lib/rstack.fs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/roms/openbios/forth/lib/rstack.fs b/roms/openbios/forth/lib/rstack.fs new file mode 100644 index 000000000..c095a9efd --- /dev/null +++ b/roms/openbios/forth/lib/rstack.fs @@ -0,0 +1,21 @@ +\ tag: pseudo r-stack implementation for openbios +\ +\ Copyright (C) 2016 Mark Cave-Ayland +\ +\ See the file "COPYING" for further information about +\ the copyright and warranty status of this work. +\ + +\ +\ Pseudo r-stack implementation for interpret mode +\ + +create prstack h# 20 cells allot +variable #prstack 0 #prstack ! + +: prstack-push prstack #prstack @ cells + ! 1 #prstack +! ; +: prstack-pop -1 #prstack +! prstack #prstack @ cells + @ ; + +: >r state @ if ['] >r , exit then r> swap prstack-push >r ; immediate +: r> state @ if ['] r> , exit then r> prstack-pop swap >r ; immediate +: r@ state @ if ['] r@ , exit then r> prstack-pop dup prstack-push swap >r ; immediate |