diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/openbios/forth/lib/rstack.fs | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
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 |