add DEPTH
authorRalph Ronnquist <ralph.ronnquist@gmail.com>
Sun, 23 May 2021 14:48:07 +0000 (00:48 +1000)
committerRalph Ronnquist <ralph.ronnquist@gmail.com>
Sun, 23 May 2021 14:48:07 +0000 (00:48 +1000)
stack.asm

index 91be19d71963d217ee453051f14abdc80cc9d2b2..32db5aef859f3734a55e32bd854ee68722a27cfd 100644 (file)
--- a/stack.asm
+++ b/stack.asm
@@ -1,5 +1,14 @@
 ;;; Words for stack manipulations
        
+       WORD p_depth,'DEPTH',fasm
+       ;; ( -- v )
+       ;; Push stack depth (before push)
+       lea rax,[DS_TOP]
+       sub rax,rsp
+       shr rax,3
+       push rax
+       next
+
        WORD p_dup, 'DUP',fasm
        ;; ( v -- v v )
        ;; Duplicate top ov stack value.