X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=stack.asm;h=637d8aca69da1a778e004f4cee3d4694d089ddaa;hb=97bcab28825fde3e717ac5489b0f3f19e5e3f5db;hp=d26bf7b2c9d137fd2dc9a152653cbd59d33590a3;hpb=c91525c4bc19d001bbea047376549b1cf07ebbc4;p=rrq%2Frrqforth.git diff --git a/stack.asm b/stack.asm index d26bf7b..637d8ac 100644 --- 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) @@ -132,7 +141,7 @@ p_roll_eq: ;;; ======================================== ;;; Return stack operations - WORD p_ltR, '>R',fasm + WORD p_gtR, '>R',fasm ;; ( x -- ) ( R: -- x ) ;; Move x to the return stack. pop rax @@ -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