add IMMEDIAET and handle it
[rrq/rrqforth.git] / compile.asm
index 6ddf3a3387b916450ccf72ca5963ca0a75199580..8a86f06c58a8356cabc1ab15bd036b669174f0fc 100644 (file)
@@ -46,7 +46,7 @@ p_create_COPY:
        add qword [p_here_DFA],rax
        next
        
-       WORD p_quote,"'",fasm,IMMEDIATE
+       WORD p_quote,"'",fasm
        ;; ( "word" -- cfa )
        ;; Find the following word and push its cfa, or 0
        pushr rsi
@@ -108,7 +108,7 @@ p_quote_end:
        mov qword [rax+8],dodoes
        next
 
-       WORD p_literal,'LIT',fasm,IMMEDIATE
+       WORD p_literal,'LIT',fasm
        ;; ( -- v )
        ;; Push the value of successor cell onto stack, and skip it.
        ;; not for interactive use!!
@@ -225,7 +225,7 @@ p_numper_POSITIVE:
        ;; ( stream* -- *?* flag )
        ;; Execute the words from the given stream
        ;; returns 1 if stream ends and 0 if an unknown word is found
-       dq p_ltR                ; Keep the stream on the return stack.
+       dq p_gtR                ; Keep the stream on the return stack.
 p_evaluate_stream_PROMPT:
        dq p_depth
        dq p_dot
@@ -263,6 +263,11 @@ p_evaluate_stream_NOTWORD:
        dq p_drop
        dq p_number
        BRANCH 0,p_evaluate_stream_BAD ; branch if 0
+       dq p_state
+       dq p_get
+       BRANCH 0,p_evaluate_stream_AFTER ; branch if 0
+       dq p_literal, p_literal
+       dq p_comma, p_comma
 p_evaluate_stream_AFTER:
        dq p_Rget
        dq p_stream_nchars
@@ -295,3 +300,11 @@ p_evaluate_stream_BAD:
        dq p_left_bracket
        dq p_literal, p_exit
        dq p_comma
+
+       WORD p_immediate,'IMMEDIATE',fasm,IMMEDIATE
+       ;; ( -- )
+       ;; Set "immediate flag" of the word being defined
+       mov rax,qword [p_wordlist_DFA]
+       mov rax,qword [rax]     ; tfa of most recent word
+       mov qword [rax+16],1    ; set the flags field to 1
+       next