From: Ralph Ronnquist Date: Tue, 18 May 2021 08:22:07 +0000 (+1000) Subject: added WORDS X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=b656a03079ae6e5c2d5b7a182fa7a9dbda4e0db4;p=rrq%2Frrqforth.git added WORDS --- diff --git a/wordlists.asm b/wordlists.asm index 9790a28..ae3062b 100644 --- a/wordlists.asm +++ b/wordlists.asm @@ -1,9 +1,40 @@ ;;; This file contains words dealing with word lists (vocabularies) -;;; - WORD p_wordlists,'WORDLIST',dovariable + + WORD p_wordlist,'WORDLIST',dovariable ;; VARIABLE WORDLIST is the currently active wordlist. dq last_word + WORD p_words,'WORDS',fasm + ;; ( -- ) + ;; Dump all words + pushr rsi + push qword [p_wordlist_DFA] +p_words_LOOP: + mov rax,qword [rsp] + cmp rax,0 + je p_words_END + ;; tfa>pfa + add rax,9 + ;; pfa@ => ( chars* length) + xor rbx,rbx + mov bl,[rax] + inc rax + push 1 + push rax + push rbx + DOFORTH sys_write + pop rax ; ignore errors + push 10 + DOFORTH p_emit + mov rax,qword [rsp] + mov rax,qword [rax] + mov qword [rsp],rax + jmp p_words_LOOP + +p_words_END: + popr rsi + next + WORD p_strncmp,'STRNCMP',fasm ;; ( chars1 chars2 n -- flag ) ;; Compare bytes until one is NUL, return <0, =0 or >0 to @@ -30,7 +61,7 @@ p_strncmp_end: WORD p_find,'FIND' ;; ( chars length -- [ chars 0 | cfa 1 ) ;; Search the current wordlists for the given pname - mov rcx,[p_wordlists_DFA] + mov rcx,[p_wordlist_DFA] p_find_loop: cmp rcx,0 je p_find_done