additional part-cell primitives
[rrq/rrqforth.git] / temp.asm
index 62ae251a12a52d27a475c410ffc37fe7c208d84b..8e0be257f11e4f7bbf022d82dba366f94528141c 100644 (file)
--- a/temp.asm
+++ b/temp.asm
@@ -7,9 +7,9 @@
 
        WORD p_objectspace,'TEMPSPACE',dovariable
        ;; Holds size and address of the object space.
-       dq 104857600 ; Total object space size (request size)
-       dq 0 ; Object space base address
-       dq 0 ; Currently used.
+       dq 104857600 ; [0] Total object space size (request size)
+       dq 0 ; [8] Object space base address
+       dq 0 ; [16] Currently used.
 
        WORD p_temp,'TEMP',fasm
        ;; ( size -- addr )
@@ -29,6 +29,7 @@ p_objecthole_initialized:
        mov qword [p_objectspace_DFA+16],0
        mov rax,qword [rsp]
 p_objecthole_from_tail:
+       ;; rax = new usage count
        mov rbx,qword [p_objectspace_DFA+16]
        mov qword [p_objectspace_DFA+16],rax
        add rbx,qword [p_objectspace_DFA+8]
@@ -36,15 +37,25 @@ p_objecthole_from_tail:
        popr rsi
        next
 
-       WORD p_str2temp,'STR>TEMP'
+       WORD p_str2temp,'STR>TEMP',fasm
        ;; ( char* n -- char* n )
        ;; Capture a given [n:char*] string as a new temp object with
        ;; leading size cell.
-       dq p_dup, p_gtR         ; ( -- char* n ) [ n ]
-       dq p_dup, p_temp        ; ( -- char* n  addr )
-       dq p_dup, p_gtR         ; ( -- char* n  addr ) [ n addr ]
-       dq p_2dup, p_put
-       dq p_literal, 8, p_plus
-       dq p_swap, p_strncpy
-       dq p_Rgt, p_Rgt
-       dq p_exit
+       pushr rsi
+       mov rax,qword [rsp]
+       add rax,8
+       push rax
+       DOFORTH p_temp          ; ( -- char* n  addr )
+       pop rax
+       pop rbx
+       mov qword[rax],rbx
+       add rax,8
+       pop rcx
+       push rax
+       push rbx
+       push rcx
+       push rax
+       push rbx                ; ( -- addr n char* addr n )
+       DOFORTH p_strncpy
+       popr rsi
+       next