;;; This file contains words dealing with word lists (vocabularies) ;;; WORD p_wordlists,'WORDLIST',dovariable ;; VARIABLE WORDLIST is the currently active wordlist. dq last_word WORD p_strncmp,'STRNCMP',fasm ;; ( chars1 chars2 n -- flag ) ;; Compare bytes until one is NUL, return <0, =0 or >0 to ;; indicate that chars1 is lesser, they are equal, or chars2 ;; is lesser in ascii ordering respectively. pop rdx pop rbx pop rax xor rcx,rcx ;; rax = chars1, rbx = chars2, cl = byte acc, rdx = length inc rdx p_strncmp_loop: dec rdx je p_strncmp_end mov cl,[rax] inc rax sub cl,[rbx] inc rbx je p_strncmp_loop p_strncmp_end: push rcx next WORD p_find,'FIND' ;; ( chars length -- [ chars 0 | cfa 1 ) ;; Search the current wordlists for the given pname mov rcx,[p_wordlists_DFA] p_find_loop: cmp rcx,0 je p_find_done mov rbx,[rsp] mov rax,[rsp+8] cmp bl,byte [rcx+10] jne p_find_nextword push rcx ;; check word push rax push rcx+11 push rbx DOFORTH p_strncmp pop rax ; return value pop rcx cmp rax,0 je p_find_done p_find_nextword: mov rcx,[rcx] jmp p_find_loop p_find_found: mov qword [rsp+8],rcx ; replace chars with tfa mov rcx,1 p_find_done: push rcx next