using IFAGAIN instead
[rrq/rrqforth.git] / stack.asm
index d86727680763c9e93b6c691a361b3657baeb4e88..637d8aca69da1a778e004f4cee3d4694d089ddaa 100644 (file)
--- a/stack.asm
+++ b/stack.asm
@@ -1,5 +1,14 @@
 ;;; Words for stack manipulations
        
+       WORD p_dsp,'D[n]',fasm
+       ;; ( n -- a )
+       ;; Push the address of the n:th cell below n onto the stack
+       pop rax
+       shl rax,3
+       add rax,rsp
+       push rax
+       next
+
        WORD p_depth,'DEPTH',fasm
        ;; ( -- v )
        ;; Push stack depth (before push)
@@ -151,3 +160,17 @@ p_roll_eq:
        ;; Copy x from the return stack to the data stack.
        push qword [rbp]
        next
+
+       WORD p_rbp,'RSP',fasm
+       ;; Push the return stack pointer to the data stack
+       push rbp
+       next
+       
+       WORD p_rbpn,'R[n]',fasm
+       ;; ( n -- a )
+       ;; push the address of the n:th cell on the return stack
+       mov rax,qword [rsp]
+       shl rax,3
+       add rax,rbp
+       mov qword [rsp],rax
+       next