added return stack access primitives
authorRalph Ronnquist <ralph.ronnquist@gmail.com>
Thu, 20 May 2021 19:22:06 +0000 (05:22 +1000)
committerRalph Ronnquist <ralph.ronnquist@gmail.com>
Thu, 20 May 2021 19:22:06 +0000 (05:22 +1000)
stack.asm

index 9726cc2b8eb2883c2e4df7ad4e2a0f7272427b27..91be19d71963d217ee453051f14abdc80cc9d2b2 100644 (file)
--- a/stack.asm
+++ b/stack.asm
@@ -119,3 +119,26 @@ p_roll_eq:
        push rbx
        push rax
        next
+
+;;; ========================================
+;;; Return stack operations
+
+       WORD p_ltR, '>R',fasm
+       ;; ( x -- ) ( R: -- x )
+       ;; Move x to the return stack.
+       pop rax
+       pushr rax
+       next
+
+       WORD p_Rgt, 'R>',fasm
+       ;; ( -- x ) ( R: x -- )
+       ;; Move x from the return stack to the data stack.
+       popr rax
+       push rax
+       next
+
+       WORD p_Rget, 'R@',fasm
+       ;; ( -- x ) ( R: x -- x )
+       ;; Copy x from the return stack to the data stack.
+       push qword [rbp]
+       next