X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=wordlists.asm;h=b2e8260e479d275c24a3162776cb5ab28fc82757;hb=bdaa235a728bbfa87718c3da18e5fb64ca6b6662;hp=c67e6c9f7e5e06963c397568b968029e98e17024;hpb=02ef6e814ef0e6c61348c70bd310ba1f0df2506b;p=rrq%2Frrqforth.git diff --git a/wordlists.asm b/wordlists.asm index c67e6c9..b2e8260 100644 --- a/wordlists.asm +++ b/wordlists.asm @@ -19,34 +19,10 @@ ;;; ;;; WORDLIST ( "name" -- ) = start - WORD p_tfa2cfa,'TFA>CFA',fasm - ;; ( tfa -- cfa ) - ;; Advance a word tfa pointer to the cfa field - mov rax,qword[rsp] - tfa2cfa rax - mov qword [rsp],rax - next - - WORD p_tfa2dfa,'TFA>DFA',fasm - ;; ( tfa -- dfa ) - ;; Advance a word tfa pointer to the dfa field - mov rax,qword[rsp] - tfa2dfa rax - mov qword [rsp],rax - next - - WORD p_dfa2tfa,'DFA>TFA',fasm - ;; ( dfa -- tfa ) - ;; Advance a word tfa pointer to the dfa field - mov rax,qword[rsp] - mov rax,qword [rax-24] ; tfa - mov qword [rsp],rax - next - WORD p_wordlist,'CURRENT-WORDLIST',dovariable ;; CURRENT-WORDLIST points to cfa of the currently active wordlist. dq p_forth_DFA - + WORD p_words,'WORDS',fasm ;; ( -- ) ;; Dump all words @@ -98,37 +74,38 @@ p_strncmp_end: push rcx next - WORD p_find,'FIND' - ;; ( chars length -- [ 0 ]|[ tfa ] ) + WORD p_find,'FIND',fasm + ;; ( chars* length -- [ chars* length 0 ]|[ tfa ] ) ;; Search the current wordlists for the given pname pushr rsi mov rcx,[p_wordlist_DFA] - mov rcx,qword [rcx] - mov rbx,[rsp] - mov rax,[rsp+8] + mov rcx,qword [rcx] ; use rcx for word list traversing + mov rbx,qword [rsp] ; rbx is input length + mov rsi,qword [rsp+8] ; rsi is input chars* p_find_loop: cmp rcx,0 - je p_find_notfound + je p_find_notfound ; jump at end of word list cmp rbx,qword [rcx+16] ; compare lengths - jne p_find_nextword + jne p_find_nextword ; jump on length mismatch push rcx ; save tfa for later ;; check word - push rax + push rsi ; input chars tfa2pname rcx - push rcx - push rbx + push rcx ; word chars + push rbx ; length DOFORTH p_strncmp pop rax ; return value pop rcx ; restore tfa cmp rax,0 je p_find_found - mov rbx,[rsp] - mov rax,[rsp+8] + mov rbx,qword [rsp] + mov rsi,qword [rsp+8] p_find_nextword: - mov rcx,[rcx] + mov rcx,qword [rcx] jmp p_find_loop p_find_notfound: xor rcx,rcx + sub rsp,16 p_find_found: add rsp,8 mov qword [rsp],rcx ; replace with tfa / 0