adding execution control words
[rrq/rrqforth.git] / compile.asm
index fa850d404f16c15b96aa2b6b7df3c1f450c51143..8e87bf87012e2403217c7aa8e29963c79a41f70f 100644 (file)
@@ -115,10 +115,34 @@ p_quote_end:
        add rsi,8
        next
 
-       WORD p_literal_string,'S"',fasm ;; " (fool emacs)
+       WORD p_literal_string,'S"',fasm,IMMEDIATE ;; " (fool emacs)
        ;; ( -- char* n )
        ;; Save string on heap to make available at interpretation
        ;; not for interactive use!!
+       cmp qword [p_state_DFA],0
+       je p_literal_string_executing
+       pushr rsi
+       mov rdi,qword [p_here_DFA]
+       mov qword [rdi],p_literal_string
+       add rdi,8
+       mov qword [p_here_DFA],rdi
+       DOFORTH p_double_quote
+       pop rcx
+       pop rsi
+       mov rdi,qword [p_here_DFA]
+       mov qword [rdi],rcx
+       add rdi,8
+p_literal_string_copy:
+       dec rcx
+       jl p_literal_string_copied
+       movsb
+       jmp p_literal_string_copy
+p_literal_string_copied:
+       mov qword [p_here_DFA],rdi
+       popr rsi
+       next
+       
+p_literal_string_executing:
        mov rax,qword [rsi]
        add rsi,8
        push rsi
@@ -257,6 +281,7 @@ p_evaluate_stream_INTERPRET:
        dq p_execute
        BRANCH ,p_evaluate_stream_AFTER
 p_evaluate_stream_COMPILE:
+       dq p_tfa2cfa
        dq p_comma
        BRANCH ,p_evaluate_stream_AFTER
 p_evaluate_stream_NOTWORD: