- WORD p_wordlists,'WORDLIST',dovariable
- ;; VARIABLE WORDLIST is the currently active wordlist.
- dq last_word
+;;; CURRENT-WORDLIST (variable) points out "the current wordlist"
+;;; FORTH is a word list
+;;;
+
+ ;; FORTH is the last word of WORDLIST FORTH
+ WORD p_forth,'FORTH',dovariable
+ ;; The FORTH word list
+ dq last_forth_word ; tfa of last FORTH word
+ dq 0 ; successor word list dfa
+
+ WORD p_wordlist,'CURRENT-WORDLIST',dovariable
+ ;; CURRENT-WORDLIST points to dfa of the currently active wordlist.
+ dq p_forth_DFA ; compilation word list
+
+ WORD p_words,'WORDS',fasm
+ ;; ( w -- )
+ ;; Dump all words of the word list w (the dfa of a word list)
+ pushr rsi
+p_words_LOOP:
+ mov rax,qword [rsp]
+ mov rax,qword [rax] ; Next word
+ mov qword [rsp],rax
+ cmp rax,0
+ je p_words_END
+ tfa2pfa rax
+ push 1 ; stdout
+ pushpname rax ; ( pfa* -- chars* length )
+ DOFORTH sys_write
+ pop rax ; ignore errors
+ push qword 10
+ DOFORTH p_emit ; ( c -- )
+ jmp p_words_LOOP
+
+p_words_END:
+ pop rax
+ popr rsi
+ next