projects
/
rrq
/
rrqforth.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add INPUT variable for current eval stream
[rrq/rrqforth.git]
/
stack.asm
diff --git
a/stack.asm
b/stack.asm
index 91be19d71963d217ee453051f14abdc80cc9d2b2..5b6910b5cb3bef019f7e10336ca62a4e05194042 100644
(file)
--- a/
stack.asm
+++ b/
stack.asm
@@
-1,5
+1,14
@@
;;; Words for stack manipulations
;;; 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.
WORD p_dup, 'DUP',fasm
;; ( v -- v v )
;; Duplicate top ov stack value.
@@
-110,9
+119,9
@@
p_roll_eq:
push qword [rsp+rax]
next
push qword [rsp+rax]
next
- WORD
w6.2.2300
, 'TUCK',fasm
+ WORD
p_tuck
, 'TUCK',fasm
;; ( x1 x2 -- x2 x1 x2 )
;; ( x1 x2 -- x2 x1 x2 )
- ;;
insert
the top stack value into below second stack value.
+ ;;
copy
the top stack value into below second stack value.
pop rax
pop rbx
push rax
pop rax
pop rbx
push rax
@@
-123,7
+132,7
@@
p_roll_eq:
;;; ========================================
;;; Return stack operations
;;; ========================================
;;; Return stack operations
- WORD p_
l
tR, '>R',fasm
+ WORD p_
g
tR, '>R',fasm
;; ( x -- ) ( R: -- x )
;; Move x to the return stack.
pop rax
;; ( x -- ) ( R: -- x )
;; Move x to the return stack.
pop rax
@@
-142,3
+151,12
@@
p_roll_eq:
;; Copy x from the return stack to the data stack.
push qword [rbp]
next
;; Copy x from the return stack to the data stack.
push qword [rbp]
next
+
+ WORD p_rsp,'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